Quolick via llvm-dev
2018-Feb-26 04:33 UTC
[llvm-dev] lld: order of object files to be put into executable
Hi all! Is it possible somehow to specify *order* of object files to be put to executable file? For example, I want to put obj1.o and obj2.o somewhere at the beginning, so when executable file would be mapped to memory, this code would be accessed quickly.
Nicolai Hähnle via llvm-dev
2018-Feb-26 06:48 UTC
[llvm-dev] lld: order of object files to be put into executable
Hi Quolick, the order of pages in an executable doesn't really matter in modern operating systems. The relevant parts of the executable are mmap()ed and loaded on demand. Although, keeping related code together for locality could be an advantage (both at load times w/ readahead and in the TLB during runtime), so that's a more interesting question to pursue. Cheers, Nicolai On 26.02.2018 05:33, Quolick via llvm-dev wrote:> Hi all! > > Is it possible somehow to specify *order* of object files to be put to executable file? > For example, I want to put obj1.o and obj2.o somewhere at the beginning, so when executable file would be mapped > to memory, this code would be accessed quickly. > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-- Lerne, wie die Welt wirklich ist, Aber vergiss niemals, wie sie sein sollte.
James Henderson via llvm-dev
2018-Feb-26 09:35 UTC
[llvm-dev] lld: order of object files to be put into executable
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 On 26 February 2018 at 06:48, Nicolai Hähnle via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi Quolick, > > the order of pages in an executable doesn't really matter in modern > operating systems. The relevant parts of the executable are mmap()ed and > loaded on demand. > > Although, keeping related code together for locality could be an advantage > (both at load times w/ readahead and in the TLB during runtime), so that's > a more interesting question to pursue. > > Cheers, > Nicolai > > > On 26.02.2018 05:33, Quolick via llvm-dev wrote: > >> Hi all! >> >> Is it possible somehow to specify *order* of object files to be put to >> executable file? >> For example, I want to put obj1.o and obj2.o somewhere at the beginning, >> so when executable file would be mapped >> to memory, this code would be accessed quickly. >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> > > -- > Lerne, wie die Welt wirklich ist, > Aber vergiss niemals, wie sie sein sollte. > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180226/0c7d6fbe/attachment-0001.html>