Use compiler driver to link BERI boot loaders

Do not hardcode elf64-tradbigmips as output format in BERI linker scrips.
Unfortunately, in-tree toolchain and external newer versions of binutils
mean two different things under that. When creating elf binaries using
external toolchain, gcc uses elf64-tradbigmips-freebsd and so linker
script file has to match in order for ld to be able to create the final loader
binary.

Rather than trying to guess, remove hardcoded output format directive from
the linker directive files and use CC to invoke the linker instead.

Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D9050
This commit is contained in:
kan 2017-01-05 19:17:14 +00:00
parent f76be8ca9c
commit efd050aeac
3 changed files with 2 additions and 4 deletions

View File

@ -71,7 +71,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} \
${CC} ${_LDFLAGS} -T ${.CURDIR}/flashboot.ldscript -o ${.TARGET} \
${.ALLSRC} ${LIBSTAND}
flashboot: flashboot.elf
${OBJCOPY} -S -O binary ${.TARGET}.elf ${.TARGET}
@ -79,7 +79,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} \
${CC} ${_LDFLAGS} -T ${.CURDIR}/jtagboot.ldscript -o ${.TARGET} \
${.ALLSRC} ${LIBSTAND}
jtagboot.md5: jtagboot
md5 jtagboot > jtagboot.md5

View File

@ -73,5 +73,4 @@ __cheri_sdcard_vaddr__ = __mips64_xkphys_uncached__ + __cheri_sdcard_base__;
__kernel_base__ = 0x100000;
__kernel_vaddr__ = __mips64_xkphys_cached__ + __kernel_base__;
OUTPUT_FORMAT("elf64-tradbigmips");
OUTPUT_ARCH(mips)

View File

@ -44,7 +44,6 @@ __loader_base_vaddr__ = __mips64_xkphys_cached__ + __loader_base__;
__loader_end__ = 0x100000;
__loader_end_vaddr__ = __mips64_xkphys_cached__ + __loader_end__;
OUTPUT_FORMAT("elf64-tradbigmips");
OUTPUT_ARCH(mips)
ENTRY(start)
SECTIONS