The use of ld(1) to strip compiler local and non-global

symbols from object files has bitrotted over the last
thirteen years, and it now does more harm than good.

An attempt to work around the problems caused by using
ld(1) for stripping was to pass LDFLAGS to the ld(1)
command, but this was not right either as ${LDFLAGS}
should, by design, be used with cc(1) and not ld(1).

One of the proposed solutions was to use the objcopy(1)
utility to do the strip work, and the other would be to
use strip(1), but Bruce Evans suggested not stripping
any symbols at all.  This works by leaving the grunt
work to the final strip(1) command (when installing the
binary).

Submitted by:	bde
This commit is contained in:
Ruslan Ermilov 2003-06-30 19:03:56 +00:00
parent 107e6cda51
commit ea90b1f55d

View File

@ -56,97 +56,61 @@ PICFLAG=-fpic
.c.o:
${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
.c.po:
${CC} -pg ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -X -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
.c.So:
${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
.cc.o .C.o .cpp.o .cxx.o:
${CXX} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
.cc.po .C.po .cpp.po .cxx.po:
${CXX} -pg ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -X -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
.cc.So .C.So .cpp.So .cxx.So:
${CXX} ${PICFLAG} -DPIC ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
.f.o:
${FC} ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
.f.po:
${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -X -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
.f.So:
${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
.m.o:
${OBJC} ${OBJCFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
.m.po:
${OBJC} ${OBJCFLAGS} -pg -c ${.IMPSRC} -o ${.TARGET}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -X -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
.m.So:
${OBJC} ${PICFLAG} -DPIC ${OBJCFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
.s.o .asm.o:
${CC} -x assembler-with-cpp ${CFLAGS} ${AINC} -c \
${.IMPSRC} -o ${.TARGET}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
.s.po .asm.po:
${CC} -x assembler-with-cpp -DPROF ${CFLAGS} ${AINC} -c \
${.IMPSRC} -o ${.TARGET}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -X -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
.s.So .asm.So:
${CC} -x assembler-with-cpp ${PICFLAG} -DPIC ${CFLAGS} \
${AINC} -c ${.IMPSRC} -o ${.TARGET}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
.S.o:
${CC} ${CFLAGS} ${AINC} -c ${.IMPSRC} -o ${.TARGET}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
.S.po:
${CC} -DPROF ${CFLAGS} ${AINC} -c ${.IMPSRC} -o ${.TARGET}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -X -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
.S.So:
${CC} ${PICFLAG} -DPIC ${CFLAGS} ${AINC} -c ${.IMPSRC} \
-o ${.TARGET}
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
@mv ${.TARGET}.tmp ${.TARGET}
all: objwarn