[llvm-dev] lld: order of object files to be put into executable

George Rimar via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 26 03:11:11 PST 2018


>Hi Quolick,
>
>I don't know if you are using the ELF or COFF LLD (I do not know the
>latter), but at least if you are using the ELF linker, you could use the
>--symbol-ordering-file option to put symbols from the object files you care
>about next to each other. This orders the input sections from the object
>file, based on the requested symbol order. This could be used to achieve
>the code locality as suggested by Nicolai.
>
>Regards,
>
>James

Or with use of linkerscript:

SECTIONS { 
  .text : {
  file1.o(.text*)
  file2.o(.text*) 
  *(.text*) 
}

Though --symbol-ordering-file is a better way probably as it was designed exactly for
improving locality and does not rely on using scripts.

George.


More information about the llvm-dev mailing list