This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Correctly use ELFv2 ABI on FreeBSD/powerpc64
ClosedPublic

Authored by pkubaj on Feb 16 2023, 3:59 PM.

Details

Summary

Currently ELFv2 is mostly set, but some places still default to ELFv1.
While this mostly works, it breaks in particular when lld is used with LTO,
as reported in https://github.com/llvm/llvm-project/issues/46697.

Diff Detail

Event Timeline

pkubaj created this revision.Feb 16 2023, 3:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2023, 3:59 PM
pkubaj requested review of this revision.Feb 16 2023, 3:59 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 16 2023, 3:59 PM
pkubaj updated this revision to Diff 498185.Feb 16 2023, 4:02 PM

Fix indenting according to clang-format suggestions.

Nice catch!
I'm not a LLVM maintainer but from FreeBSD PowerPC side I agree with the changes, only added two suggestions that could improve code readability

clang/lib/Basic/Targets/PPC.h
428

The comparison Triple.getOSMajorVersion() == 0 works, but I think Triple.getOSVersion().empty() would better describe the intent

llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
237

Same here, it could be TT.getOSVersion().empty() instead of TT.getOSMajorVersion() == 0

adalava accepted this revision.Feb 16 2023, 7:04 PM
This revision is now accepted and ready to land.Feb 16 2023, 7:04 PM
pkubaj updated this revision to Diff 498378.Feb 17 2023, 7:58 AM

Addres adalava's review.

brad added a subscriber: brad.

I noticed this review. I have provided a more complete diff for review at D144321.

dim added a comment.Feb 18 2023, 4:22 PM

I noticed this review. I have provided a more complete diff for review at D144321.

Yeah I think that is probably the better option, hope @pkubaj and @adalava agree with that?

As Brad's version covers both FreeBSD and OpenBSD, and also updates a bunch of unit tests, which this review appears to break (see the Unit Tests https://reviews.llvm.org/harbormaster/unit/214420/).

I noticed this review. I have provided a more complete diff for review at D144321.

Yeah I think that is probably the better option, hope @pkubaj and @adalava agree with that?

As Brad's version covers both FreeBSD and OpenBSD, and also updates a bunch of unit tests, which this review appears to break (see the Unit Tests https://reviews.llvm.org/harbormaster/unit/214420/).

I agree with D144321, sorry for the late reply. @pkubaj and @brad , thanks for pushing it. I think D144232 can be abandoned, right?

brad added a comment.Feb 27 2023, 12:03 PM

I agree with D144321, sorry for the late reply. @pkubaj and @brad , thanks for pushing it. I think D144232 can be abandoned, right?

Correct.

dim closed this revision.Feb 27 2023, 12:03 PM