From owner-svn-src-head@freebsd.org Thu Jan 5 19:17:15 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2704CA1ED9; Thu, 5 Jan 2017 19:17:15 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 683D01A63; Thu, 5 Jan 2017 19:17:15 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v05JHEF4043265; Thu, 5 Jan 2017 19:17:14 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v05JHE1P043260; Thu, 5 Jan 2017 19:17:14 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201701051917.v05JHE1P043260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Thu, 5 Jan 2017 19:17:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r311458 - in head/sys/boot/mips/beri: boot2 common loader X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2017 19:17:15 -0000 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