Reviewed by: imp

LDFLAGS is supposed to be given to CC not LD.
Define _LDFLAGS as a filtered version of LDFLAGS safe to give to LD
This commit is contained in:
Simon J. Gerraty 2014-07-26 04:38:09 +00:00
parent 8926f21ce1
commit 5b6dc2efc9
6 changed files with 13 additions and 12 deletions

View File

@ -26,7 +26,7 @@ gcrt1_c.o: gcrt1_c.s
${CC} ${ACFLAGS} -c -o ${.TARGET} gcrt1_c.s
gcrt1.o: gcrt1_c.o crt1_s.o
${LD} ${LDFLAGS} -o gcrt1.o -r crt1_s.o gcrt1_c.o
${LD} ${_LDFLAGS} -o gcrt1.o -r crt1_s.o gcrt1_c.o
crt1_c.s: crt1_c.c
${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1_c.c
@ -36,7 +36,7 @@ crt1_c.o: crt1_c.s
${CC} ${ACFLAGS} -c -o ${.TARGET} crt1_c.s
crt1.o: crt1_c.o crt1_s.o
${LD} ${LDFLAGS} -o crt1.o -r crt1_s.o crt1_c.o
${LD} ${_LDFLAGS} -o crt1.o -r crt1_s.o crt1_c.o
objcopy --localize-symbol _start1 crt1.o
Scrt1_c.s: crt1_c.c
@ -47,7 +47,7 @@ Scrt1_c.o: Scrt1_c.s
${CC} ${ACFLAGS} -c -o ${.TARGET} Scrt1_c.s
Scrt1.o: Scrt1_c.o crt1_s.o
${LD} ${LDFLAGS} -o Scrt1.o -r crt1_s.o Scrt1_c.o
${LD} ${_LDFLAGS} -o Scrt1.o -r crt1_s.o Scrt1_c.o
objcopy --localize-symbol _start1 Scrt1.o
.include <bsd.prog.mk>

View File

@ -117,7 +117,8 @@ LEX ?= lex
LFLAGS ?=
LD ?= ld
LDFLAGS ?=
LDFLAGS ?= # LDFLAGS is for CC,
_LDFLAGS = ${LDFLAGS:S/-Wl,//g} # strip -Wl, for LD
LINT ?= lint
LINTFLAGS ?= -cghapbx

View File

@ -73,7 +73,7 @@ LDFLAGS= -nostdlib \
CFLAGS+= -I${.CURDIR}/../common
flashboot.elf: relocate.o start.o boot2.o altera_jtag_uart.o cfi.o sdcard.o
${LD} ${LDFLAGS} -T ${.CURDIR}/flashboot.ldscript -o ${.TARGET} \
${LD} ${_LDFLAGS} -T ${.CURDIR}/flashboot.ldscript -o ${.TARGET} \
${.ALLSRC} ${LIBSTAND}
flashboot: flashboot.elf
objcopy -S -O binary ${.TARGET}.elf ${.TARGET}
@ -81,7 +81,7 @@ flashboot.md5: flashboot
md5 flashboot > flashboot.md5
jtagboot: start.o boot2.o altera_jtag_uart.o cfi.o sdcard.o
${LD} ${LDFLAGS} -T ${.CURDIR}/jtagboot.ldscript -o ${.TARGET} \
${LD} ${_LDFLAGS} -T ${.CURDIR}/jtagboot.ldscript -o ${.TARGET} \
${.ALLSRC} ${LIBSTAND}
jtagboot.md5: jtagboot
md5 jtagboot > jtagboot.md5

View File

@ -55,7 +55,7 @@ CFLAGS.clang += -mllvm -arm-enable-ehabi
# hack because genassym.c includes sys/bus.h which includes these.
genassym.o: bus_if.h device_if.h
SYSTEM_LD_ = ${LD} -Bdynamic -T ldscript.$M.noheader ${LDFLAGS} \
SYSTEM_LD_ = ${LD} -Bdynamic -T ldscript.$M.noheader ${_LDFLAGS} \
-warn-common -export-dynamic -dynamic-linker /red/herring -o \
${FULLKERNEL}.noheader -X ${SYSTEM_OBJS} vers.o
SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// ldscript.$M\

View File

@ -177,7 +177,7 @@ SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
SYSTEM_OBJS= locore.o ${MDOBJS} ${OBJS}
SYSTEM_OBJS+= ${SYSTEM_CFILES:.c=.o}
SYSTEM_OBJS+= hack.So
SYSTEM_LD= @${LD} -Bdynamic -T ${LDSCRIPT} ${LDFLAGS} --no-warn-mismatch \
SYSTEM_LD= @${LD} -Bdynamic -T ${LDSCRIPT} ${_LDFLAGS} --no-warn-mismatch \
-warn-common -export-dynamic -dynamic-linker /red/herring \
-o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \

View File

@ -146,11 +146,11 @@ CLEANFILES+= ${KMOD:S/$/.c/}
${_firmw:C/\:.*$/.fwo/}: ${_firmw:C/\:.*$//}
@${ECHO} ${_firmw:C/\:.*$//} ${.ALLSRC:M*${_firmw:C/\:.*$//}}
@if [ -e ${_firmw:C/\:.*$//} ]; then \
${LD} -b binary --no-warn-mismatch ${LDFLAGS} \
${LD} -b binary --no-warn-mismatch ${_LDFLAGS} \
-r -d -o ${.TARGET} ${_firmw:C/\:.*$//}; \
else \
ln -s ${.ALLSRC:M*${_firmw:C/\:.*$//}} ${_firmw:C/\:.*$//}; \
${LD} -b binary --no-warn-mismatch ${LDFLAGS} \
${LD} -b binary --no-warn-mismatch ${_LDFLAGS} \
-r -d -o ${.TARGET} ${_firmw:C/\:.*$//}; \
rm ${_firmw:C/\:.*$//}; \
fi
@ -178,7 +178,7 @@ ${PROG}.symbols: ${FULLPROG}
.if ${__KLD_SHARED} == yes
${FULLPROG}: ${KMOD}.kld
${LD} -Bshareable ${LDFLAGS} -o ${.TARGET} ${KMOD}.kld
${LD} -Bshareable ${_LDFLAGS} -o ${.TARGET} ${KMOD}.kld
.if !defined(DEBUG_FLAGS)
${OBJCOPY} --strip-debug ${.TARGET}
.endif
@ -194,7 +194,7 @@ ${KMOD}.kld: ${OBJS}
.else
${FULLPROG}: ${OBJS}
.endif
${LD} ${LDFLAGS} -r -d -o ${.TARGET} ${OBJS}
${LD} ${_LDFLAGS} -r -d -o ${.TARGET} ${OBJS}
.if ${MK_CTF} != "no"
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
.endif