This is an archive of the discontinued LLVM Phabricator instance.

X86: Work around a bfd ld quirk wrt GOTTPOFF relocation processing
ClosedPublic

Authored by majnemer on Jan 5 2015, 2:44 AM.

Details

Summary

bfd ld has a quirk which surfaces when transitioning a initial-exec
model relocation to a local-exec style code sequence.

However, it expects the R_X86_64_GOTTPOFF relocation to target a movq or
addq instruction and will fatally error if we have shrunk the load to a
movl or addl.

Work around this by prohibiting the truncation of such loads.

This fixes PR22083.

N.B. It could be argued that this isn't a bug in bfd ld because the
"ELF Handling for Thread-Local Storage" declares that GOTTPOFF be used
with addq and movq exclusively. However, bfd ld is happy to 'Do The
Right Thing' (TM) in X32 mode and gold has no qualms acting on a
movl/addl.

Diff Detail

Repository
rL LLVM

Event Timeline

majnemer updated this revision to Diff 17791.Jan 5 2015, 2:44 AM
majnemer retitled this revision from to X86: Work around a bfd ld quirk wrt GOTTPOFF relocation processing.
majnemer updated this object.
majnemer added a subscriber: Unknown Object (MLST).
rafael accepted this revision.Jan 5 2015, 7:14 AM
rafael edited edge metadata.
This revision is now accepted and ready to land.Jan 5 2015, 7:14 AM
echristo accepted this revision.Jan 5 2015, 9:08 AM
echristo edited edge metadata.

I'd completely forgotten about this.

LGTM.

-eric

This revision was automatically updated to reflect the committed changes.