diff options
author | Alexey Brodkin <abrodkin@synopsys.com> | 2020-05-27 13:10:31 +0300 |
---|---|---|
committer | Chris Packham <judge.packham@gmail.com> | 2021-08-25 10:12:56 +1200 |
commit | 5463ab4bf6a0ba13e77c0d5d9cb4c2a4656639ca (patch) | |
tree | df21473f332257b4b4bd2af45bac800f26f358c0 /scripts | |
parent | cf53d3736f014436431a1ac6ecae08d94ec7c9c0 (diff) | |
download | crosstool-ng-5463ab4bf6a0ba13e77c0d5d9cb4c2a4656639ca.tar.gz crosstool-ng-5463ab4bf6a0ba13e77c0d5d9cb4c2a4656639ca.tar.bz2 crosstool-ng-5463ab4bf6a0ba13e77c0d5d9cb4c2a4656639ca.zip |
gdb: Add gdb-10.2
In GDB 10.x gdbserver was promoted to the top-level folder,
see https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=919adfe8409211c726c1d05b47ca59890ee648f1
Which means it is no longer a subfolder in "gdb" and so we have to
build gdbserver now exactly in the same way as normal native GDB.
One interesting detail is gdbserver doesn't need to deal with target
description in .xml so it doesn't depend on libexpat on target,
thus we need to move libexpat explicit selection from do_gdb_backend()
to its callers when building native [full] gdb as well as cross-gdb
for the host.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
[cp: support old/new layout, regenerate patches]
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/build/debug/300-gdb.sh | 121 |
1 files changed, 91 insertions, 30 deletions
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh index 75c683d9..2ef0c712 100644 --- a/scripts/build/debug/300-gdb.sh +++ b/scripts/build/debug/300-gdb.sh @@ -50,6 +50,25 @@ do_debug_gdb_build() cross_extra_config+=("--enable-build-warnings=,-Wno-format-nonliteral,-Wno-format-security") fi + # Target libexpat resides in sysroot and does not have + # any dependencies, so just passing '-lexpat' to gcc is enough. + # + # By default gdb configure looks for expat in '$prefix/lib' + # directory. In our case '$prefix/lib' resolves to '/usr/lib' + # 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. + extra_config+=("--with-expat") + extra_config+=("--without-libexpat-prefix") + do_gdb_backend \ buildtype=cross \ host="${CT_HOST}" \ @@ -88,7 +107,7 @@ do_debug_gdb_build() CT_EndStep fi - if [ "${CT_GDB_NATIVE}" = "y" -o "${CT_GDB_GDBSERVER}" = "y" ]; then + if [ "${CT_GDB_NATIVE}" = "y" ]; then local -a native_extra_config local subdir @@ -102,17 +121,78 @@ do_debug_gdb_build() native_extra_config+=("--with-curses") fi - # Build a native gdbserver if needed. If building only - # gdbserver, configure in the subdirectory. - # Newer versions enable it automatically for a native target by default. - if [ "${CT_GDB_GDBSERVER}" != "y" ]; then - native_extra_config+=("--disable-gdbserver") + if [ "${CT_GDB_NATIVE_BUILD_IPA_LIB}" = "y" ]; then + native_extra_config+=("--enable-inprocess-agent") else - native_extra_config+=("--enable-gdbserver") - if [ "${CT_GDB_NATIVE}" != "y" ]; then - subdir=gdb/gdbserver/ - fi + native_extra_config+=("--disable-inprocess-agent") fi + + export ac_cv_func_strncmp_works=yes + + # TBD do we need all these? Eg why do we disable TUI if we build curses for target? + native_extra_config+=( + --without-uiout + --disable-tui + --disable-gdbtk + --without-x + --disable-sim + --without-included-gettext + --without-develop + --sysconfdir=/etc + --localstatedir=/var + ) + + # Target libexpat resides in sysroot and does not have + # any dependencies, so just passing '-lexpat' to gcc is enough. + # + # By default gdb configure looks for expat in '$prefix/lib' + # directory. In our case '$prefix/lib' resolves to '/usr/lib' + # 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. + extra_config+=("--with-expat") + extra_config+=("--without-libexpat-prefix") + + do_gdb_backend \ + buildtype=native \ + subdir=${subdir} \ + host="${CT_TARGET}" \ + cflags="${CT_ALL_TARGET_CFLAGS}" \ + ldflags="${CT_ALL_TARGET_LDFLAGS}" \ + static="${CT_GDB_NATIVE_STATIC}" \ + static_libstdc="${CT_GDB_NATIVE_STATIC_LIBSTDC}" \ + prefix=/usr \ + destdir="${CT_DEBUGROOT_DIR}" \ + "${native_extra_config[@]}" + + unset ac_cv_func_strncmp_works + + CT_Popd + CT_EndStep # native gdb build + fi + + if [ "${CT_GDB_GDBSERVER}" = "y" ]; then + local -a native_extra_config + local subdir + + if [ "${CT_GDB_GDBSERVER_TOPLEVEL}" != "y" ]; then + subdir=gdb/gdbserver/ + fi + + CT_DoStep INFO "Installing gdb server" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-gdb-server" + + native_extra_config+=("--program-prefix=") + native_extra_config+=("--enable-gdbserver") + if [ "${CT_GDB_NATIVE_BUILD_IPA_LIB}" = "y" ]; then native_extra_config+=("--enable-inprocess-agent") else @@ -149,7 +229,7 @@ do_debug_gdb_build() unset ac_cv_func_strncmp_works CT_Popd - CT_EndStep # native gdb build + CT_EndStep # gdb server build fi } @@ -208,25 +288,6 @@ do_gdb_backend() extra_config+=("--disable-nls") fi - # Target libexpat resides in sysroot and does not have - # any dependencies, so just passing '-lexpat' to gcc is enough. - # - # By default gdb configure looks for expat in '$prefix/lib' - # directory. In our case '$prefix/lib' resolves to '/usr/lib' - # 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. - extra_config+=("--with-expat") - extra_config+=("--without-libexpat-prefix") - if [ "${static}" = "y" ]; then cflags+=" -static" ldflags+=" -static" |