This is an archive of the discontinued LLVM Phabricator instance.

[SPARC] Improve PIC vs non-PIC handling
ClosedPublic

Authored by joerg on Sep 25 2015, 12:04 PM.

Details

Summary

SPARC has a somewhat strange handling of %lo and %hi modifiers. The existing implementation doesn't agree with the behavior observed with GNU as and we've been missing the corresponding logic for .set. With the patch, I get exactly the same relocations as with GNU as and most importantly, no longer .text relocations in NetBSD's libc.

Diff Detail

Repository
rL LLVM

Event Timeline

joerg updated this revision to Diff 35752.Sep 25 2015, 12:04 PM
joerg retitled this revision from to [SPARC] Improve PIC vs non-PIC handling.
joerg updated this object.
joerg added reviewers: jyknight, venkatra.
joerg added a subscriber: llvm-commits.
jyknight added inline comments.Sep 29 2015, 9:47 AM
lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
470 ↗(On Diff #35752)

"set _GLOBAL_OFFSET_TABLE_" should be emitted with a PC22/PC10 reloc to match, too. Can you extract the kind conversion logic to a separate function and just call it?

1088 ↗(On Diff #35752)

"work slightly differently" seems rather understating the extent of the insanity. :)

test/MC/Sparc/sparc-pic.s
2 ↗(On Diff #35752)

The nonpic cases are covered by sparc-relocations.s already I think? Guess it's fine to restate them here tho.

49 ↗(On Diff #35752)

Might be nice to keep both cases since they're supposed to end up the same.

This revision was automatically updated to reflect the committed changes.