Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: another build problem with MKPIE=yes on i386



On Sun, Apr 18, 2010 at 04:43:25PM +0200, Piotr Meyer wrote:

> /usr/obj/tooldir.NetBSD-5.99.25-i386/bin/../lib/gcc/i486--netbsdelf/4.1.3/../../../../i486--netbsdelf/bin/ld:
>  -r and -shared may not be used together

> *** Failed command: 
> /usr/src/obj/tooldir.NetBSD-5.99.25-i386/bin/i486--netbsdelf-gcc -Wl,-pie 
> -shared-libgcc -Wl,--fatal-warnings -nostdlib -r -Wl,-dc -o cat.ro cat.o

Look like problem was introduced in share/mk/bsd.prog.mk ver. 1.245,
by following change:

$ cvs rdiff -u -r1.244 -r1.245 src/share/mk/bsd.prog.mk

@@ -309,7 +309,7 @@
 
 ${_P}.ro: ${OBJS.${_P}} ${DPADD}
        ${_MKTARGET_LINK}
-       ${LD} -r -dc -o ${.TARGET} ${OBJS.${_P}}
+       ${CC} ${LDFLAGS} -nostdlib -Wl,-r,-dc -o ${.TARGET} ${OBJS.${_P}}
 
 .if defined(_PROGDEBUG.${_P})
 ${_PROGDEBUG.${_P}}: ${_P}


MKPIE=yes appends PIE_LDFLAGS to LDFLAGS gave us invalid sets in .ro target: 
'-Wl,-pie -shared-libgcc' + '-Wl,-r'... etc.

Changing above to:

--- bsd.prog.mk 2 Mar 2010 20:49:18 -0000       1.247
+++ bsd.prog.mk 18 Apr 2010 21:02:27 -0000
@@ -318,7 +318,7 @@
 
 ${_P}.ro: ${OBJS.${_P}} ${DPADD}
        ${_MKTARGET_LINK}
-       ${CC} ${LDFLAGS} -nostdlib -r -Wl,-dc -o ${.TARGET} ${OBJS.${_P}}
+       ${CC} ${LDFLAGS:S/${PIE_LDFLAGS}//gW} -nostdlib -r -Wl,-dc -o 
${.TARGET} ${OBJS.${_P}}
 
 .if defined(_PROGDEBUG.${_P})
 ${_PROGDEBUG.${_P}}: ${_P}


Gave me successful build, rescue works, but it's look "funny":


# file /usr/obj/rescue/rescue                                                   
                
/usr/obj/rescue/rescue: ELF 32-bit LSB shared object, Intel 80386, version 1 
(SYSV), dynamically linked (uses shared libs), for NetBSD 5.99.27, stripped

# ldd /usr/obj/rescue/rescue  
/usr/obj/rescue/rescue:
#


In comparision to rescue build without MKPIE:


# file /rescue/ping 
/rescue/ping: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), 
statically linked, for NetBSD 5.99.27, stripped
# ldd /rescue/ping 
ldd: /rescue/ping: not dynamically linked
#


Any suggestions?

-- 
Piotr 'aniou' Meyer


Home | Main Index | Thread Index | Old Index