Author: kan
Date: Thu Jan  5 19:17:14 2017
New Revision: 311458
URL: https://svnweb.freebsd.org/changeset/base/311458

Log:
  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

Modified:
  head/sys/boot/mips/beri/boot2/Makefile
  head/sys/boot/mips/beri/common/common.ldscript
  head/sys/boot/mips/beri/loader/loader.ldscript

Modified: head/sys/boot/mips/beri/boot2/Makefile
==============================================================================
--- head/sys/boot/mips/beri/boot2/Makefile      Thu Jan  5 18:32:53 2017        
(r311457)
+++ head/sys/boot/mips/beri/boot2/Makefile      Thu Jan  5 19:17:14 2017        
(r311458)
@@ -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

Modified: head/sys/boot/mips/beri/common/common.ldscript
==============================================================================
--- head/sys/boot/mips/beri/common/common.ldscript      Thu Jan  5 18:32:53 
2017        (r311457)
+++ head/sys/boot/mips/beri/common/common.ldscript      Thu Jan  5 19:17:14 
2017        (r311458)
@@ -73,5 +73,4 @@ __cheri_sdcard_vaddr__ = __mips64_xkphys
 __kernel_base__ = 0x100000;
 __kernel_vaddr__ = __mips64_xkphys_cached__ + __kernel_base__;
 
-OUTPUT_FORMAT("elf64-tradbigmips");
 OUTPUT_ARCH(mips)

Modified: head/sys/boot/mips/beri/loader/loader.ldscript
==============================================================================
--- head/sys/boot/mips/beri/loader/loader.ldscript      Thu Jan  5 18:32:53 
2017        (r311457)
+++ head/sys/boot/mips/beri/loader/loader.ldscript      Thu Jan  5 19:17:14 
2017        (r311458)
@@ -44,7 +44,6 @@ __loader_base_vaddr__ = __mips64_xkphys_
 __loader_end__ = 0x100000;
 __loader_end_vaddr__ = __mips64_xkphys_cached__ + __loader_end__;
 
-OUTPUT_FORMAT("elf64-tradbigmips");
 OUTPUT_ARCH(mips)
 ENTRY(start)
 SECTIONS
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to