Bug 93157

Summary: gcc should use -mabi=elfv2 on powerpc64-*-linux-*musl* target by default.
Product: gcc Reporter: gyakovlev
Component: targetAssignee: Not yet assigned to anyone <unassigned>
Status: WAITING ---    
Severity: normal CC: dje, segher, slyich, toolchain
Priority: P3    
Version: unknown   
Target Milestone: ---   
Host: Target: powerpc64-*-linux-*musl*
Build: Known to work:
Known to fail: Last reconfirmed: 2020-01-21 00:00:00

Description gyakovlev 2020-01-05 05:02:58 UTC
encountered with 9.2.0 but I think all versions affected.


By default at configuration time gcc assumes that powerpc64-*-linux-* (big endian ppc64) targets use ELFv1 ABI, and ELFv2 abi on little-endian.

But musl libc does not support ELFv1 at all on either endian ppc64.

Their INSTALL file clearly mentions:
* PowerPC64
    * Both little and big endian variants are supported
    * Compiler toolchain must provide 64-bit long double, not IBM
      double-double or IEEE quad
    * Compiler toolchain must use the new (ELFv2) ABI regardless of
      whether it is for little or big endian

I think gcc configuration should default to --with-abi=elfv2 on powerpc64-*-linux-*musl* target.


 * Configuring GCC with:
 *      --host=powerpc64-unknown-linux-gnu
 *      --target=powerpc64-unknown-linux-musl
 *      --build=powerpc64-unknown-linux-gnu



after that musl fails
checking whether linker accepts -lgcc_eh... yes
using compiler runtime libraries: -lgcc -lgcc_eh
checking preprocessor condition _CALL_ELF == 2... false
./configure: error: unsupported powerpc64 ABI
Comment 1 Martin Liška 2020-01-21 14:18:40 UTC
@Segher: Can you please take a look?
Comment 2 Segher Boessenkool 2020-01-23 14:20:37 UTC
Someone who can test this should send a patch, and Cc: the Musl OS port maintainer
(is there one?  There should be!)