The following reply was made to PR pkg/41125; it has been noted by GNATS.
From: Tim Zingelman <zingelman%fnal.gov@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: pkg/41125 (pkgsrc's bsd.lib.mk doesn't work on Solaris)
Date: Mon, 6 Apr 2009 21:12:22 -0500
Thanks for the additional info.
I agree that there is a bug here to be fixed, indeed the solaris
pkgsrc bootstrap would hit the bug except for the MKPROFILE=no in
pkgsrc/net/libfetch/files/Makefile. I just want to be sure it gets
fixed correctly.
Looking at Simon Gerraty's code... in particular at "$Id: lib.mk,v
1.30 2007/11/24 22:12:58 sjg Exp $" it appears that setting an empty
LD_X has the side effect of skipping the use of LD entirely:
.if (${LD_X} == "")
.c.po:
${COMPILE.c} ${CC_PG} ${.IMPSRC} -o ${.TARGET}
.cc.po .C.po:
${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
.S.so .s.so:
${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC}
${.IMPSRC} -o ${.TARGET}
.else
...code that uses the LD_X variable...
This seems quite similar to the effect of setting COPTS=-g when using
bootstrap-mk-files bsd.lib.mk:
.c.po:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}
.else
... code that does the ${LD} -X ...
The more I look at that, the more I think the bsd.lib.mk code is more
correct in handling that... assuming -X is bad for debugging?
What is the practical difference in the results between doing:
gcc -O -Werror -c MyLib.c -o MyLib.o.o
ld -r MyLib.o.o -o MyLib.o
rm -f MyLib.o.o
and just doing:
gcc -O -Werror -c MyLib.c
and is the answer different using solaris /usr/ccs/bin/ld vs gnu ld?