Skip to content

Commit 03b0122

Browse files
authored
Merge pull request #1232 from mga-sc/mga-sc/debugInfo
[Makefile.in] glibc: Remove unnecessary -g option
2 parents 016637c + 2d5438f commit 03b0122

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

Makefile.in

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ QEMU_SRCDIR := @with_qemu_src@
1313
SPIKE_SRCDIR := @with_spike_src@
1414
PK_SRCDIR := @with_pk_src@
1515
DEJAGNU_SRCDIR := @with_dejagnu_src@
16+
DEBUG_INFO := @debug_info@
1617

1718
SIM ?= @WITH_SIM@
1819

@@ -372,8 +373,8 @@ endif
372373
cd $(notdir $@) && \
373374
CC="$(GLIBC_CC_FOR_TARGET) $($@_CFLAGS)" \
374375
CXX="this-is-not-the-compiler-youre-looking-for" \
375-
CFLAGS="$(CFLAGS_FOR_TARGET) -g -O2 $($@_CFLAGS)" \
376-
CXXFLAGS="$(CXXFLAGS_FOR_TARGET) -g -O2 $($@_CFLAGS)" \
376+
CFLAGS="$(CFLAGS_FOR_TARGET) $(DEBUG_INFO) -O2 $($@_CFLAGS)" \
377+
CXXFLAGS="$(CXXFLAGS_FOR_TARGET) $(DEBUG_INFO) -O2 $($@_CFLAGS)" \
377378
ASFLAGS="$(ASFLAGS_FOR_TARGET) $($@_CFLAGS)" \
378379
$</configure \
379380
--host=$(call make_tuple,$($@_XLEN),linux-gnu) \
@@ -788,8 +789,8 @@ stamps/build-musl-linux: $(MUSL_SRCDIR) $(MUSL_SRC_GIT) stamps/build-gcc-musl-st
788789
cd $(notdir $@) && \
789790
CC="$(MUSL_CC_FOR_TARGET) $($@_CFLAGS)" \
790791
CXX="$(MUSL_CXX_FOR_TARGET) $($@_CFLAGS)" \
791-
CFLAGS="$(CFLAGS_FOR_TARGET) -g -O2 $($@_CFLAGS)" \
792-
CXXFLAGS="$(CXXFLAGS_FOR_TARGET) -g -O2 $($@_CFLAGS)" \
792+
CFLAGS="$(CFLAGS_FOR_TARGET) $(DEBUG_INFO) -O2 $($@_CFLAGS)" \
793+
CXXFLAGS="$(CXXFLAGS_FOR_TARGET) $(DEBUG_INFO) -O2 $($@_CFLAGS)" \
793794
ASFLAGS="$(ASFLAGS_FOR_TARGET) $($@_CFLAGS)" \
794795
$</configure \
795796
--host=$(MUSL_TUPLE) \

configure

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ WITH_ISA_SPEC
615615
WITH_TUNE
616616
WITH_ABI
617617
WITH_ARCH
618+
debug_info
618619
default_target
619620
FETCHER
620621
FTP
@@ -676,6 +677,7 @@ ac_subst_files=''
676677
ac_user_opts='
677678
enable_option_checking
678679
enable_linux
680+
enable_debug_info
679681
with_arch
680682
with_abi
681683
with_tune
@@ -1335,6 +1337,7 @@ Optional Features:
13351337
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
13361338
--enable-linux set linux as the default make target
13371339
[--disable-linux]
1340+
--disable-debug-info build glibc and musl without debug infromation
13381341
--enable-multilib build both RV32 and RV64 runtime libraries (only
13391342
RV64 for musl libc) [--disable-multilib]
13401343
--enable-gcc-checking Enable gcc internal checking, it will make gcc very
@@ -3296,6 +3299,23 @@ else
32963299
32973300
fi
32983301
3302+
# Check whether --enable-debug_info was given.
3303+
if test "${enable_debug_info+set}" = set; then :
3304+
enableval=$enable_debug_info; disable_debug_info=yes
3305+
else
3306+
disable_debug_info=no
3307+
3308+
fi
3309+
3310+
3311+
if test "x$disable_debug_info" != xno; then :
3312+
debug_info=""
3313+
3314+
else
3315+
debug_info="-g"
3316+
3317+
fi
3318+
32993319
33003320
# Check whether --with-arch was given.
33013321
if test "${with_arch+set}" = set; then :

configure.ac

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ AS_IF([test "x$enable_linux" != xno],
5050
[AC_SUBST(default_target, linux)],
5151
[AC_SUBST(default_target, newlib)])
5252

53+
AC_ARG_ENABLE(debug_info,
54+
[AS_HELP_STRING([--disable-debug-info],
55+
[build glibc and musl without debug infromation])],
56+
[disable_debug_info=yes],
57+
[disable_debug_info=no]
58+
)
59+
60+
AS_IF([test "x$disable_debug_info" != xno],
61+
[AC_SUBST(debug_info, "")],
62+
[AC_SUBST(debug_info, "-g")])
63+
5364
AC_ARG_WITH(arch,
5465
[AS_HELP_STRING([--with-arch=rv64imafdc],
5566
[Sets the base RISC-V ISA, defaults to rv64imafdc])],

0 commit comments

Comments
 (0)