On 2015-Dec-15, at 4:36 AM, Konstantin Belousov <[email protected]> wrote:

> On Mon, Dec 14, 2015 at 11:06:51PM -0800, Mark Millard wrote:
> . . .
>> By contrast powerpc64-gcc binds the a.out produced to /libexec/ld-elf32.so.1 
>> instead:
>> 
>> # ls -l `which gcc`
>> lrwxr-xr-x  1 root  wheel  48 Dec  5 05:38 /usr/bin/gcc -> 
>> /usr/local/bin/powerpc64-portbld-freebsd11.0-gcc
>> 
>> # gcc --version
>> gcc (FreeBSD Ports Collection for powerpc64) 5.2.0
>> Copyright (C) 2015 Free Software Foundation, Inc.
>> This is free software; see the source for copying conditions.  There is NO
>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>> 
>> # gcc -m32 -mcpu=powerpc main.c
>> # file a.out
>> a.out: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 
>> (FreeBSD), dynamically linked, interpreter /libexec/ld-elf32.so.1, 
>> FreeBSD-style, for FreeBSD 11.0 (1100091), not stripped
> 

> This is a bug in gcc, most likely in the spec file. All FreeBSD
> ABIs use either /libexec/ld-elf.so.1 or (for older versions)
> /usr/libexec/ld-elf.so.1.

If 32 bit code on powerpc64 is supposed to use /libexec/ld-elf.so.1 just like 
the 64 bit code is supposed to then. . .

Looks like lang/gcc49 has the same -m32 -mcpu-powerpc ld-elf32.so.1 problem as 
powerpc64-gcc:

# grep ld-elf 
/usr/obj/portswork/usr/ports/lang/gcc49/work/gcc-4.9-20151202/gcc/config/rs6000/freebsd64.h
#define FREEBSD_DYNAMIC_LINKER32 "/libexec/ld-elf32.so.1"
#define FREEBSD_DYNAMIC_LINKER64 "/libexec/ld-elf.so.1"

# grep ld-elf 
/usr/obj/portswork/usr/ports/lang/gcc49/work/stage/usr/local/lib/gcc49/gcc/powerpc64-portbld-freebsd11.0/4.9.4/plugin/include/config/rs6000/freebsd64.h
#define FREEBSD_DYNAMIC_LINKER32 "/libexec/ld-elf32.so.1"
#define FREEBSD_DYNAMIC_LINKER64 "/libexec/ld-elf.so.1"


Since powerrpc64-gcc is a variant build of gcc5, lang/gcc5 likely has the 
problem too.



===
Mark Millard
markmi at dsl-only.net

On 2015-Dec-15, at 4:36 AM, Konstantin Belousov <[email protected]> wrote:

On Mon, Dec 14, 2015 at 11:06:51PM -0800, Mark Millard wrote:
> # more main.c
> int main()
> {
>    return 0;
> }
> 
> 
> 
> # ls -l `which cc`
> -r-xr-xr-x  7 root  wheel  54137976 Dec 14 00:06 /usr/bin/cc
> 
> # cc --version
> FreeBSD clang version 3.7.0 (tags/RELEASE_370/final 246257) 20150906
> Target: powerpc64-unknown-freebsd11.0
> Thread model: posix
> 
> # cc -m32 -mcpu=powerpc main.c
> # file a.out
> a.out: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (FreeBSD), 
> dynamically linked, interpreter /libexec/ld-elf.so.1, FreeBSD-style, for 
> FreeBSD 11.0 (1100091), not stripped
> 
> 
> 
> By contrast powerpc64-gcc binds the a.out produced to /libexec/ld-elf32.so.1 
> instead:
> 
> # ls -l `which gcc`
> lrwxr-xr-x  1 root  wheel  48 Dec  5 05:38 /usr/bin/gcc -> 
> /usr/local/bin/powerpc64-portbld-freebsd11.0-gcc
> 
> # gcc --version
> gcc (FreeBSD Ports Collection for powerpc64) 5.2.0
> Copyright (C) 2015 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> 
> # gcc -m32 -mcpu=powerpc main.c
> # file a.out
> a.out: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (FreeBSD), 
> dynamically linked, interpreter /libexec/ld-elf32.so.1, FreeBSD-style, for 
> FreeBSD 11.0 (1100091), not stripped
> 
This is a bug in gcc, most likely in the spec file. All FreeBSD
ABIs use either /libexec/ld-elf.so.1 or (for older versions)
/usr/libexec/ld-elf.so.1.

> 
> Context details:
> 
> # freebsd-version -ku; uname -aKU
> 11.0-CURRENT
> 11.0-CURRENT
> FreeBSD FBSDG5C0 11.0-CURRENT FreeBSD 11.0-CURRENT #1 r291891M: Wed Dec  9 
> 09:15:33 PST 2015     
> root@FBSDG5C0:/usr/obj/xtoolchain/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODEBUG
>   powerpc 1100091 1100091
> 
> # pkg info powerpc64-gcc
> powerpc64-gcc-5.2.0_1
> Name           : powerpc64-gcc
> Version        : 5.2.0_1
> Installed on   : Wed Dec  9 02:18:14 2015 PST
> Origin         : devel/powerpc64-gcc
> Architecture   : freebsd:11:powerpc:64
> Prefix         : /usr/local
> Categories     : devel
> . . .
> 
> ===
> Mark Millard
> markmi at dsl-only.net
> 
> _______________________________________________
> [email protected] mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
> To unsubscribe, send any mail to "[email protected]"

_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[email protected]"

Reply via email to