This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Support powerpcle target in Clang [3/5]
ClosedPublic

Authored by Bdragon28 on Dec 29 2020, 1:52 PM.

Details

Summary

Add powerpcle support to clang.

For FreeBSD, assume a freestanding environment for now, as we only need it in the first place to build loader, which runs in the OpenFirmware environment instead of the FreeBSD environment.

For Linux, recognize glibc and musl environments to match current usage in Void Linux PPC.

Adjust driver to match current binutils behavior regarding machine naming.

Adjust and expand tests.

Diff Detail

Event Timeline

Bdragon28 created this revision.Dec 29 2020, 1:52 PM
Bdragon28 requested review of this revision.Dec 29 2020, 1:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 29 2020, 1:52 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Bdragon28 edited the summary of this revision. (Show Details)Dec 29 2020, 2:09 PM
Bdragon28 added a reviewer: MaskRay.
Bdragon28 added a project: Restricted Project.
MaskRay added inline comments.Dec 29 2020, 3:44 PM
clang/lib/Driver/ToolChains/Gnu.cpp
260

This needs a linker test in clang/test/Driver/ppc-features.cpp

clang/lib/Frontend/CompilerInvocation.cpp
3295

Please format

clang/test/Driver/ppc-endian.c
1–4

"-unknown" is correct, though I usually omit it as it is not useful...

MaskRay retitled this revision from [PowerPC] powerpcle target 3/5 to [PowerPC] Support powerpcle target in Clang [3/5].Dec 29 2020, 3:45 PM
Bdragon28 updated this revision to Diff 314049.Dec 29 2020, 6:52 PM
  • Adjust the GNU LD settings for 32 bit powerpc to more closely match reality.
  • Add linker emulation test for powerpcle, as well as adding testing for the FreeBSD emulations.
Bdragon28 marked 3 inline comments as done.Dec 29 2020, 6:54 PM
Bdragon28 added inline comments.
clang/test/Driver/ppc-endian.c
1–4

This is actually intentional!

I needed to force it to emit the hyphen so I could tell powerpc apart from powerpcle. The same for powerpc64, the BE test was actually not working properly as is because it would also match on LE.

Bdragon28 marked an inline comment as done.Dec 29 2020, 6:55 PM
MaskRay accepted this revision.Dec 29 2020, 7:31 PM
MaskRay added inline comments.
clang/test/Driver/ppc-endian.c
1–4

You can write "-triple" "powerpcle" ..

I think the driver side works even without TargetInfo change

This revision is now accepted and ready to land.Dec 29 2020, 7:31 PM
Bdragon28 edited the summary of this revision. (Show Details)Jan 2 2021, 8:53 AM
This revision was landed with ongoing or failed builds.Jan 2 2021, 10:20 AM
This revision was automatically updated to reflect the committed changes.