aboutsummaryrefslogtreecommitdiff
path: root/scripts/build/debug/300-gdb.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/build/debug/300-gdb.sh')
-rw-r--r--scripts/build/debug/300-gdb.sh37
1 files changed, 24 insertions, 13 deletions
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
index 8860b541..508ba25f 100644
--- a/scripts/build/debug/300-gdb.sh
+++ b/scripts/build/debug/300-gdb.sh
@@ -66,8 +66,8 @@ do_debug_gdb_build()
# version of expat and will attempt to link that, despite the -static flag.
# The link will fail, and configure will abort with "expat missing or unusable"
# message.
- extra_config+=("--with-expat")
- extra_config+=("--without-libexpat-prefix")
+ cross_extra_config+=("--with-expat")
+ cross_extra_config+=("--without-libexpat-prefix")
# ct-ng always builds ncurses in cross mode as a static library.
# Starting from the patchset 20200718 ncurses defines a special macro
@@ -122,6 +122,14 @@ do_debug_gdb_build()
native_extra_config+=("--program-prefix=")
+ # Starting from GDB 11.x, gmp is needed as a dependency to build full
+ # gdb. And if target GMP gets built, explicitly point to installed library,
+ # as otherwise host library might be attempted to be used for target binary
+ # linkage.
+ if [ "${CT_GMP_TARGET}" = "y" ]; then
+ native_extra_config+=("--with-libgmp-prefix=${CT_SYSROOT_DIR}")
+ fi
+
# gdbserver gets enabled by default with gdb
# since gdbserver was promoted to top-level
if [ "${CT_GDB_GDBSERVER_TOPLEVEL}" = "y" ]; then
@@ -167,17 +175,14 @@ do_debug_gdb_build()
# where libexpat for build platform lives, which is
# unacceptable for cross-compiling.
#
- # To prevent this '--without-libexpat-prefix' flag must be passed.
- # Thus configure falls back to '-lexpat', which is exactly what we want.
- #
- # NOTE: DO NOT USE --with-libexpat-prefix (until GDB configure is smarter)!!!
- # It conflicts with a static build: GDB's configure script will find the shared
- # version of expat and will attempt to link that, despite the -static flag.
- # The link will fail, and configure will abort with "expat missing or unusable"
- # message.
- native_extra_config+=("--with-expat")
- native_extra_config+=("--without-libexpat-prefix")
+ native_extra_config+=("--with-expat=y")
+ native_extra_config+=("--with-libexpat-prefix=${CT_BUILDTOOLS_PREFIX_DIR}")
+ # Without specifying libexpat type, configure would look for -lexpat
+ # and try to link with shared library, set library type explicitly.
+ if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
+ native_extra_config+=("--with-libexpat-type=static")
+ fi
do_gdb_backend \
buildtype=native \
subdir=${subdir} \
@@ -348,7 +353,13 @@ do_gdb_backend()
"${extra_config[@]}" \
if [ "${static}" = "y" ]; then
- extra_make_flags+=("LDFLAGS=${ldflags} -all-static")
+ if [ "${CT_GDB_CC_LD_LIBTOOL}" = "y" ]; then
+ # gdb is linked with libtool, but gdbserver is not
+ # Both linker accept -static --static and create static binaries
+ extra_make_flags+=("LDFLAGS=${ldflags} -static --static")
+ else
+ extra_make_flags+=("LDFLAGS=${ldflags} -static")
+ fi
CT_DoLog EXTRA "Prepare gdb for static build"
CT_DoExecLog ALL make ${CT_JOBSFLAGS} configure-host
fi