Skip to content

Commit

Permalink
Use compiler driver to link BERI boot loaders
Browse files Browse the repository at this point in the history
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
  • Loading branch information
akabaev committed Jan 5, 2017
1 parent 2833497 commit f20a27e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sys/boot/mips/beri/boot2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ 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}
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
Expand Down
1 change: 0 additions & 1 deletion sys/boot/mips/beri/common/common.ldscript
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 0 additions & 1 deletion sys/boot/mips/beri/loader/loader.ldscript
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f20a27e

Please sign in to comment.