tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Better EXTERNAL_TOOLCHAIN support



As part of my research bringing up the RISC-V port, I need to use an
external GCC/Binutils in combination with the rest of the NetBSD
toolchain.

The following patches allow passing -V BFDDIR="..." -V IBERTYDIR="..."
-V EXTERNAL_TOOLCHAIN="..." -V TOOLCHAIN_MISSING="yes" to build.sh and
build all the needed tools (Assuming GCC and Binutils live in
EXTERNAL_TOOLCHAIN). Without passing BFDDIR and IBERTYDIR the defaults
are used and everything continues functioning as normal.

There was a comment in tools/Makefile that implied this was intended
at one point, and no one ever got around to doing it:
XXX Eventually, we want to be able to build dbsym and mdsetimage
XXX if EXTERNAL_TOOLCHAIN is set.

If there's a preferred way to submit patches, just let me know.

Thanks,
Zach

---

From 52661c93efc25917ab62e5cb648e2c7ee2eaf81c Mon Sep 17 00:00:00 2001
From: Zachary McGrew <zmcgrew%gmail.com@localhost>
Date: Wed, 13 Dec 2017 10:28:45 -0800
Subject: [PATCH 1/3] tools/dbsym/Makefile: Only set BFDDIR and IBERTYDIR if
 unset

---
 tools/dbsym/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/dbsym/Makefile b/tools/dbsym/Makefile
index b025c1eb04c9..227ce9fae10f 100644
--- a/tools/dbsym/Makefile
+++ b/tools/dbsym/Makefile
@@ -9,8 +9,8 @@ HOSTPROGNAME=    ${MACHINE_GNU_PLATFORM}-dbsym
 HOST_SRCDIR=    external/gpl3/binutils/usr.sbin/dbsym

 TOOLCHAINOBJ!=    cd ${.CURDIR}/../binutils && ${PRINTOBJDIR}
-BFDDIR=        ${TOOLCHAINOBJ}/build/bfd
-IBERTYDIR=    ${TOOLCHAINOBJ}/build/libiberty
+BFDDIR?=    ${TOOLCHAINOBJ}/build/bfd
+IBERTYDIR?=    ${TOOLCHAINOBJ}/build/libiberty

 .include "${.CURDIR}/../Makefile.host"

From 9336068d587bb8a683de1715c0808d60bc94f90c Mon Sep 17 00:00:00 2001
From: Zachary McGrew <zmcgrew%gmail.com@localhost>
Date: Wed, 13 Dec 2017 10:29:10 -0800
Subject: [PATCH 2/3] tools/mdsetimage/Makefile: Only set BFDDIR and IBERTYDIR
 if unset

---
 tools/mdsetimage/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/mdsetimage/Makefile b/tools/mdsetimage/Makefile
index af17ad4fc516..4c4dcbe7641e 100644
--- a/tools/mdsetimage/Makefile
+++ b/tools/mdsetimage/Makefile
@@ -9,8 +9,8 @@ HOSTPROGNAME=    ${MACHINE_GNU_PLATFORM}-mdsetimage
 HOST_SRCDIR=    external/gpl3/binutils/usr.sbin/mdsetimage

 TOOLCHAINOBJ!=    cd ${.CURDIR}/../binutils && ${PRINTOBJDIR}
-BFDDIR=        ${TOOLCHAINOBJ}/build/bfd
-IBERTYDIR=    ${TOOLCHAINOBJ}/build/libiberty
+BFDDIR?=    ${TOOLCHAINOBJ}/build/bfd
+IBERTYDIR?=    ${TOOLCHAINOBJ}/build/libiberty

 .include "${.CURDIR}/../Makefile.host"


From 4cecc3a33241540838413611d610521db5826a70 Mon Sep 17 00:00:00 2001
From: Zachary McGrew <zmcgrew%gmail.com@localhost>
Date: Tue, 26 Dec 2017 14:54:40 -0800
Subject: [PATCH 3/3] Allow dbsym and mdsetimage to build if EXTERNAL_TOOLCHAIN
 is defined

---
 tools/Makefile | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index 36506491c169..2dbe142b0bfd 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -53,9 +53,7 @@ TOOLCHAIN_BITS+= pcc
 . endif
 .endif

-.if ${TOOLCHAIN_MISSING} == "no"
-# XXX Eventually, we want to be able to build dbsym and mdsetimage
-# XXX if EXTERNAL_TOOLCHAIN is set.
+.if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)
 TOOLCHAIN_BITS+= dbsym mdsetimage
 .endif


Home | Main Index | Thread Index | Old Index