This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Ensure output section is not discarded in addStartEndSymbols()
ClosedPublic

Authored by andrewng on Nov 18 2021, 10:56 AM.

Diff Detail

Event Timeline

andrewng created this revision.Nov 18 2021, 10:56 AM
andrewng requested review of this revision.Nov 18 2021, 10:56 AM

This is potentially a "better" alternative to D114103.

MaskRay accepted this revision.Nov 18 2021, 11:32 AM

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.

lld/test/ELF/linkerscript/preinit-array-empty.test
9

Optional: -T is probably more common and conciser.

This revision is now accepted and ready to land.Nov 18 2021, 11:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2021, 3:47 AM