jingduanyang via llvm-dev
2021-Oct-25 11:54 UTC
[llvm-dev] Default linker script used by lld
Hi, Does anyone know the default linker script used by lld? This might be a silly question but I googled everywhere and couldn't find an answer... Thanks, Duanyang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211025/3f6d90bb/attachment.html>
Peter Smith via llvm-dev
2021-Oct-25 16:19 UTC
[llvm-dev] Default linker script used by lld
LLD, doesn't have a built-in linker script in the same way as GNU ld.bfd does. Input Sections are mapped to OutputSections via a simple function https://github.com/llvm/llvm-project/blob/main/lld/ELF/Writer.cpp#L98 then sections are sorted according to rank in https://github.com/llvm/llvm-project/blob/main/lld/ELF/Writer.cpp#L98 hopefully the comments in those files will help reverse engineer a script that looks similar. In practice the default linker behaviour will most significantly differ from ld.bfd by sorting ro-data before ro-code rather than after. This tends towards 3 PT_LOAD program headers ro, ro+exec, rw. Hope that helps Peter From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of jingduanyang via llvm-dev Sent: 25 October 2021 12:54 To: llvm-dev at lists.llvm.org Cc: Weiwei (weiwei, Compiler) <weiwei64 at huawei.com>; Zhangwen(Esan) <zwzhangwen.zhang at huawei.com> Subject: [llvm-dev] Default linker script used by lld Hi, Does anyone know the default linker script used by lld? This might be a silly question but I googled everywhere and couldn't find an answer... Thanks, Duanyang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211025/cdffda69/attachment.html>