Page MenuHomeFreeBSD

Mk/ detect powerpc64 abi

Authored by mikael on Oct 15 2019, 3:44 PM.



We'll have a new abi on ppc64 soon (ELFv2) which is incompatible with the ELFv1 abi. We need to detect the abi on which we build stuff.

Diff Detail

rP FreeBSD ports repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

tcberner added a subscriber: tcberner.

The qt-dist part looks fine to me with my kde@-hat on.

77 ↗(On Diff #63296)

PPC_ABI is set only on powerpc64, so there's no need to check for powerpc64 here.

175 ↗(On Diff #63296)

powerpc and powerpcspe will switch to LLVM at the same time as powerpc64, so there could be one check (probably based either on OSVERSION or existence of /usr/bin/clang) for all powerpc*.

330–332 ↗(On Diff #63296)

This block can be removed, none of gecko ports (thunderbird, firefox, firefox-esr, cliqz) work on elfv1.

pkubaj requested changes to this revision.Oct 16 2019, 6:13 PM
This revision now requires changes to proceed.Oct 16 2019, 6:13 PM
77 ↗(On Diff #63296)

Actually PPC_ABI is not being defined if platform is !powerpc64 and make will complain it's a "malformed line", so $ARCH check is required.

Other solutions could be:

.if defined(PPC_ABI) && ${PPC_ABI} == ELFv1

or (didn't check this)

.if "${PPC_ABI}" == ELFv1
This comment was removed by pkubaj.
77 ↗(On Diff #63296)

Then I think the variant below:

.if defined(PPC_ABI) && ${PPC_ABI} == ELFv1

is the cleanest one (but I'm not in portmgr, so my opinion here actually doesn't matter).

portmgr, since you definitely don't care about this patch (it's opened for a month now) can you remove yourself as a blocker, it blocks people from working, thank you

Note to anyone confused about PPC_ABI being specific to ppc64: The powerpc and powerpcspe abi is NOT changing (only the compiler), as there is no such thing as 32 bit ELFv2 ABI.

ELFv2 is shorthand for The OpenPOWER ELF V2 ABI, described in "64-Bit ELF V2 ABI Specification: Power Architecture". It has a baseline requirement of 64-bit.
ELFv1 is shorthand for The 64-bit IBM PowerPC ELF ABI, described in "64-bit PowerPC ELF Application Binary Supplement 1.9".

The 32 bit ABI was originally described in "System V Application Binary Interface: PowerPC Processor Supplement" from 1995, but the modern version covering everything 32-bit is "The Power Architecture 32-bit ABI", as described in "Power Architecture® 32-bit Application
Binary Interface Supplement 1.0 - Linux® & Embedded" -- this covers both powerpc and powerpcspe.

Not a huge fan of the added != but since it's only for powerpc64 and only temporary until there's a version bump for it, I think it's OK. Approved. Please wait 1 day before committing.

This revision is now accepted and ready to land.Nov 4 2019, 7:14 PM
1130 ↗(On Diff #63475)

This needs to be cached, see usage of _EXPORTED_VARS.

This revision now requires review to proceed.Nov 5 2019, 1:34 PM
pkubaj requested changes to this revision.Nov 6 2019, 5:03 PM

Mk/Uses/ now also needs to be changed after

This revision now requires changes to proceed.Nov 6 2019, 5:03 PM
1129–1135 ↗(On Diff #64034)

I have never actually used _EXPORTED_VARS, but the goal is to not run the command in != if the variable is already set, so you might need to test if the variable already exists, and only add to _EXPORTED_VARS if the arch is powerpc64. See other places where the variable is used.

This revision is now accepted and ready to land.Nov 7 2019, 12:34 PM

Hopefully I got this right.

Do I need to put space with multiple .if? it's not very consistent in the file.

This revision now requires review to proceed.Nov 7 2019, 6:24 PM

Is this ready to commit?

This revision is now accepted and ready to land.Nov 22 2019, 8:16 PM
This revision was automatically updated to reflect the committed changes.