Skip to content

Strip host binaries #1724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@

Expand Down Expand Up @@ -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 $@

Expand Down Expand Up @@ -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 $@

Expand Down Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -736,6 +737,7 @@ with_guile
enable_gdb
enable_llvm
enable_host_gcc
enable_strip
with_gcc_src
with_binutils_src
with_newlib_src
Expand Down Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stripping is disabled by default. So I would expect enable-strip instead of disable-strip.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this needs to be documented in README.md.

--enable-libsanitizer Build libsanitizer, which only supports rv64
--enable-qemu-system Build qemu with system-mode emulation

Expand Down Expand Up @@ -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



{
Expand Down
10 changes: 10 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down