From owner-freebsd-toolchain@freebsd.org Tue Dec 15 03:34:44 2015 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 629FAA47F8B for ; Tue, 15 Dec 2015 03:34:44 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-211-152.reflexion.net [208.70.211.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 23FD11E7A for ; Tue, 15 Dec 2015 03:34:43 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 9419 invoked from network); 15 Dec 2015 03:34:36 -0000 Received: from unknown (HELO mail-cs-02.app.dca.reflexion.local) (10.81.19.2) by 0 (rfx-qmail) with SMTP; 15 Dec 2015 03:34:36 -0000 Received: by mail-cs-02.app.dca.reflexion.local (Reflexion email security v7.80.0) with SMTP; Mon, 14 Dec 2015 22:34:35 -0500 (EST) Received: (qmail 5775 invoked from network); 15 Dec 2015 03:34:35 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with SMTP; 15 Dec 2015 03:34:35 -0000 X-No-Relay: not in my network X-No-Relay: not in my network Received: from [192.168.1.8] (c-76-115-7-162.hsd1.or.comcast.net [76.115.7.162]) by iron2.pdx.net (Postfix) with ESMTPSA id 304B31C43BA; Mon, 14 Dec 2015 19:34:30 -0800 (PST) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: powerpc64 11.0-CURRENT lib32/libc.so.7 _init dies (powerpc64-gcc/WITH_LIBCPLUSPLUS based): details of how Message-Id: <3FCCD60E-E5EB-4BB4-8C4A-767AE93C8945@dsl-only.net> Date: Mon, 14 Dec 2015 19:34:35 -0800 To: FreeBSD PowerPC ML , FreeBSD Toolchain Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) X-Mailer: Apple Mail (2.2104) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Dec 2015 03:34:44 -0000 If I avoid use of lib32 I can use powerpc64-gcc on a powerpc64 PowerMac = G5 to build and then install kernel and world, including WITH_BOOT=3D. = Rebooting and running works fine. WITH_LIB32=3D does build and install = as well --but it does not run fine. After the reboot compiling/linking the below source code with -m32 via = powerpc64-gcc running the a.out has lib32/libc.so.7 die in libc.so.7's = _init: > # more main.c > int main() > { > return 0; > } > # 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 > Reading symbols from a.out...(no debugging symbols found)...done. > (gdb) start > Temporary breakpoint 1 at 0x1800684 > Starting program: /root/c_tests/a.out=20 >=20 > Program received signal SIGSEGV, Segmentation fault. > 0x41867ee0 in _init () from /usr/lib32/libc.so.7 > (gdb) x/20i 0x41867ecc > 0x41867ecc <_init>: stwu r1,-16(r1) > 0x41867ed0 <_init+4>: mflr r0 > 0x41867ed4 <_init+8>: stw r31,12(r1) > 0x41867ed8 <_init+12>: stw r0,20(r1) > 0x41867edc <_init+16>: mr r31,r1 > =3D> 0x41867ee0 <_init+20>: lwz r3,-11432(r30) > 0x41867ee4 <_init+24>: lwz r9,0(r3) > 0x41867ee8 <_init+28>: cmpwi cr7,r9,0 > 0x41867eec <_init+32>: beq cr7,0x41867f04 <_init+56> . . . so r30 is as it was at the indirect call from objlist_call_init . = . . > (gdb) x/150i objlist_call_init > 0x41814c74 : stwu r1,-64(r1) > 0x41814c78 : mflr r0 > 0x41814c7c : bl 0x4183bb58 > 0x41814c80 : li r8,0 > 0x41814c84 : stw r30,56(r1) > 0x41814c88 : mflr r30 > . . . > 0x41814d88 : bl 0x418131b0 = > 0x41814d8c : lwz r9,4(r28) > 0x41814d90 : lwz r5,256(r9) > 0x41814d94 : mtctr r5 > 0x41814d98 : bctrl > . . . . . . which established r30=3D=3D0x4183bb58+4 (from the bl prior to the = mflr above). . . > (gdb) x/4i 0x4183bb58 > 0x4183bb58: blrl > 0x4183bb5c <_SDA_BASE_>: .long 0x2b3f8 > 0x4183bb60 <_SDA_BASE_+4>: .long 0x0 > 0x4183bb64 <_SDA_BASE_+8>: .long 0x0 > (gdb) info registers > r0 0x41814d9c 1098993052 > r1 0xffffd730 4294956848 > r2 0x41835508 1099126024 > r3 0x0 0 > r4 0x4183c4dc 1099154652 > r5 0x41867ecc 1099333324 > r6 0x0 0 > r7 0x1000 4096 > r8 0x0 0 > r9 0x0 0 > r10 0x4182f200 1099100672 > r11 0xffffd780 4294956928 > r12 0x41814d58 1098992984 > r13 0x0 0 > r14 0x6474e552 1685382482 > r15 0x6474e551 1685382481 > r16 0x2 2 > r17 0x4183b48c 1099150476 > r18 0x4182f000 1099100160 > r19 0x0 0 > r20 0x1 1 > r21 0x0 0 > r22 0x4183bb90 1099152272 > r23 0xffffd788 4294956936 > r24 0x4183bbb4 1099152308 > r25 0x4183bbc8 1099152328 > r26 0x4183bbcc 1099152332 > r27 0x4183bbec 1099152364 > r28 0x41830050 1099104336 > r29 0x0 0 > r30 0x4183bb5c 1099152220 > r31 0xffffd730 4294956848 > pc 0x41867ee0 0x41867ee0 <_init+20> > msr > cr 0x28000482 671089794 > lr 0x41814d9c 0x41814d9c > ctr 0x41867ecc 1099333324 > xer 0x20000000 536870912 > (gdb) x 0x4183bb5c-11432 > 0x41838eb4: Cannot access memory at address 0x41838eb4 That subtraction being from "lwz r3,-11432(r30)". My guess would be that the r30 value and the offset in _init are not = matched up correctly. I've not tracked down where the _init code at and = after _init+20 comes from (i.e., _init at and after 0x41867ee0). Context details, ignore unless you care: (tabs and such probably not preserved) > # 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/GENERIC64v= tsc-NODEBUG powerpc 1100091 1100091 > # more ~/src.configs/src.conf.powerpc64-xtoolchain.powerpc64-host=20 > KERNCONF=3DGENERIC64vtsc-NODEBUG > TARGET=3Dpowerpc > TARGET_ARCH=3Dpowerpc64 > WITHOUT_CROSS_COMPILER=3D > # > # 1 thing that fails to build if attempted: > WITHOUT_CLANG_EXTRAS=3D > # > WITH_FAST_DEPEND=3D > WITH_LIBCPLUSPLUS=3D > WITH_LIB32=3D > WITH_BOOT=3D > WITH_CLANG=3D > WITH_CLANG_IS_CC=3D > WITH_CLANG_FULL=3D > WITH_LLDB=3D > # > WITHOUT_GCC=3D > WITHOUT_GNUCXX=3D > # > NO_WERROR=3D > MALLOC_PRODUCTION=3D > #CFLAGS+=3D -DELF_VERBOSE > # > WITH_DEBUG=3D > WITH_DEBUG_FILES=3D > # > CC=3D/usr/local/bin/powerpc64-portbld-freebsd11.0-gcc > CXX=3D/usr/local/bin/powerpc64-portbld-freebsd11.0-g++ > CPP=3D/usr/local/bin/powerpc64-portbld-freebsd11.0-cpp > CROSS_BINUTILS_PREFIX=3D/usr/local/powerpc64-freebsd/bin/ > X_COMPILER_TYPE=3Dgcc > # > DEPFLAGS+=3D -isystem = /usr/obj/xtoolchain/powerpc.powerpc64/usr/src/tmp/usr/include/. = -I/usr/obj/xtoolchain/powerpc.powerpc64/usr/src/tmp/usr/include/c++/v1/. = -I/usr/include/c++/v1/. > # > CFLAGS+=3D -isystem = /usr/obj/xtoolchain/powerpc.powerpc64/usr/src/tmp/usr/include/. = -Wl,-rpath-link = -Wl,/usr/obj/xtoolchain/powerpc.powerpc64/usr/src/tmp/usr/lib/. = -Wl,-rpath-link = -Wl,/usr/obj/xtoolchain/powerpc.powerpc64/usr/src/tmp/lib/. = -L/usr/obj/xtoolchain/powerpc.powerpc64/usr/src/tmp/usr/lib/. = -L/usr/obj/xtoolchain/powerpc.powerpc64/usr/src/tmp/lib/. > # > LDFLAGS+=3D -Wl,-rpath-link = -Wl,/usr/obj/xtoolchain/powerpc.powerpc64/usr/src/tmp/usr/lib/. = -Wl,-rpath-link = -Wl,/usr/obj/xtoolchain/powerpc.powerpc64/usr/src/tmp/lib/. = -L/usr/obj/xtoolchain/powerpc.powerpc64/usr/src/tmp/usr/lib/. = -L/usr/obj/xtoolchain/powerpc.powerpc64/usr/src/tmp/lib/. > # > CXXFLAGS+=3D -isystem = /usr/obj/xtoolchain/powerpc.powerpc64/usr/src/tmp/usr/include/. = -I/usr/obj/xtoolchain/powerpc.powerpc64/usr/src/tmp/usr/include/c++/v1/. = -std=3Dgnu++11 > # > CXXFLAGS+=3D -I/usr/include/c++/v1/. -std=3Dgnu++11 -L/usr/lib/. > # svnlite diff /usr/src/ > Index: /usr/src/sys/boot/ofw/Makefile.inc > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- /usr/src/sys/boot/ofw/Makefile.inc (revision 291891) > +++ /usr/src/sys/boot/ofw/Makefile.inc (working copy) > @@ -2,7 +2,7 @@ > =20 > .if ${MACHINE_ARCH} =3D=3D "powerpc64" > CFLAGS+=3D -m32 -mcpu=3Dpowerpc > -LDFLAGS+=3D -m elf32ppc_fbsd > +LDFLAGS+=3D -Wl,-m -Wl,elf32ppc_fbsd > .endif > =20 > .include "../Makefile.inc" > Index: /usr/src/sys/boot/powerpc/Makefile.inc > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- /usr/src/sys/boot/powerpc/Makefile.inc (revision 291891) > +++ /usr/src/sys/boot/powerpc/Makefile.inc (working copy) > @@ -2,6 +2,7 @@ > =20 > .if ${MACHINE_ARCH} =3D=3D "powerpc64" > CFLAGS+=3D -m32 -mcpu=3Dpowerpc > +LDFLAGS+=3D -Wl,-m -Wl,elf32ppc_fbsd > .endif > =20 > .include "../Makefile.inc" > Index: /usr/src/sys/boot/uboot/Makefile.inc > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- /usr/src/sys/boot/uboot/Makefile.inc (revision 291891) > +++ /usr/src/sys/boot/uboot/Makefile.inc (working copy) > @@ -2,7 +2,7 @@ > =20 > .if ${MACHINE_ARCH} =3D=3D "powerpc64" > CFLAGS+=3D -m32 -mcpu=3Dpowerpc > -LDFLAGS+=3D -m elf32ppc_fbsd > +LDFLAGS+=3D -Wl,-m -Wl,elf32ppc_fbsd > .endif > =20 > .include "../Makefile.inc" > Index: /usr/src/sys/powerpc/ofw/ofw_machdep.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- /usr/src/sys/powerpc/ofw/ofw_machdep.c (revision 291891) > +++ /usr/src/sys/powerpc/ofw/ofw_machdep.c (working copy) > @@ -110,6 +110,23 @@ > * Assume that interrupt are disabled at this point, or > * SPRG1-3 could be trashed > */ > +#if defined(AIM) && defined(__powerpc64__) > +/* HACK: PowerMac G5 specific code to avoid demonstrated hangs in > + * the early boot time frame. > + * This would need a live test for PowerMac vs. not in order > + * to remove HACK status. > + */ > + if (1) > + __asm __volatile("mfsprg0 %0\n\t" > + "mtsprg1 %1\n\t" > + "mtsprg2 %2\n\t" > + "mtsprg3 %3\n\t" > + : "=3D&r"(ofw_sprg0_save) > + : "r"(ofmsr[2]), > + "r"(ofmsr[3]), > + "r"(ofmsr[4])); > + else > +#endif > __asm __volatile("mfsprg0 %0\n\t" > "mtsprg0 %1\n\t" > "mtsprg1 %2\n\t" > # svnlite diff /usr/ports/ > Index: = /usr/ports/devel/powerpc64-gcc/files/patch-gcc-freebsd-powerpc64 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- /usr/ports/devel/powerpc64-gcc/files/patch-gcc-freebsd-powerpc64 = (revision 403711) > +++ /usr/ports/devel/powerpc64-gcc/files/patch-gcc-freebsd-powerpc64 = (working copy) > @@ -1,5 +1,5 @@ > ---- gcc/config/rs6000/freebsd64.h 2015-11-28 09:06:13.019999000 = -0800 > -+++ gcc/config/rs6000/freebsd64.h 2015-11-28 09:16:10.459373000 = -0800 > +--- gcc/config/rs6000/freebsd64.h.orig 2015-01-05 = 04:33:28.000000000 -0800 > ++++ gcc/config/rs6000/freebsd64.h 2015-12-09 00:14:28.520684000 = -0800 > @@ -65,6 +65,13 @@ > #define INVALID_64BIT "-m%s not supported in this configuration" > #define INVALID_32BIT INVALID_64BIT > @@ -27,3 +27,12 @@ > if (rs6000_isa_flags & OPTION_MASK_EABI) \ > { \ > rs6000_isa_flags &=3D ~OPTION_MASK_EABI; \ > +@@ -304,7 +317,7 @@ > +=20 > + /* rs6000.h gets this wrong for FreeBSD. We use the GCC defaults = instead. */ > + #undef WCHAR_TYPE > +-#define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int") > ++#define WCHAR_TYPE "int" > + #undef WCHAR_TYPE_SIZE > + #define WCHAR_TYPE_SIZE 32 > +=20 powerpc64-gcc's misclassification of the base type for L". . ." notation = does need to be patched. Otherwise building lib32 fails for type errors. = That is what the above is for. Having a powerpc64 self-host powerpc64-gcc has a work around of copying = 6 files to the right names/places near the end of the powerpc64-gcc = build and continuing it from that state. (I've not made a patch to deal = with powerpc64-gcc not really being a cross-compiler context for this.) > # ls -l /usr/lib/libstdc+* > lrwxr-xr-x 1 root wheel 8 Dec 5 05:41 /usr/lib/libstdc++.a -> = libc++.a > lrwxr-xr-x 1 root wheel 9 Dec 5 05:41 /usr/lib/libstdc++.so -> = libc++.so > # ls -l /usr/bin/g[c+][c+] > lrwxr-xr-x 1 root wheel 48 Dec 5 05:38 /usr/bin/g++ -> = /usr/local/bin/powerpc64-portbld-freebsd11.0-g++ > lrwxr-xr-x 1 root wheel 48 Dec 5 05:38 /usr/bin/gcc -> = /usr/local/bin/powerpc64-portbld-freebsd11.0-gcc These symbolic links deal with some environment-forced/automatic = references to what would otherwise be to missing files. =3D=3D=3D Mark Millard markmi at dsl-only.net From owner-freebsd-toolchain@freebsd.org Tue Dec 15 07:06:56 2015 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F41A8A479AB for ; Tue, 15 Dec 2015 07:06:55 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-211-152.reflexion.net [208.70.211.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5163174E for ; Tue, 15 Dec 2015 07:06:54 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 26992 invoked from network); 15 Dec 2015 07:06:57 -0000 Received: from unknown (HELO mail-cs-01.app.dca.reflexion.local) (10.81.19.1) by 0 (rfx-qmail) with SMTP; 15 Dec 2015 07:06:57 -0000 Received: by mail-cs-01.app.dca.reflexion.local (Reflexion email security v7.80.0) with SMTP; Tue, 15 Dec 2015 02:06:57 -0500 (EST) Received: (qmail 18451 invoked from network); 15 Dec 2015 07:06:56 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with SMTP; 15 Dec 2015 07:06:56 -0000 X-No-Relay: not in my network X-No-Relay: not in my network Received: from [192.168.1.8] (c-76-115-7-162.hsd1.or.comcast.net [76.115.7.162]) by iron2.pdx.net (Postfix) with ESMTPSA id E3A6C1C43AE; Mon, 14 Dec 2015 23:06:45 -0800 (PST) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: powerpc64 11.0-CURRENT's clang binds -m32 -mcpu=powerpc a.out to /libexec/ld-elf.so.1 Message-Id: <894D2513-6DE7-4E31-87A5-0529ECDF336C@dsl-only.net> Date: Mon, 14 Dec 2015 23:06:51 -0800 To: FreeBSD PowerPC ML , FreeBSD Toolchain Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) X-Mailer: Apple Mail (2.2104) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Dec 2015 07:06:56 -0000 # 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=3Dpowerpc 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=3Dpowerpc 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 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/GENERIC64v= tsc-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 . . . =3D=3D=3D Mark Millard markmi at dsl-only.net From owner-freebsd-toolchain@freebsd.org Tue Dec 15 10:15:59 2015 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 547B7A44A6E; Tue, 15 Dec 2015 10:15:59 +0000 (UTC) (envelope-from rdivacky@vlakno.cz) Received: from vlakno.cz (mail.vlakno.cz [91.217.96.224]) by mx1.freebsd.org (Postfix) with ESMTP id 1EDFE1CAD; Tue, 15 Dec 2015 10:15:58 +0000 (UTC) (envelope-from rdivacky@vlakno.cz) Received: by vlakno.cz (Postfix, from userid 1002) id 3565E1E2245C; Tue, 15 Dec 2015 11:13:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=vlakno.cz; s=mail; t=1450174424; bh=tIBI6xa+PcBog6Ak1Rv0U//gwyHPavMAzn20mP2LFWs=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=kZi7lur8+knMDIVajouokm/bxvPp1TwrJDQYws1VyeoSgjRlI/ZFP60IcYHbtFj23 GyjfwniEIoSVHQi7/ESONiebH5oz8YBCW91svc35QxytDzjdqBi1oCLa5I7GDwwIiJ JVA5x6C4Sd5JPG4ujrHC+uhvSRNxjTATy1gY/1bg= Date: Tue, 15 Dec 2015 11:13:44 +0100 From: Roman Divacky To: Mark Millard Cc: FreeBSD PowerPC ML , FreeBSD Toolchain Subject: Re: powerpc64 11.0-CURRENT's clang binds -m32 -mcpu=powerpc a.out to /libexec/ld-elf.so.1 Message-ID: <20151215101344.GA28748@vlakno.cz> References: <894D2513-6DE7-4E31-87A5-0529ECDF336C@dsl-only.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <894D2513-6DE7-4E31-87A5-0529ECDF336C@dsl-only.net> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Dec 2015 10:15:59 -0000 Check the code in tools/clang/lib/Driver/Tools.cpp. That specifies the /libexec/ld-elf.so.1. 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 > > > 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 > > _______________________________________________ > freebsd-toolchain@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain > To unsubscribe, send any mail to "freebsd-toolchain-unsubscribe@freebsd.org" From owner-freebsd-toolchain@freebsd.org Tue Dec 15 12:36:51 2015 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38E75A448E7; Tue, 15 Dec 2015 12:36:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D83481F08; Tue, 15 Dec 2015 12:36:50 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id tBFCaef7016947 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 15 Dec 2015 14:36:40 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua tBFCaef7016947 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id tBFCaefc016946; Tue, 15 Dec 2015 14:36:40 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 15 Dec 2015 14:36:40 +0200 From: Konstantin Belousov To: Mark Millard Cc: FreeBSD PowerPC ML , FreeBSD Toolchain Subject: Re: powerpc64 11.0-CURRENT's clang binds -m32 -mcpu=powerpc a.out to /libexec/ld-elf.so.1 Message-ID: <20151215123640.GG3625@kib.kiev.ua> References: <894D2513-6DE7-4E31-87A5-0529ECDF336C@dsl-only.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <894D2513-6DE7-4E31-87A5-0529ECDF336C@dsl-only.net> User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Dec 2015 12:36:51 -0000 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 > > _______________________________________________ > freebsd-toolchain@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain > To unsubscribe, send any mail to "freebsd-toolchain-unsubscribe@freebsd.org" From owner-freebsd-toolchain@freebsd.org Tue Dec 15 18:15:04 2015 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3ABDA43D72 for ; Tue, 15 Dec 2015 18:15:04 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-211-152.reflexion.net [208.70.211.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 86F69196F for ; Tue, 15 Dec 2015 18:15:04 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 16996 invoked from network); 15 Dec 2015 18:15:07 -0000 Received: from unknown (HELO rtc-sm-01.app.dca.reflexion.local) (10.81.150.1) by 0 (rfx-qmail) with SMTP; 15 Dec 2015 18:15:07 -0000 Received: by rtc-sm-01.app.dca.reflexion.local (Reflexion email security v7.80.0) with SMTP; Tue, 15 Dec 2015 13:15:04 -0500 (EST) Received: (qmail 25644 invoked from network); 15 Dec 2015 18:15:03 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with SMTP; 15 Dec 2015 18:15:03 -0000 X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network Received: from [192.168.1.8] (c-76-115-7-162.hsd1.or.comcast.net [76.115.7.162]) by iron2.pdx.net (Postfix) with ESMTPSA id 344D11C43AE; Tue, 15 Dec 2015 10:14:59 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: powerpc64 11.0-CURRENT's clang binds -m32 -mcpu=powerpc a.out to /libexec/ld-elf.so.1 From: Mark Millard In-Reply-To: <20151215123640.GG3625@kib.kiev.ua> Date: Tue, 15 Dec 2015 10:15:01 -0800 Cc: Konstantin Belousov , Roman Divacky Content-Transfer-Encoding: quoted-printable Message-Id: <0FA30C32-6F18-43CC-A2F7-3E424FF59021@dsl-only.net> References: <894D2513-6DE7-4E31-87A5-0529ECDF336C@dsl-only.net> <20151215123640.GG3625@kib.kiev.ua> To: FreeBSD PowerPC ML , FreeBSD Toolchain X-Mailer: Apple Mail (2.2104) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Dec 2015 18:15:04 -0000 On 2015-Dec-15, at 4:36 AM, Konstantin Belousov = 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: >>=20 >> # 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 >>=20 >> # 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. >>=20 >> # gcc -m32 -mcpu=3Dpowerpc 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 >=20 > 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/r= s6000/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/freebsd6= 4.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. =3D=3D=3D Mark Millard markmi at dsl-only.net On 2015-Dec-15, at 4:36 AM, Konstantin Belousov = wrote: On Mon, Dec 14, 2015 at 11:06:51PM -0800, Mark Millard wrote: > # more main.c > int main() > { > return 0; > } >=20 >=20 >=20 > # ls -l `which cc` > -r-xr-xr-x 7 root wheel 54137976 Dec 14 00:06 /usr/bin/cc >=20 > # cc --version > FreeBSD clang version 3.7.0 (tags/RELEASE_370/final 246257) 20150906 > Target: powerpc64-unknown-freebsd11.0 > Thread model: posix >=20 > # cc -m32 -mcpu=3Dpowerpc 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 >=20 >=20 >=20 > By contrast powerpc64-gcc binds the a.out produced to = /libexec/ld-elf32.so.1 instead: >=20 > # 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 >=20 > # 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. >=20 > # gcc -m32 -mcpu=3Dpowerpc 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 >=20 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. >=20 > Context details: >=20 > # 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/GENERIC64v= tsc-NODEBUG powerpc 1100091 1100091 >=20 > # 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 > . . . >=20 > =3D=3D=3D > Mark Millard > markmi at dsl-only.net >=20 > _______________________________________________ > freebsd-toolchain@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain > To unsubscribe, send any mail to = "freebsd-toolchain-unsubscribe@freebsd.org" From owner-freebsd-toolchain@freebsd.org Tue Dec 15 18:37:36 2015 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5576A48D4E; Tue, 15 Dec 2015 18:37:36 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 8A0451778; Tue, 15 Dec 2015 18:37:36 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 82A2A1CF6; Tue, 15 Dec 2015 18:37:36 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 3BF10175CA; Tue, 15 Dec 2015 18:37:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id iNV_XT0bKSDH; Tue, 15 Dec 2015 18:37:33 +0000 (UTC) Subject: Re: 11.0-CURRENT SRC_ENV_CONF file vs. MAKEOBJDIRPREFIX in the file: they do not mix DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com D0CDB175C4 To: Mark Millard , "Simon J. Gerraty" References: <2426.1449521335@chaos> <56675638.5010904@FreeBSD.org> Cc: FreeBSD PowerPC ML , FreeBSD Toolchain , FreeBSD Current From: Bryan Drewery Organization: FreeBSD Message-ID: <56705DEB.2030004@FreeBSD.org> Date: Tue, 15 Dec 2015 10:37:31 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <56675638.5010904@FreeBSD.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Dec 2015 18:37:36 -0000 On 12/8/15 2:14 PM, Bryan Drewery wrote: > On 12/7/15 1:33 PM, Mark Millard wrote: >> >>> On 2015-Dec-7, at 12:48 PM, Simon J. Gerraty wrote: >>> >>> Mark Millard wrote: >>>> My guess is that it is picking up the >>>> >>>> MAKEOBJDIRPREFIX=/usr/obj/xtoolchain >>> >>> You should use ?= if you want this to work. >>> There are many places in Makefile.inc1 where MAKEOBJDIRPREFIX is tweaked >>> in the environment of a sub-make. >>> >>> By using = above, you break that. >> >> That presumes that MAKEOBJDIRPREFIX has not been assigned a default value before the SRC_ENV_CONF file has been included the first time. If MAKEOBJDIRPREFIX had been defined already then the ?= would do nothing and the wrong value would be used. >> >> I believe that the following trace shows that such an assignment of a default value does happen first, making ?= not work either. >> >> >> >> /usr/src/Makefile (head/Makefile 29160) has >> >>> MAKEOBJDIRPREFIX?= /usr/obj >> >> at line 145 (used when it is not using targets/Makefile from the relevant .if/.else/.endif). >> >> Line 105 has .include and there no others before the above assignment. bsd.compiler.mk in turn includes bsd.opt.mk (only), which in turns includes bsd.mkopt.mk (only). That in turn includes nothing else. So these files and only these files are the involved files before that assignment as far as I can tell. >> >> None of these get to src.sys.env.mk and so SRC_ENV_CONF use has not happened yet when >> >>> MAKEOBJDIRPREFIX?= /usr/obj >> >> is executed. >> >> So, if I understand right, MAKEOBJDIRPREFIX is already defined before the code >> >>> SRC_ENV_CONF?= /etc/src-env.conf >>> .if !empty(SRC_ENV_CONF) && !target(_src_env_conf_included_) >>> .-include "${SRC_ENV_CONF}" >>> _src_env_conf_included_: .NOTMAIN >>> .endif >> >> is executed and so using ?= would not be effective in the included file. >> >> Did I miss something? > > > Yes. sys.mk and src-env.conf are included *before* Makefile. Think of it > as being in line 0. > > Technically you should be able to use MAKEOBJDIRPREFIX in make.conf or > src.conf if you are not using any of the meta mode features (all off by > default). > Clarification: We *could* support this but it does not work today. We can use .OBJDIR to force using a MAKEOBJDIRPREFIX from make.conf but only if we also force creating the directory as well. Getting this all right just ends up falling into the new auto.obj.mk territory anyhow. I do want to expand that to the default build, which would allow setting MAKEOBJDIRPREFIX in src-env.conf. -- Regards, Bryan Drewery From owner-freebsd-toolchain@freebsd.org Tue Dec 15 18:48:22 2015 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4962A48636 for ; Tue, 15 Dec 2015 18:48:22 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-211-151.reflexion.net [208.70.211.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9866E14C3 for ; Tue, 15 Dec 2015 18:48:22 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 14950 invoked from network); 15 Dec 2015 18:48:21 -0000 Received: from unknown (HELO mail-cs-02.app.dca.reflexion.local) (10.81.19.2) by 0 (rfx-qmail) with SMTP; 15 Dec 2015 18:48:21 -0000 Received: by mail-cs-02.app.dca.reflexion.local (Reflexion email security v7.80.0) with SMTP; Tue, 15 Dec 2015 13:48:20 -0500 (EST) Received: (qmail 9098 invoked from network); 15 Dec 2015 18:48:20 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with SMTP; 15 Dec 2015 18:48:20 -0000 X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network Received: from [192.168.1.8] (c-76-115-7-162.hsd1.or.comcast.net [76.115.7.162]) by iron2.pdx.net (Postfix) with ESMTPSA id 623DF1C43BC; Tue, 15 Dec 2015 10:48:17 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: powerpc64: powerpc64-gcc, gcc49, gcc5 bind -m32 -mcpu=powerpc a.out to /libexec/ld-elf32.so.1 instead of /libexec/ld-elf.so.1 From: Mark Millard Date: Tue, 15 Dec 2015 10:48:20 -0800 Cc: FreeBSD PowerPC ML , FreeBSD Toolchain Content-Transfer-Encoding: quoted-printable Message-Id: <436094AA-A35B-4586-8B88-38B8E31A009E@dsl-only.net> References: <0FA30C32-6F18-43CC-A2F7-3E424FF59021@dsl-only.net> To: freebsd-ports@freebsd.org X-Mailer: Apple Mail (2.2104) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Dec 2015 18:48:22 -0000 [This is mostly a re-titling of an earlier freebsd-pcc/freebsd-toolchain = message to correctly identify the problem. I also added the = freebsd-ports list and some content.] On 2015-Dec-15, at 4:36 AM, Konstantin Belousov = wrote: > On Mon, Dec 14, 2015 at 11:06:51PM -0800, Mark Millard wrote: >=20 > # more main.c > int main() > { > return 0; > } >=20 > . . . >> By contrast powerpc64-gcc binds the a.out produced to = /libexec/ld-elf32.so.1 instead: >>=20 >> # 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 >>=20 >> # 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. >>=20 >> # gcc -m32 -mcpu=3Dpowerpc 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 >=20 > 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=3Dpowerpc 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/r= s6000/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/freebsd6= 4.h #define FREEBSD_DYNAMIC_LINKER32 "/libexec/ld-elf32.so.1" #define FREEBSD_DYNAMIC_LINKER64 "/libexec/ld-elf.so.1" Since powerpc64-gcc is a variant build of gcc5 and also has the above = sort of freebsd64.h content, lang/gcc5 likely has the problem too. (By contrast the powerpc64 system clang (3.7) binds its -m32 = -mcpu-powerpc a.out output file to /libexec/ld-elf.so.1 .) Just for reference, my new patch-gcc-freebsd-powerpc64 variant looks = like the following (tabs likely not preserved): # svnlite diff /usr/ports/devel/powerpc64-gcc Index: /usr/ports/devel/powerpc64-gcc/files/patch-gcc-freebsd-powerpc64 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- /usr/ports/devel/powerpc64-gcc/files/patch-gcc-freebsd-powerpc64 = (revision 403711) +++ /usr/ports/devel/powerpc64-gcc/files/patch-gcc-freebsd-powerpc64 = (working copy) @@ -1,5 +1,5 @@ ---- gcc/config/rs6000/freebsd64.h 2015-11-28 09:06:13.019999000 = -0800 -+++ gcc/config/rs6000/freebsd64.h 2015-11-28 09:16:10.459373000 = -0800 +--- freebsd64.h.orig 2015-01-05 04:33:28.000000000 -0800 ++++ freebsd64.h 2015-12-15 09:52:34.634200000 -0800 @@ -65,6 +65,13 @@ #define INVALID_64BIT "-m%s not supported in this configuration" #define INVALID_32BIT INVALID_64BIT @@ -27,3 +27,21 @@ if (rs6000_isa_flags & OPTION_MASK_EABI) \ { \ rs6000_isa_flags &=3D ~OPTION_MASK_EABI; \ +@@ -154,7 +167,7 @@ + { "link_os_freebsd_spec32", LINK_OS_FREEBSD_SPEC32 }, = \ + { "link_os_freebsd_spec64", LINK_OS_FREEBSD_SPEC64 }, +=20 +-#define FREEBSD_DYNAMIC_LINKER32 "/libexec/ld-elf32.so.1" ++#define FREEBSD_DYNAMIC_LINKER32 "/libexec/ld-elf.so.1" + #define FREEBSD_DYNAMIC_LINKER64 "/libexec/ld-elf.so.1" +=20 + #define LINK_OS_FREEBSD_SPEC_DEF32 "\ +@@ -304,7 +317,7 @@ +=20 + /* rs6000.h gets this wrong for FreeBSD. We use the GCC defaults = instead. */ + #undef WCHAR_TYPE +-#define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int") ++#define WCHAR_TYPE "int" + #undef WCHAR_TYPE_SIZE + #define WCHAR_TYPE_SIZE 32 +=20 The same sort of changes should apply to gcc49 and gcc5. The WCHAR_TYPE change fixes the powerpc (non-64) base type used for = notations like L". . ." to match FreeBSD's powerpc/powerpc64 context. = Otherwise lib32 in buildworld gets compile errors from the type = mismatches --and lots of extra warnings as well. =3D=3D=3D Mark Millard markmi at dsl-only.net On 2015-Dec-15, at 4:36 AM, Konstantin Belousov = wrote: On Mon, Dec 14, 2015 at 11:06:51PM -0800, Mark Millard wrote: > # more main.c > int main() > { > return 0; > } >=20 >=20 >=20 > # ls -l `which cc` > -r-xr-xr-x 7 root wheel 54137976 Dec 14 00:06 /usr/bin/cc >=20 > # cc --version > FreeBSD clang version 3.7.0 (tags/RELEASE_370/final 246257) 20150906 > Target: powerpc64-unknown-freebsd11.0 > Thread model: posix >=20 > # cc -m32 -mcpu=3Dpowerpc 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 >=20 >=20 >=20 > By contrast powerpc64-gcc binds the a.out produced to = /libexec/ld-elf32.so.1 instead: >=20 > # 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 >=20 > # 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. >=20 > # gcc -m32 -mcpu=3Dpowerpc 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 >=20 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. >=20 > Context details: >=20 > # 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/GENERIC64v= tsc-NODEBUG powerpc 1100091 1100091 >=20 > # 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 > . . . >=20 > =3D=3D=3D > Mark Millard > markmi at dsl-only.net >=20 > _______________________________________________ > freebsd-toolchain@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain > To unsubscribe, send any mail to = "freebsd-toolchain-unsubscribe@freebsd.org" From owner-freebsd-toolchain@freebsd.org Tue Dec 15 18:54:06 2015 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02B30A489A9 for ; Tue, 15 Dec 2015 18:54:06 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-211-152.reflexion.net [208.70.211.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B94931985 for ; Tue, 15 Dec 2015 18:54:05 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 32040 invoked from network); 15 Dec 2015 18:54:09 -0000 Received: from unknown (HELO mail-cs-02.app.dca.reflexion.local) (10.81.19.2) by 0 (rfx-qmail) with SMTP; 15 Dec 2015 18:54:09 -0000 Received: by mail-cs-02.app.dca.reflexion.local (Reflexion email security v7.80.0) with SMTP; Tue, 15 Dec 2015 13:54:03 -0500 (EST) Received: (qmail 3511 invoked from network); 15 Dec 2015 18:54:03 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with SMTP; 15 Dec 2015 18:54:03 -0000 X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network Received: from [192.168.1.8] (c-76-115-7-162.hsd1.or.comcast.net [76.115.7.162]) by iron2.pdx.net (Postfix) with ESMTPSA id 38B9B1C43BC; Tue, 15 Dec 2015 10:54:00 -0800 (PST) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: 11.0-CURRENT SRC_ENV_CONF file vs. MAKEOBJDIRPREFIX in the file: they do not mix From: Mark Millard In-Reply-To: <56705DEB.2030004@FreeBSD.org> Date: Tue, 15 Dec 2015 10:54:02 -0800 Cc: "Simon J. Gerraty" , FreeBSD PowerPC ML , FreeBSD Toolchain , FreeBSD Current Content-Transfer-Encoding: quoted-printable Message-Id: <1F2AC0BD-8963-46BA-9C1B-EB5F48CDA204@dsl-only.net> References: <2426.1449521335@chaos> <56675638.5010904@FreeBSD.org> <56705DEB.2030004@FreeBSD.org> To: Bryan Drewery X-Mailer: Apple Mail (2.2104) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Dec 2015 18:54:06 -0000 On 2015-Dec-15, at 10:37 AM, Bryan Drewery wrote: >=20 > On 12/8/15 2:14 PM, Bryan Drewery wrote: >> On 12/7/15 1:33 PM, Mark Millard wrote: >>>=20 >>>> On 2015-Dec-7, at 12:48 PM, Simon J. Gerraty = wrote: >>>>=20 >>>> Mark Millard wrote: >>>>> My guess is that it is picking up the >>>>>=20 >>>>> MAKEOBJDIRPREFIX=3D/usr/obj/xtoolchain >>>>=20 >>>> You should use ?=3D if you want this to work. >>>> There are many places in Makefile.inc1 where MAKEOBJDIRPREFIX is = tweaked >>>> in the environment of a sub-make. >>>>=20 >>>> By using =3D above, you break that. >>>=20 >>> That presumes that MAKEOBJDIRPREFIX has not been assigned a default = value before the SRC_ENV_CONF file has been included the first time. If = MAKEOBJDIRPREFIX had been defined already then the ?=3D would do nothing = and the wrong value would be used. >>>=20 >>> I believe that the following trace shows that such an assignment of = a default value does happen first, making ?=3D not work either. >>>=20 >>>=20 >>>=20 >>> /usr/src/Makefile (head/Makefile 29160) has >>>=20 >>>> MAKEOBJDIRPREFIX?=3D /usr/obj >>>=20 >>> at line 145 (used when it is not using targets/Makefile from the = relevant .if/.else/.endif). >>>=20 >>> Line 105 has .include and there no others before = the above assignment. bsd.compiler.mk in turn includes bsd.opt.mk = (only), which in turns includes bsd.mkopt.mk (only). That in turn = includes nothing else. So these files and only these files are the = involved files before that assignment as far as I can tell. >>>=20 >>> None of these get to src.sys.env.mk and so SRC_ENV_CONF use has not = happened yet when=20 >>>=20 >>>> MAKEOBJDIRPREFIX?=3D /usr/obj >>>=20 >>> is executed. >>>=20 >>> So, if I understand right, MAKEOBJDIRPREFIX is already defined = before the code >>>=20 >>>> SRC_ENV_CONF?=3D /etc/src-env.conf >>>> .if !empty(SRC_ENV_CONF) && !target(_src_env_conf_included_) >>>> .-include "${SRC_ENV_CONF}" >>>> _src_env_conf_included_: .NOTMAIN >>>> .endif >>>=20 >>> is executed and so using ?=3D would not be effective in the included = file. >>>=20 >>> Did I miss something? >>=20 >>=20 >> Yes. sys.mk and src-env.conf are included *before* Makefile. Think of = it >> as being in line 0. >>=20 >> Technically you should be able to use MAKEOBJDIRPREFIX in make.conf = or >> src.conf if you are not using any of the meta mode features (all off = by >> default). >>=20 >=20 > Clarification: We *could* support this but it does not work today. We > can use .OBJDIR to force using a MAKEOBJDIRPREFIX from make.conf but > only if we also force creating the directory as well. Getting this all > right just ends up falling into the new auto.obj.mk territory anyhow. = I > do want to expand that to the default build, which would allow setting > MAKEOBJDIRPREFIX in src-env.conf. So may be the paragraph below from "man src.conf" should not (yet?) = suggest that MAKEOBJDIRPREFIX is valid in a file to be referenced by = SRC_ENV_CONF: > The environment of make(1) for the build can be controlled via the > SRC_ENV_CONF variable, which defaults to /etc/src-env.conf. Some > examples that may only be set in this file are MAKEOBJDIRPREFIX, > WITH_DIRDEPS_BUILD, and WITH_META_MODE as they are = environment-only > variables. =3D=3D=3D Mark Millard markmi at dsl-only.net From owner-freebsd-toolchain@freebsd.org Tue Dec 15 18:54:54 2015 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DAF51A48A9F; Tue, 15 Dec 2015 18:54:53 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id BE6971AFE; Tue, 15 Dec 2015 18:54:53 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id B24E01686; Tue, 15 Dec 2015 18:54:53 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 74E7B176C8; Tue, 15 Dec 2015 18:54:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id Ds6kXu0iQB13; Tue, 15 Dec 2015 18:54:50 +0000 (UTC) Subject: Re: 11.0-CURRENT SRC_ENV_CONF file vs. MAKEOBJDIRPREFIX in the file: they do not mix DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 79D54176BE To: Mark Millard References: <2426.1449521335@chaos> <56675638.5010904@FreeBSD.org> <56705DEB.2030004@FreeBSD.org> <1F2AC0BD-8963-46BA-9C1B-EB5F48CDA204@dsl-only.net> Cc: "Simon J. Gerraty" , FreeBSD PowerPC ML , FreeBSD Toolchain , FreeBSD Current From: Bryan Drewery Organization: FreeBSD Message-ID: <567061F8.4040508@FreeBSD.org> Date: Tue, 15 Dec 2015 10:54:48 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <1F2AC0BD-8963-46BA-9C1B-EB5F48CDA204@dsl-only.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Dec 2015 18:54:54 -0000 On 12/15/15 10:54 AM, Mark Millard wrote: > On 2015-Dec-15, at 10:37 AM, Bryan Drewery wrote: >> >> On 12/8/15 2:14 PM, Bryan Drewery wrote: >>> On 12/7/15 1:33 PM, Mark Millard wrote: >>>> >>>>> On 2015-Dec-7, at 12:48 PM, Simon J. Gerraty wrote: >>>>> >>>>> Mark Millard wrote: >>>>>> My guess is that it is picking up the >>>>>> >>>>>> MAKEOBJDIRPREFIX=/usr/obj/xtoolchain >>>>> >>>>> You should use ?= if you want this to work. >>>>> There are many places in Makefile.inc1 where MAKEOBJDIRPREFIX is tweaked >>>>> in the environment of a sub-make. >>>>> >>>>> By using = above, you break that. >>>> >>>> That presumes that MAKEOBJDIRPREFIX has not been assigned a default value before the SRC_ENV_CONF file has been included the first time. If MAKEOBJDIRPREFIX had been defined already then the ?= would do nothing and the wrong value would be used. >>>> >>>> I believe that the following trace shows that such an assignment of a default value does happen first, making ?= not work either. >>>> >>>> >>>> >>>> /usr/src/Makefile (head/Makefile 29160) has >>>> >>>>> MAKEOBJDIRPREFIX?= /usr/obj >>>> >>>> at line 145 (used when it is not using targets/Makefile from the relevant .if/.else/.endif). >>>> >>>> Line 105 has .include and there no others before the above assignment. bsd.compiler.mk in turn includes bsd.opt.mk (only), which in turns includes bsd.mkopt.mk (only). That in turn includes nothing else. So these files and only these files are the involved files before that assignment as far as I can tell. >>>> >>>> None of these get to src.sys.env.mk and so SRC_ENV_CONF use has not happened yet when >>>> >>>>> MAKEOBJDIRPREFIX?= /usr/obj >>>> >>>> is executed. >>>> >>>> So, if I understand right, MAKEOBJDIRPREFIX is already defined before the code >>>> >>>>> SRC_ENV_CONF?= /etc/src-env.conf >>>>> .if !empty(SRC_ENV_CONF) && !target(_src_env_conf_included_) >>>>> .-include "${SRC_ENV_CONF}" >>>>> _src_env_conf_included_: .NOTMAIN >>>>> .endif >>>> >>>> is executed and so using ?= would not be effective in the included file. >>>> >>>> Did I miss something? >>> >>> >>> Yes. sys.mk and src-env.conf are included *before* Makefile. Think of it >>> as being in line 0. >>> >>> Technically you should be able to use MAKEOBJDIRPREFIX in make.conf or >>> src.conf if you are not using any of the meta mode features (all off by >>> default). >>> >> >> Clarification: We *could* support this but it does not work today. We >> can use .OBJDIR to force using a MAKEOBJDIRPREFIX from make.conf but >> only if we also force creating the directory as well. Getting this all >> right just ends up falling into the new auto.obj.mk territory anyhow. I >> do want to expand that to the default build, which would allow setting >> MAKEOBJDIRPREFIX in src-env.conf. > > > So may be the paragraph below from "man src.conf" should not (yet?) suggest that MAKEOBJDIRPREFIX is valid in a file to be referenced by SRC_ENV_CONF: > >> The environment of make(1) for the build can be controlled via the >> SRC_ENV_CONF variable, which defaults to /etc/src-env.conf. Some >> examples that may only be set in this file are MAKEOBJDIRPREFIX, >> WITH_DIRDEPS_BUILD, and WITH_META_MODE as they are environment-only >> variables. > > Yes, I fixed it after my mail. -- Regards, Bryan Drewery From owner-freebsd-toolchain@freebsd.org Wed Dec 16 21:21:44 2015 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D433EA4ABBD; Wed, 16 Dec 2015 21:21:44 +0000 (UTC) (envelope-from andreast-list@fgznet.ch) Received: from smtp.fgznet.ch (unknown [IPv6:2001:4060:1:1001::14:53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B0531382; Wed, 16 Dec 2015 21:21:44 +0000 (UTC) (envelope-from andreast-list@fgznet.ch) Received: from [192.168.225.14] (dhclient-91-190-14-19.flashcable.ch [91.190.14.19]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by fgznet.ch (Postfix) with ESMTPS id 0AE14E6068; Wed, 16 Dec 2015 22:21:33 +0100 (CET) Subject: Re: powerpc64 11.0-CURRENT's clang binds -m32 -mcpu=powerpc a.out to /libexec/ld-elf.so.1 To: Konstantin Belousov , Mark Millard References: <894D2513-6DE7-4E31-87A5-0529ECDF336C@dsl-only.net> <20151215123640.GG3625@kib.kiev.ua> Cc: FreeBSD Toolchain , FreeBSD PowerPC ML From: Andreas Tobler Message-ID: <5671D5DD.9090808@fgznet.ch> Date: Wed, 16 Dec 2015 22:21:33 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20151215123640.GG3625@kib.kiev.ua> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.73 on 127.0.1.1 X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Dec 2015 21:21:44 -0000 On 15.12.15 13:36, Konstantin Belousov 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. This is mine. Taken. Andreas