From owner-freebsd-ports-bugs@freebsd.org Mon Jan 11 03:25:08 2016 Return-Path: Delivered-To: freebsd-ports-bugs@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 B221CA6ABEB for ; Mon, 11 Jan 2016 03:25:08 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (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 8F00D1595 for ; Mon, 11 Jan 2016 03:25:08 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u0B3P8ZD034746 for ; Mon, 11 Jan 2016 03:25:08 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-ports-bugs@FreeBSD.org Subject: [Bug 206123] devel/powerpc64-gcc (as of -r405762 and before): powerpc64 lib32 use fails because of crtbeginS.o powerpc64-gcc produces Date: Mon, 11 Jan 2016 03:25:08 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: markmi@dsl-only.net X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bapt@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter flagtypes.name Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jan 2016 03:25:08 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D206123 Bug ID: 206123 Summary: devel/powerpc64-gcc (as of -r405762 and before): powerpc64 lib32 use fails because of crtbeginS.o powerpc64-gcc produces Product: Ports & Packages Version: Latest Hardware: ppc OS: Any Status: New Severity: Affects Only Me Priority: --- Component: Individual Port(s) Assignee: bapt@FreeBSD.org Reporter: markmi@dsl-only.net Assignee: bapt@FreeBSD.org Flags: maintainer-feedback?(bapt@FreeBSD.org) powerpc64 context: devel/powerpc64-gcc used for buildworld produces a -m32 -mcpu=3Dpowerpc crtbeginS.o (WITH_LIB32=3D for powerpc64 or for TARGET_ARCH=3Dpowerpc) that is not suitable. This leads to _init in /usr/lib32/libc.so.7 crashing, preventing lib32's use. (If I avoid use of lib32 I can use powerpc64-gcc to build and install kernel and world, including WITH_BOOT=3D . WITH_LIB32=3D does build and install --= it just does not work.) The lib32/crtbeginS.o ends up with .init code that looks like: # /usr/local/powerpc64-freebsd/bin/objdump -d /usr/lib32/crtbeginS.o | tail= -20 178: 7d 61 5b 78 mr r1,r11 17c: 4e 80 00 20 blr Disassembly of section .fini: 00000000 <.fini>: 0: 48 00 00 01 bl 0 <.fini> Disassembly of section .init: 00000000 <.init>: 0: 80 7e 00 00 lwz r3,0(r30) 4: 81 23 00 00 lwz r9,0(r3) 8: 2f 89 00 00 cmpwi cr7,r9,0 c: 41 9e 00 18 beq cr7,24 <__do_global_dtors_aux+0x24> 10: 81 3e 00 00 lwz r9,0(r30) 14: 2f 89 00 00 cmpwi cr7,r9,0 18: 41 9e 00 0c beq cr7,24 <__do_global_dtors_aux+0x24> 1c: 7d 29 03 a6 mtctr r9 20: 4e 80 04 21 bctrl which depends on r30's preexisting value (and the offset ends up adjusted f= rom zero when put to use in /usr/lib32/libc.so.7). For comparison/contrast: From a buildworld that uses gcc4.2.1's toolchain (src.conf empty): # /usr/local/powerpc64-freebsd/bin/objdump -d /usr/obj/lib32/usr/src/gnu/lib/csu/crtbeginS.o | tail Disassembly of section .fini: 00000000 <.fini>: 0: 48 00 00 01 bl 0 <.fini> Disassembly of section .init: 00000000 <.init>: 0: 48 00 00 01 bl 0 <.init> Back to how the powerpc64-gcc's produced crtbeginS.o behaves in use: For compiling with -m32 via powerpc64-gcc lib32/libc.so.7 dies in its _init: # more main.c int main(void) { return 0; } # /usr/local/bin/powerpc64-portbld-freebsd11.0-gcc --version powerpc64-portbld-freebsd11.0-gcc (FreeBSD Ports Collection for powerpc64) 5.2.0 . . . # /usr/local/bin/powerpc64-portbld-freebsd11.0-gcc -m32 -mcpu=3Dpowerpc mai= n.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 (1100093), not stripped # /usr/local/bin/gdb a.out GNU gdb (GDB) 7.10 [GDB v7.10 for FreeBSD] . . . Reading symbols from a.out...(no debugging symbols found)...done. (gdb) run Starting program: /root/c_tests/a.out=20 warning: `/libexec/ld-elf.so.1': Shared library architecture powerpc:common= 64 is not compatible with target architecture powerpc:common. warning: `/libexec/ld-elf.so.1': Shared library architecture powerpc:common= 64 is not compatible with target architecture powerpc:common. Program received signal SIGSEGV, Segmentation fault. 0x41867ebc in _init () from /usr/lib32/libc.so.7 (gdb) x/20i 0x41867ea0 0x41867ea0: .long 0xc3b15 0x41867ea4: .long 0x0 0x41867ea8 <_init>: stwu r1,-16(r1) 0x41867eac <_init+4>: mflr r0 0x41867eb0 <_init+8>: stw r31,12(r1) 0x41867eb4 <_init+12>: stw r0,20(r1) 0x41867eb8 <_init+16>: mr r31,r1 =3D> 0x41867ebc <_init+20>: lwz r3,-11432(r30) 0x41867ec0 <_init+24>: lwz r9,0(r3) 0x41867ec4 <_init+28>: cmpwi cr7,r9,0 0x41867ec8 <_init+32>: beq cr7,0x41867ee0 <_init+56> 0x41867ecc <_init+36>: lwz r9,-856(r30) 0x41867ed0 <_init+40>: cmpwi cr7,r9,0 0x41867ed4 <_init+44>: beq cr7,0x41867ee0 <_init+56> 0x41867ed8 <_init+48>: mtctr r9 0x41867edc <_init+52>: bctrl 0x41867ee0 <_init+56>: lwz r29,-1140(r30) 0x41867ee4 <_init+60>: lwzu r9,-4(r29) 0x41867ee8 <_init+64>: cmpwi cr7,r9,-1 0x41867eec <_init+68>: beq cr7,0x41867f04 <_init+92> (gdb) info registers . . . r30 0x4183bb8c 1099152268 r31 0xffffd730 4294956848 pc 0x41867ebc 0x41867ebc <_init+20> msr cr 0x28000482 671089794 lr 0x41814d9c 0x41814d9c . . . (gdb) x/150i objlist_call_init 0x41814c74 : stwu r1,-64(r1) 0x41814c78 : mflr r0 0x41814c7c : bl 0x4183bb88 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 0x41814d9c : lwz r10,4(r28) 0x41814da0 : lwz r29,268(r10) . . . (gdb) info registers . . . r30 0x4183bb8c 1099152268 . . . (gdb) x/20i 0x4183bb8c - 0x10 0x4183bb7c: bso 0x4183778c 0x4183bb80: bso 0x41837788 0x4183bb84: bso 0x4183773c 0x4183bb88: blrl 0x4183bb8c <_SDA_BASE_>: .long 0x2b428 0x4183bb90 <_SDA_BASE_+4>: .long 0x0 0x4183bb94 <_SDA_BASE_+8>: .long 0x0 0x4183bb98 <_thread_autoinit_dummy_decl>: .long 0x1 0x4183bb9c : beq 0x41835b80 0x4183bba0 : beq 0x41835b8c 0x4183bba4 : beq 0x41835ba4 0x4183bba8 : beq 0x41835bc0 0x4183bbac : beq 0x41835bd8 0x4183bbb0 : .long 0x2 0x4183bbb4 : .long 0x2 0x4183bbb8 : bso 0x4183822c 0x4183bbbc : bso 0x41838228 0x4183bbc0 : bso 0x41838224 0x4183bbc4 : .long 0x4 0x4183bbc8 : beq 0x41838be8 (gdb) x/i 0x4183bb8c - 11432 0x41838ee4: Cannot access memory at address 0x41838ee4 So the "lwz r3,-11432(r30)" ends up referencing <_SDA_BASE_-11432>, which is not accessible. So far I have not managed to track down why the r30 based .init code shows = up --or even what call standard(s) use r30 in a way that would appear to match. But the code's behavior seems to be just wrong for the FreeBSD powerpc cont= ext. --=20 You are receiving this mail because: You are the assignee for the bug.=