diff --git a/Makefile.in b/Makefile.in index 464abf0b554..135c2430cc5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -17,6 +17,7 @@ LLVM_SRCDIR := @with_llvm_src@ DEJAGNU_SRCDIR := @with_dejagnu_src@ DEBUG_INFO := @debug_info@ ENABLE_DEFAULT_PIE := @enable_default_pie@ +GCC_INSTALL_TARGET := @gcc_install_target@ SIM ?= @WITH_SIM@ @@ -536,7 +537,7 @@ stamps/build-gcc-linux-stage2: $(GCC_SRCDIR) $(GCC_SRC_GIT) $(addprefix stamps/b CFLAGS_FOR_TARGET="-O2 $(CFLAGS_FOR_TARGET)" \ CXXFLAGS_FOR_TARGET="-O2 $(CXXFLAGS_FOR_TARGET)" $(MAKE) -C $(notdir $@) - $(MAKE) -C $(notdir $@) install + $(MAKE) -C $(notdir $@) $(GCC_INSTALL_TARGET) cp -a $(INSTALL_DIR)/$(LINUX_TUPLE)/lib* $(SYSROOT) mkdir -p $(dir $@) && touch $@ @@ -592,7 +593,7 @@ stamps/build-gcc-linux-native: $(GCC_SRCDIR) $(GCC_SRC_GIT) stamps/build-gcc-lin $(WITH_ISA_SPEC) \ $(GCC_EXTRA_CONFIGURE_FLAGS) $(MAKE) -C $(notdir $@) - $(MAKE) -C $(notdir $@) install + $(MAKE) -C $(notdir $@) $(GCC_INSTALL_TARGET) cp -a $(INSTALL_DIR)/$(LINUX_TUPLE)/lib* $(SYSROOT) mkdir -p $(dir $@) && touch $@ @@ -1124,6 +1125,7 @@ stamps/build-qemu: $(QEMU_SRCDIR) $(QEMU_SRC_GIT) $(PREPARATION_STAMP) --prefix=$(INSTALL_DIR) \ --target-list=$(QEMU_TARGETS) \ --interp-prefix=$(INSTALL_DIR)/sysroot \ + --disable-debug-info \ --python=python3 $(MAKE) -C $(notdir $@) $(MAKE) -C $(notdir $@) install diff --git a/configure b/configure index d63740046b0..701be0dcac0 100755 --- a/configure +++ b/configure @@ -630,6 +630,7 @@ with_glibc_src with_newlib_src with_binutils_src with_gcc_src +gcc_install_target enable_host_gcc enable_llvm enable_gdb @@ -736,6 +737,7 @@ with_guile enable_gdb enable_llvm enable_host_gcc +enable_strip with_gcc_src with_binutils_src with_newlib_src @@ -1392,6 +1394,7 @@ Optional Features: --disable-gdb Don't build GDB, as it's not upstream --enable-llvm Build LLVM (clang) --enable-host-gcc Build host GCC to build cross toolchain + --disable-strip Do not strip debug symbols at install time --enable-libsanitizer Build libsanitizer, which only supports rv64 --enable-qemu-system Build qemu with system-mode emulation @@ -4341,6 +4344,26 @@ else $as_nop fi +# Check whether --enable-strip was given. +if test ${enable_strip+y} +then : + enableval=$enable_strip; +else case e in #( + e) strip_debug=yes ;; +esac +fi + + +if test "x$strip_debug" != xyes +then : + gcc_install_target=install + +else case e in #( + e) gcc_install_target=install-strip + ;; +esac +fi + { diff --git a/configure.ac b/configure.ac index 3a529f2255a..19502292627 100644 --- a/configure.ac +++ b/configure.ac @@ -287,6 +287,16 @@ AS_IF([test "x$enable_host_gcc" != xyes], [AC_SUBST(enable_host_gcc, --disable-host-gcc)], [AC_SUBST(enable_host_gcc, --enable-host-gcc)]) +AC_ARG_ENABLE(strip, + [AS_HELP_STRING([--disable-strip], + [Do not strip debug symbols at install time])], + [], + [strip_debug=yes]) + +AS_IF([test "x$strip_debug" != xyes], + [AC_SUBST(gcc_install_target, install)], + [AC_SUBST(gcc_install_target, install-strip)]) + AC_DEFUN([AX_ARG_WITH_SRC], [{m4_pushdef([opt_name], with_$1_src) AC_ARG_WITH($1-src,