This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Add -z pack-relative-relocs
ClosedPublic

Authored by MaskRay on Mar 1 2022, 12:57 AM.

Details

Summary

GNU ld 2.38 added -z pack-relative-relocs which is similar to
--pack-dyn-relocs=relr but synthesizes the GLIBC_ABI_DT_RELR version
dependency if a shared object named libc.so.* has a GLIBC_2.* version
dependency.

This is used to implement the (as some glibc folks call) version lockout
mechanism. Add this option, because glibc does not want to support
--pack-dyn-relocs=relr which does not add GLIBC_ABI_DT_RELR.
See https://maskray.me/blog/2021-10-31-relative-relocations-and-relr for
detail.

Close https://github.com/llvm/llvm-project/issues/53775

Diff Detail

Event Timeline

MaskRay created this revision.Mar 1 2022, 12:57 AM
MaskRay requested review of this revision.Mar 1 2022, 12:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2022, 12:57 AM
MaskRay added a subscriber: zatrazz.Mar 1 2022, 1:50 AM

Code changes LGTM. Will be worth release noting and updating the ld.lld.1 man page as I think we've got an entry for pack-dyn-relocs.

MaskRay updated this revision to Diff 412193.Mar 1 2022, 11:51 AM
MaskRay edited the summary of this revision. (Show Details)

release note / manpage

Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2022, 12:32 PM
MaskRay edited the summary of this revision. (Show Details)Mar 1 2022, 12:34 PM
emaste added inline comments.Mar 1 2022, 2:32 PM
lld/docs/ReleaseNotes.rst
29 ↗(On Diff #412193)

"supported to support" sounds odd. maybe "is now available to support DT_RELR" or something similar

peter.smith accepted this revision.Mar 2 2022, 1:59 AM

I agree with emaste's comment on the release notes. I'm guessing that can be fixed up prior to committing. LGTM otherwise.

This revision is now accepted and ready to land.Mar 2 2022, 1:59 AM
MaskRay updated this revision to Diff 412485.Mar 2 2022, 10:44 AM
MaskRay marked an inline comment as done.

Thanks for the review and the release note suggestion.
Updated.

I'll wait on glibc side discussion https://sourceware.org/pipermail/libc-alpha/2022-March/

MaskRay updated this revision to Diff 412607.Mar 2 2022, 10:43 PM

Check libc.so.*

This revision was automatically updated to reflect the committed changes.