Forcing ELFv2 abi doesn't work for big-endian mode as this mode has no
support for ELFv2. ppc64 linux big-endian is deprecated, it' not unexpected
to get such issues. Dropping big-endian support for powerpc could be an
option to solve this issue but that will be a drawback for AIX (BE) systems.
regards,
Maamoun
On Mon, Aug 16, 2021 at 10:54 PM Niels Möller <nisse(a)lysator.liu.se> wrote:
> Stijn Tintel <stijn(a)linux-ipv6.be> writes:
>
> > I suspect this is because musl doesn't support the ELFv1 ABI on ppc64 at
> > all, regardless of endianness. I've tried adding -mabi=elfv2 to CFLAGS,
> > to force using the ELFv2 ABI, but the problem persists. Suggestions
> welcome.
>
> I don't know that much about ppc64 abi issues myself. From your
> description, it seems clear that it's a linker error, and that object
> files corresponding to C source files somehow carry different "abi
> version attributes" than object files corresponding to nettle's assembly
> source files.
>
> As you've found, configuring with --disable-assembler works around the
> problem, but to solve it properly, we'd need to understand why that is.
> The assembler should not be invoked directly, but via the same $(CC) and
> $(CFLAGS) as the C compiler.
>
> You'd need to compare those object files and how they're generated.
> Compare the compiler command lines. You could perhaps use gcc -v to see
> how gcc invokes the assembler in both cases. You can use gcc -save-temps
> to look at the assembly files generated by gcc, and check if they use
> some special pseudoops to specify the abi. You can use tools like
> objdump or readelf to compare attributes in the object files.
>
> If you can figure out how to produce object files that are compatible
> according to the linker, that may not be sufficient, though. You also
> need to tweak the assembly files and related macros and configure checks
> to use the right api. See powerpc64/README and powerpc64/machine.m4. As
> I understand it, abi is currently selected depending on the endianness,
> using v1 for big endian and v2 for little endian.
>
> It may need a configure test independent of endianness. Maybe there's
> some predefined symbol we can check, similar to 32-bit/64-bit ABI checks
> on other platforms? You could run something like
>
> powerpc64-openwrt-linux-musl-gcc -E -dM - </dev/null | sort
>
> With the powerpc64le-linux-gnu-gcc cross compiler I have, the closest
> suspect I see is
>
> #define _CALL_ELF 2
>
> Maybe that's the right thing to check? I don't have a big-endian system
> or crosscompiler close at hand, but at least there's a bigendian
> powerpc64-linux-gnu cross compile setup in the ci system hosted at gitlab.
>
> Regards,
> /Niels
>
> --
> Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
> Internet email is subject to wholesale government surveillance.
>