This is an archive of the discontinued LLVM Phabricator instance.

Add support for powerpc64-*-linux-musl targets
ClosedPublic

Authored by awilfox on Sep 12 2018, 9:44 PM.

Details

Reviewers
hfinkel
MaskRay
Summary

This patch ensures that 64-bit PowerPC musl targets use ELFv2 ABI on both endians. source stating musl uses ELFv2 on both endians

I've tested this on multiple ppc64 hosts running musl and it works fine. I am unsure whether there should be any unit tests added (what would they test?), but if there is a need for that, I will be happy to add it.

All expected tests passed when applied to LLVM 6.0.1 and trunk.

I am also unsure if this affects 32-bit PowerPC or not. It did not seem to in my testing, and it shouldn't; however, if I need to add a TT.getArch() check to this, I will.

Diff Detail

Repository
rL LLVM

Event Timeline

awilfox created this revision.Sep 12 2018, 9:44 PM
awilfox edited the summary of this revision. (Show Details)Sep 12 2018, 9:45 PM

Please provide the patch with full context as per http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface. Furthermore, if you would like to commit this, it'll have to go into trunk and then it can be merged into 7.0.1 (I'm not sure that we'd be able to merge it into any 6.0 release as there may not be a 6.0.2).
Finally, for the test case you can just compile anything with llc with the triple you are interested in and a CHECK directive can check for .abiversion 2 in the assembly.

awilfox updated this revision to Diff 168360.Oct 4 2018, 2:05 PM
  • The diff now has full context as requested.
  • Per Samuel Holland, this did affect 32-bit PowerPC targets, so this patch has been changed to ensure it only affects 64-bit targets.
  • Added a test to ppc64-elf-abi.ll to ensure musl is generating ELFv2 code on big endian. The test does pass when the patch is applied.

This still applies to 6.0.1, though obviously not cleanly with full context. It was written against trunk.

MaskRay accepted this revision.May 15 2019, 9:25 PM

Since ELFv2 is the only ABI musl supports. ELFv1 is unlikely to ever be supported, LG

This revision is now accepted and ready to land.May 15 2019, 9:25 PM
MaskRay added inline comments.May 15 2019, 9:26 PM
lib/Target/PowerPC/PPCTargetMachine.cpp
202 ↗(On Diff #168360)

The code may have explained the intent well.

MaskRay closed this revision.Aug 2 2020, 9:11 PM

This was properly committed, but we do not need it after D72352