[llvm-dev] [LLD] Placing more sections in same segment as data?

Troy Johnson via llvm-dev llvm-dev at lists.llvm.org
Mon Oct 14 11:57:36 PDT 2019


I've noticed that lld keeps the data section more isolated than the gold or bfd linkers.  For example, readelf -l applied to the "same" executable linked with those three linkers reveals the following under "Section to Segment mapping":

lld:
05     .data .got.plt .bss

gold:
03     .eh_frame .init_array .fini_array .preinit_array .dynamic .got .got.plt .data .bss

bfd:
05     .eh_frame .preinit_array .init_array .fini_array .dynamic .got .got.plt .data .bss

This separation seems to result in lld creating two LOAD RW segments whenever gold or bfd would create only one.  For example, also from readelf -l output:

  LOAD           0x0000000000001a80 0x0000000000203a80 0x0000000000203a80
                 0x00000000000002a8 0x00000000000002a8  RW     0x1000
  LOAD           0x0000000000001d28 0x0000000000204d28 0x0000000000204d28
                 0x0000000000000060 0x000000000000015c  RW     0x1000

Could someone explain why the lld behavior is different?  Is there a way to make it match the gold/bfd behavior?  I've looked through the options list and read some of the lld code, but so far have not been able to find a solution.

Thanks,


Troy Johnson, Ph.D.  |  Manager & Lead, Compiler Optimization

Cray, a Hewlett Packard Enterprise company

2131 Lindau Lane, Suite 1000  |  Bloomington, MN 55425

troyj at cray.com<mailto:prosien at cray.com>  www.cray.com<http://www.cray.com>

[signature_957042053]<https://www.cray.com/>

[signature_921593785]<https://twitter.com/cray_inc>  [signature_1210040077] <https://www.youtube.com/channel/UCS483ZExauoVgpG8dLn5p1w>   [signature_152254817] <https://www.linkedin.com/company/cray-inc-/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191014/b633987e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Outlook-signature_.png
Type: image/png
Size: 26684 bytes
Desc: Outlook-signature_.png
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191014/b633987e/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Outlook-signature_.png
Type: image/png
Size: 1916 bytes
Desc: Outlook-signature_.png
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191014/b633987e/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Outlook-signature_.png
Type: image/png
Size: 1803 bytes
Desc: Outlook-signature_.png
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191014/b633987e/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Outlook-signature_.png
Type: image/png
Size: 1724 bytes
Desc: Outlook-signature_.png
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191014/b633987e/attachment-0003.png>


More information about the llvm-dev mailing list