[PATCH] D27070: Implement STARTUP linker script command.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 23:56:08 PST 2016


Rui Ueyama via llvm-commits <llvm-commits at lists.llvm.org> writes:


> +# RUN: echo ".quad 0xAAAAAAAAAAAAAAAA" > %t1.s
> +# RUN: echo ".quad 0xFFFFFFFFFFFFFFFF" > %t2.s
> +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t1.s -o foo.o
> +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t2.s -o bar.o
> +
> +# RUN: echo "STARTUP(foo.o)" > script
> +# RUN: ld.lld -o exe -script=script foo.o bar.o
> +# RUN: llvm-objdump -s exe | FileCheck -check-prefix=FOO %s
> +
> +# FOO: Contents of section .text:
> +# FOO: 201000 aaaaaaaa aaaaaaaa ffffffff ffffffff

With bfd the rule seems to be that the file is added to the start, no
reordered. So in the above testcase I get

 0000 aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa  ................
 0010 ffffffff ffffffff                    ........

note how the first file shows up twice, once from the script once from
the command line.

Cheers,
Rafael


More information about the llvm-commits mailing list