Skip to content

Commit

Permalink
Merge pull request #1232 from mga-sc/mga-sc/debugInfo
Browse files Browse the repository at this point in the history
[Makefile.in] glibc: Remove unnecessary -g option
  • Loading branch information
kito-cheng authored Apr 24, 2023
2 parents 016637c + 2d5438f commit 03b0122
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ QEMU_SRCDIR := @with_qemu_src@
SPIKE_SRCDIR := @with_spike_src@
PK_SRCDIR := @with_pk_src@
DEJAGNU_SRCDIR := @with_dejagnu_src@
DEBUG_INFO := @debug_info@

SIM ?= @WITH_SIM@

Expand Down Expand Up @@ -372,8 +373,8 @@ endif
cd $(notdir $@) && \
CC="$(GLIBC_CC_FOR_TARGET) $($@_CFLAGS)" \
CXX="this-is-not-the-compiler-youre-looking-for" \
CFLAGS="$(CFLAGS_FOR_TARGET) -g -O2 $($@_CFLAGS)" \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET) -g -O2 $($@_CFLAGS)" \
CFLAGS="$(CFLAGS_FOR_TARGET) $(DEBUG_INFO) -O2 $($@_CFLAGS)" \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET) $(DEBUG_INFO) -O2 $($@_CFLAGS)" \
ASFLAGS="$(ASFLAGS_FOR_TARGET) $($@_CFLAGS)" \
$</configure \
--host=$(call make_tuple,$($@_XLEN),linux-gnu) \
Expand Down Expand Up @@ -788,8 +789,8 @@ stamps/build-musl-linux: $(MUSL_SRCDIR) $(MUSL_SRC_GIT) stamps/build-gcc-musl-st
cd $(notdir $@) && \
CC="$(MUSL_CC_FOR_TARGET) $($@_CFLAGS)" \
CXX="$(MUSL_CXX_FOR_TARGET) $($@_CFLAGS)" \
CFLAGS="$(CFLAGS_FOR_TARGET) -g -O2 $($@_CFLAGS)" \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET) -g -O2 $($@_CFLAGS)" \
CFLAGS="$(CFLAGS_FOR_TARGET) $(DEBUG_INFO) -O2 $($@_CFLAGS)" \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET) $(DEBUG_INFO) -O2 $($@_CFLAGS)" \
ASFLAGS="$(ASFLAGS_FOR_TARGET) $($@_CFLAGS)" \
$</configure \
--host=$(MUSL_TUPLE) \
Expand Down
20 changes: 20 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ WITH_ISA_SPEC
WITH_TUNE
WITH_ABI
WITH_ARCH
debug_info
default_target
FETCHER
FTP
Expand Down Expand Up @@ -676,6 +677,7 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_linux
enable_debug_info
with_arch
with_abi
with_tune
Expand Down Expand Up @@ -1335,6 +1337,7 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-linux set linux as the default make target
[--disable-linux]
--disable-debug-info build glibc and musl without debug infromation
--enable-multilib build both RV32 and RV64 runtime libraries (only
RV64 for musl libc) [--disable-multilib]
--enable-gcc-checking Enable gcc internal checking, it will make gcc very
Expand Down Expand Up @@ -3296,6 +3299,23 @@ else
fi
# Check whether --enable-debug_info was given.
if test "${enable_debug_info+set}" = set; then :
enableval=$enable_debug_info; disable_debug_info=yes
else
disable_debug_info=no
fi
if test "x$disable_debug_info" != xno; then :
debug_info=""
else
debug_info="-g"
fi
# Check whether --with-arch was given.
if test "${with_arch+set}" = set; then :
Expand Down
11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ AS_IF([test "x$enable_linux" != xno],
[AC_SUBST(default_target, linux)],
[AC_SUBST(default_target, newlib)])

AC_ARG_ENABLE(debug_info,
[AS_HELP_STRING([--disable-debug-info],
[build glibc and musl without debug infromation])],
[disable_debug_info=yes],
[disable_debug_info=no]
)

AS_IF([test "x$disable_debug_info" != xno],
[AC_SUBST(debug_info, "")],
[AC_SUBST(debug_info, "-g")])

AC_ARG_WITH(arch,
[AS_HELP_STRING([--with-arch=rv64imafdc],
[Sets the base RISC-V ISA, defaults to rv64imafdc])],
Expand Down

0 comments on commit 03b0122

Please sign in to comment.