diff --git a/config/debug/gdb.in.cross b/config/debug/gdb.in.cross index d2fbf5104..0c1df4f12 100644 --- a/config/debug/gdb.in.cross +++ b/config/debug/gdb.in.cross @@ -26,6 +26,15 @@ config GDB_CROSS_STATIC That way, you can share the cross-gdb without installing a toolchain on every machine that will be used to debug target programs. +config GDB_CROSS_STATIC_LIBSTDCXX + bool + prompt "Link against static libstdc+++" + depends on !GDB_CROSS_STATIC + default y + help + Say 'y' if you do not want gdb to require libstdc++ and libgcc shared + libraries on the host. + config GDB_CROSS_SIM bool prompt "Enable 'sim'" @@ -76,6 +85,27 @@ config GDB_CROSS_PYTHON_BINARY help message in gdb's configure script for the --with-python option for further guidance. +config GDB_CROSS_LZMA + bool + prompt "Build GDB with LZMA" + help + Build GDB with liblzma, a compression library supporting the LZMA + algorithm. LZMA is used by the GDB's "mini debuginfo" feature, which is + only useful on the platforms using the ELF object file format. + + Note that crosstool-ng does not build liblzma for the host and you are + responsible for providing this library on the build system. + +config GDB_CROSS_GUILE + bool + prompt "Build GDB with GNU Guile scripting support" + help + Build GDB with libguile, a library implementing the GNU Guile scripting + feature. + + Note that crosstool-ng does not build libguile for the host and you are + responsible for providing this library on the build system. + config GDB_CROSS_EXTRA_CONFIG_ARRAY string prompt "Cross-gdb extra config" diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh index feabdca90..ac4a0b0b4 100644 --- a/scripts/build/debug/300-gdb.sh +++ b/scripts/build/debug/300-gdb.sh @@ -50,21 +50,33 @@ do_debug_gdb_build_cross() cross_extra_config+=("--with-python=${CT_GDB_CROSS_PYTHON_BINARY}") fi else - cross_extra_config+=("--with-python=no") + cross_extra_config+=("--with-python=no") fi if [ "${CT_GDB_CROSS_SIM}" = "y" ]; then - cross_extra_config+=("--enable-sim") + cross_extra_config+=("--enable-sim") else - cross_extra_config+=("--disable-sim") + cross_extra_config+=("--disable-sim") + fi + + if [ "${CT_GDB_CROSS_LZMA}" = "y" ]; then + cross_extra_config+=("--with-lzma") + else + cross_extra_config+=("--without-lzma") + fi + + if [ "${CT_GDB_CROSS_GUILE}" = "y" ]; then + cross_extra_config+=("--with-guile") + else + cross_extra_config+=("--without-guile") fi if ${CT_HOST}-gcc --version 2>&1 | grep clang; then - # clang detects the line from gettext's _ macro as format string - # not being a string literal and produces a lot of warnings - which - # ct-ng's logger faithfully relays to user if this happens in the - # error() function. Suppress them. - cross_extra_config+=("--enable-build-warnings=,-Wno-format-nonliteral,-Wno-format-security") + # clang detects the line from gettext's _ macro as format string + # not being a string literal and produces a lot of warnings - which + # ct-ng's logger faithfully relays to user if this happens in the + # error() function. Suppress them. + cross_extra_config+=("--enable-build-warnings=,-Wno-format-nonliteral,-Wno-format-security") fi # Target libexpat resides in sysroot and does not have @@ -94,37 +106,37 @@ do_debug_gdb_build_cross() # The problem is that the macro must be defined in a user program too, # not just in ncurses. It won't hurt if we define it here. do_gdb_backend \ - buildtype=cross \ - host="${CT_HOST}" \ - cflags="${CT_CFLAGS_FOR_HOST} -DNCURSES_STATIC" \ - ldflags="${CT_LDFLAGS_FOR_HOST}" \ - prefix="${CT_PREFIX_DIR}" \ - static="${CT_GDB_CROSS_STATIC}" \ - static_libstdcxx="${CT_GDB_CROSS_STATIC}" \ - --with-sysroot="${CT_SYSROOT_DIR}" \ - "${cross_extra_config[@]}" + buildtype=cross \ + host="${CT_HOST}" \ + cflags="${CT_CFLAGS_FOR_HOST} -DNCURSES_STATIC" \ + ldflags="${CT_LDFLAGS_FOR_HOST}" \ + prefix="${CT_PREFIX_DIR}" \ + static="${CT_GDB_CROSS_STATIC}" \ + static_libstdcxx="${CT_GDB_CROSS_STATIC_LIBSTDCXX}" \ + --with-sysroot="${CT_SYSROOT_DIR}" \ + "${cross_extra_config[@]}" if [ "${CT_BUILD_MANUALS}" = "y" ]; then - CT_DoLog EXTRA "Building and installing the cross-GDB manuals" - CT_DoExecLog ALL make ${CT_JOBSFLAGS} pdf html - CT_DoExecLog ALL make install-{pdf,html}-gdb + CT_DoLog EXTRA "Building and installing the cross-GDB manuals" + CT_DoExecLog ALL make ${CT_JOBSFLAGS} pdf html + CT_DoExecLog ALL make install-{pdf,html}-gdb fi CT_DoLog EXTRA "Installing '.gdbinit' template" # See in scripts/build/internals.sh for why we do this # TBD GCC 3.x and older not supported if [ -f "${CT_SRC_DIR}/gcc/gcc/BASE-VER" ]; then - gcc_version=$(cat "${CT_SRC_DIR}/gcc/gcc/BASE-VER") + gcc_version=$(cat "${CT_SRC_DIR}/gcc/gcc/BASE-VER") else - gcc_version=$(sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \ - "${CT_SRC_DIR}/gcc/gcc/version.c" \ - ) + gcc_version=$(sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \ + "${CT_SRC_DIR}/gcc/gcc/version.c" \ + ) fi sed -r \ - -e "s:@@PREFIX@@:${CT_PREFIX_DIR}:;" \ - -e "s:@@VERSION@@:${gcc_version}:;" \ - "${CT_LIB_DIR}/scripts/build/debug/gdbinit.in" \ - >"${CT_PREFIX_DIR}/share/gdb/gdbinit" + -e "s:@@PREFIX@@:${CT_PREFIX_DIR}:;" \ + -e "s:@@VERSION@@:${gcc_version}:;" \ + "${CT_LIB_DIR}/scripts/build/debug/gdbinit.in" \ + >"${CT_PREFIX_DIR}/share/gdb/gdbinit" CT_Popd CT_EndStep @@ -330,8 +342,18 @@ do_gdb_backend() extra_config+=("--disable-source-highlight") fi if [ "${static_libstdcxx}" = "y" ]; then - ldflags+=" -static-libgcc" - ldflags+=" -static-libstdc++" + case "$CT_HOST" in + *darwin*) + # macOS builds with clang and provides a well known execution + # environment, so there is little point in static linking the + # C++ runtime library -- ignore this option for now. + ;; + *) + ldflags+=" -static-libgcc" + ldflags+=" -static-libstdc++" + ;; + esac + # libsource-highlight is a dynamic library that uses exception # exceptions are handled by libstdc++ # this combination is very buggy, so configure don't use it and abort