* gdb-testsuite-fix-gdb.arch-amd64-stap-three-arg-disp.s.patch * gdb-testsuite-fix-xfail-handling-in-gdb.threads-gcore-thread.exp.patch * gdb-threads-fix-lin_thread_get_thread_signals-for-glibc-2.28.patch - Fix libthread_db problem on Factory [swo#27526, boo#1184214]: * gdb-try-to-load-libthread_db-only-after-reading-all-shared-libraries-when-attaching.patch - Workaround libncurses pulling in libpcre2_posix: * gdb-build-workaround-pcre2_posix-linking-problem.patch OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=271
118 lines
3.3 KiB
Diff
118 lines
3.3 KiB
Diff
[gdb/build] Workaround pcre2_posix linking problem
|
|
|
|
On openSUSE Tumbleweed, the ncurses package got the --with-pcre2 configure
|
|
switch enabled, and solved the resulting dependencies using:
|
|
...
|
|
$ cat /usr/lib64/libncursesw.so
|
|
/* GNU ld script */
|
|
-INPUT(/lib64/libncursesw.so.6 AS_NEEDED(-ltinfo -ldl))
|
|
+INPUT(/lib64/libncursesw.so.6 AS_NEEDED(-ltinfo -ldl -lpcre2-posix -lpcre2-8))
|
|
...
|
|
|
|
GDB uses the regexp functions regcomp, regerror, regfree, regexec and re_search, see
|
|
gdb_regex.c. The latter is a GNU extension.
|
|
|
|
Due to the changes mentioned above, the first four functions got bound to
|
|
lpcre2-posix, while re_search still got bound to lc, resulting in all sorts of
|
|
trouble, like hangs or:
|
|
...
|
|
$ gdb -q -batch -ex "apropos apropos"
|
|
Aborted (core dumped)
|
|
...
|
|
|
|
There is a debate whether it's legal to use re_search in combination with regcomp.
|
|
|
|
Either way, the immediate problem can be fixed/worked-around by adding -lc
|
|
before @LIBS@ in the CLIBS def in Makefile.in.
|
|
|
|
This is something that works with clang++, though not with g++, which drops
|
|
-lc, see PR gcc/99896. For g++, we can work around this by using -Wl,-lc
|
|
instead.
|
|
|
|
Add -lc before @LIBS@ in CLIBS def.
|
|
|
|
Tested on x86_64-linux.
|
|
|
|
gdb/ChangeLog:
|
|
|
|
2021-04-06 Tom de Vries <tdevries@suse.de>
|
|
|
|
PR build/27681
|
|
* Makefile.in (CDEFS): Add @LIBC@ before @LIBS@.
|
|
* configure.ac: Define LIBC.
|
|
* configure: Regenerate.
|
|
|
|
---
|
|
gdb/Makefile.in | 5 +++--
|
|
gdb/configure | 11 +++++++++++
|
|
gdb/configure.ac | 8 ++++++++
|
|
3 files changed, 22 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
|
|
index 4808357e651..31a1009dd6d 100644
|
|
--- a/gdb/Makefile.in
|
|
+++ b/gdb/Makefile.in
|
|
@@ -620,11 +620,12 @@ INTERNAL_LDFLAGS = \
|
|
|
|
# Libraries and corresponding dependencies for compiling gdb.
|
|
# XM_CLIBS, defined in *config files, have host-dependent libs.
|
|
-# LIBIBERTY appears twice on purpose.
|
|
+# LIBIBERTY appears twice on purpose. LIBC is added before
|
|
+# LIBS to ensure that all functions in gdb_regex.c bind to libc.
|
|
CLIBS = $(SIM) $(READLINE) $(OPCODES) $(LIBCTF) $(BFD) $(ZLIB) \
|
|
$(LIBSUPPORT) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \
|
|
$(XM_CLIBS) $(GDBTKLIBS) \
|
|
- @LIBS@ @GUILE_LIBS@ @PYTHON_LIBS@ \
|
|
+ @LIBC@ @LIBS@ @GUILE_LIBS@ @PYTHON_LIBS@ \
|
|
$(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) $(LIBIPT) \
|
|
$(WIN32LIBS) $(LIBGNU) $(LIBICONV) \
|
|
$(LIBMPFR) $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS) \
|
|
diff --git a/gdb/configure b/gdb/configure
|
|
index e7811e807a6..4a8bf5cc78e 100755
|
|
--- a/gdb/configure
|
|
+++ b/gdb/configure
|
|
@@ -728,6 +728,7 @@ HAVE_PYTHON_TRUE
|
|
PYTHON_LIBS
|
|
PYTHON_CPPFLAGS
|
|
PYTHON_CFLAGS
|
|
+LIBC
|
|
python_prog_path
|
|
LTLIBMPFR
|
|
LIBMPFR
|
|
@@ -10983,6 +10984,16 @@ _ACEOF
|
|
fi
|
|
fi
|
|
|
|
+if test "${GCC}" = yes; then
|
|
+ # G++ drops -lc, so wrap it using -Wl. See PR gcc/99896.
|
|
+ GCC_LIBC="-Wl,-lc"
|
|
+ LIBC=$GCC_LIBC
|
|
+
|
|
+else
|
|
+ LIBC=-lc
|
|
+
|
|
+fi
|
|
+
|
|
|
|
# Check whether --with-python-libdir was given.
|
|
if test "${with_python_libdir+set}" = set; then :
|
|
diff --git a/gdb/configure.ac b/gdb/configure.ac
|
|
index 620ae23e343..5bf44beb63a 100644
|
|
--- a/gdb/configure.ac
|
|
+++ b/gdb/configure.ac
|
|
@@ -891,6 +891,14 @@ else
|
|
fi
|
|
fi
|
|
|
|
+if test "${GCC}" = yes; then
|
|
+ # G++ drops -lc, so wrap it using -Wl. See PR gcc/99896.
|
|
+ GCC_LIBC="-Wl,-lc"
|
|
+ AC_SUBST(LIBC, $GCC_LIBC)
|
|
+else
|
|
+ AC_SUBST(LIBC, -lc)
|
|
+fi
|
|
+
|
|
dnl Use --with-python-libdir to control where GDB looks for the Python
|
|
dnl libraries.
|
|
dnl
|