[PATCH] D114179: [ELF] Ensure output section is not discarded in addStartEndSymbols()

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 18 11:32:37 PST 2021


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

I agree that this version is better to ensure `addr(.preinit_array) = __preinit_array_start`.

The R_X86_64_REX_GOTPCRELX issue is related to a limitation of our current framework.
https://maskray.me/blog/2020-12-19-lld-and-gnu-linker-incompatibilities
GNU ld seems to suppress optimization in the case.



================
Comment at: lld/test/ELF/linkerscript/preinit-array-empty.test:8
+## Link should succeed without causing an out of range relocation error.
+# RUN: ld.lld --script %t/discarded.script %t.o -o %t1 --image-base=0x80000000
+# RUN: llvm-readelf -s %t1 | FileCheck --check-prefixes=CHECK,DISCARDED %s
----------------
Optional: `-T` is probably more common and conciser.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114179/new/

https://reviews.llvm.org/D114179



More information about the llvm-commits mailing list