From 57f529d416e747ba00dfa3053588fa0e34508b3b Mon Sep 17 00:00:00 2001 From: Palmer Dabbelt Date: Thu, 21 Jun 2018 15:18:19 -0700 Subject: [PATCH] Split the binutils and GDB builds Binutils and GDB are kept in the same repository but follow seperate relaese streams. We've been release GDB versions based on binutils tags, but this is the wrong thing to do and has caused multiple headaches related to our out-of-tree GDB port. This patch splits the binutils and GDB submodules, but doesn't actually change the versions. --- .gitmodules | 7 +- Makefile.in | 97 ++++++++++++++++++++++------ riscv-binutils-gdb => riscv-binutils | 0 riscv-gdb | 1 + 4 files changed, 85 insertions(+), 20 deletions(-) rename riscv-binutils-gdb => riscv-binutils (100%) create mode 160000 riscv-gdb diff --git a/.gitmodules b/.gitmodules index 97b9c150..5f9cd026 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,5 +1,5 @@ -[submodule "riscv-binutils-gdb"] - path = riscv-binutils-gdb +[submodule "riscv-binutils"] + path = riscv-binutils url = ../riscv-binutils-gdb.git [submodule "riscv-gcc"] path = riscv-gcc @@ -16,3 +16,6 @@ [submodule "riscv-qemu"] path = riscv-qemu url = git://github.com/riscv/riscv-qemu.git +[submodule "riscv-gdb"] + path = riscv-gdb + url = ../riscv-binutils-gdb.git diff --git a/Makefile.in b/Makefile.in index ce0c53d7..d7ac75fb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -57,8 +57,10 @@ NEWLIB_TUPLE ?= $(call make_tuple,$(XLEN),elf) CFLAGS_FOR_TARGET := $(CFLAGS_FOR_TARGET_EXTRA) @cmodel@ ASFLAGS_FOR_TARGET := $(ASFLAGS_FOR_TARGET_EXTRA) @cmodel@ # --with-expat is required to enable XML support used by OpenOCD. -BINUTILS_GDB_TARGET_FLAGS := --with-expat=yes $(BINUTILS_GDB_TARGET_FLAGS_EXTRA) -BINUTILS_GDB_NATIVE_FLAGS := $(BINUTILS_GDB_NATIVE_FLAGS_EXTRA) +BINUTILS_TARGET_FLAGS := --with-expat=yes $(BINUTILS_TARGET_FLAGS_EXTRA) +BINUTILS_NATIVE_FLAGS := $(BINUTILS_NATIVE_FLAGS_EXTRA) +GDB_TARGET_FLAGS := --with-expat=yes $(GDB_TARGET_FLAGS_EXTRA) +GDB_NATIVE_FLAGS := $(GDB_NATIVE_FLAGS_EXTRA) GLIBC_TARGET_FLAGS := $(GLIBC_TARGET_FLAGS_EXTRA) GLIBC_CC_FOR_TARGET ?= $(LINUX_TUPLE)-gcc GLIBC_CXX_FOR_TARGET ?= $(LINUX_TUPLE)-g++ @@ -73,10 +75,15 @@ CONFIGURE_HOST = @configure_host@ all: @default_target@ newlib: stamps/build-gcc-newlib-stage2 linux: stamps/build-gcc-linux-stage2 +ifeq (@enable_gdb@,--enable-gdb) +newlib: stamps/build-gdb-newlib +linux: stamps/build-gdb-linux +endif linux-native: stamps/build-gcc-linux-native -.PHONY: build-binutils build-gcc1 build-libc build-gcc2 build-qemu +.PHONY: build-binutils build-gdb build-gcc1 build-libc build-gcc2 build-qemu build-binutils: stamps/build-binutils-@default_target@ +build-gdb: stamps/build-gdb-@default_target@ build-gcc%: stamps/build-gcc-@default_target@-stage% ifeq (@default_target@,linux) build-libc: $(patsubst %,stamps/build-glibc-linux-%,$(MULTLIB_NAMES)) @@ -149,7 +156,29 @@ $(addprefix $(srcdir)/patches/,$(PACKAGES)): $(srcdir)/patches/%: src/% patches: $(addprefix $(srcdir)/patches/,$(PACKAGES)) -stamps/build-binutils-linux: $(srcdir)/riscv-binutils-gdb +stamps/build-binutils-linux: $(srcdir)/riscv-binutils + rm -rf $@ $(notdir $@) + mkdir $(notdir $@) +# CC_FOR_TARGET is required for the ld testsuite. + cd $(notdir $@) && CC_FOR_TARGET=$(GLIBC_CC_FOR_TARGET) $ $@ -stamps/check-gdb-newlib: stamps/build-gcc-newlib-stage2 stamps/build-qemu +stamps/check-gdb-newlib: stamps/build-gcc-newlib-stage2 stamps/build-gdb-newlib stamps/build-qemu PATH="$(srcdir)/scripts/wrapper/qemu:$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-binutils-newlib check-gdb -k "RUNTESTFLAGS=--target_board='$(NEWLIB_TARGET_BOARDS)'" || true date > $@ -stamps/check-gdb-newlib-nano: stamps/build-gcc-newlib-stage2 stamps/build-qemu +stamps/check-gdb-newlib-nano: stamps/build-gcc-newlib-stage2 stamps/build-gdb-newlib stamps/build-qemu PATH="$(srcdir)/scripts/wrapper/qemu:$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-binutils-newlib check-gdb -k "RUNTESTFLAGS=--target_board='$(NEWLIB_NANO_TARGET_BOARDS)'" || true date > $@ -stamps/check-gdb-linux: stamps/build-gcc-linux-stage2 stamps/build-qemu +stamps/check-gdb-linux: stamps/build-gcc-linux-stage2 stamps/build-gdb-linux stamps/build-qemu PATH="$(srcdir)/scripts/wrapper/qemu:$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-binutils-linux check-gdb -k "RUNTESTFLAGS=--target_board='$(GLIBC_TARGET_BOARDS)'" || true date > $@ @@ -606,16 +667,16 @@ clean: .PHONY: report-gdb-newlib report-gdb-newlib-nano report-gdb-newlib: stamps/check-gdb-newlib stat $(patsubst %,$(srcdir)/test/gdb-newlib/%.log,$(NEWLIB_MULTILIB_NAMES)) || exit 1 - if find build-binutils-newlib -iname '*.sum' | xargs grep ^FAIL | sort | grep -F -v $(patsubst %,--file=$(srcdir)/test/gdb-newlib/%.log,$(NEWLIB_MULTILIB_NAMES)); then false; else true; fi + if find build-gdb-newlib -iname '*.sum' | xargs grep ^FAIL | sort | grep -F -v $(patsubst %,--file=$(srcdir)/test/gdb-newlib/%.log,$(NEWLIB_MULTILIB_NAMES)); then false; else true; fi report-gdb-newlib-nano: stamps/check-gdb-newlib-nano stat $(patsubst %,$(srcdir)/test/gdb-newlib/%.log,$(NEWLIB_MULTILIB_NAMES)) || exit 1 - if find build-binutils-newlib -iname '*.sum' | xargs grep ^FAIL | sort | grep -F -v $(patsubst %,--file=$(srcdir)/test/gdb-newlib/%.log,$(NEWLIB_MULTILIB_NAMES)); then false; else true; fi + if find build-gdb-newlib -iname '*.sum' | xargs grep ^FAIL | sort | grep -F -v $(patsubst %,--file=$(srcdir)/test/gdb-newlib/%.log,$(NEWLIB_MULTILIB_NAMES)); then false; else true; fi .PHONY: report-gdb-linux report-gdb-linux: stamps/check-gdb-linux stat $(patsubst %,$(srcdir)/test/gdb-linux/%.log,$(GLIBC_MULTILIB_NAMES)) || exit 1 - if find build-binutils-linux -iname '*.sum' | xargs grep ^FAIL | sort | grep -F -v $(patsubst %,--file=$(srcdir)/test/gdb-linux/%.log,$(GLIBC_MULTILIB_NAMES)); then false; else true; fi + if find build-gdb-linux -iname '*.sum' | xargs grep ^FAIL | sort | grep -F -v $(patsubst %,--file=$(srcdir)/test/gdb-linux/%.log,$(GLIBC_MULTILIB_NAMES)); then false; else true; fi distclean: clean rm -rf src diff --git a/riscv-binutils-gdb b/riscv-binutils similarity index 100% rename from riscv-binutils-gdb rename to riscv-binutils diff --git a/riscv-gdb b/riscv-gdb new file mode 160000 index 00000000..635c14ec --- /dev/null +++ b/riscv-gdb @@ -0,0 +1 @@ +Subproject commit 635c14ec58512380f28fc80447a427de9341293d