2017-12-10 22:00:49 +00:00
|
|
|
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
2017-12-04 19:24:00 +00:00
|
|
|
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
|
Subject: gdb-6.5-sharedlibrary-path.patch
|
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
;; Fix TLS symbols resolving for shared libraries with a relative pathname.
|
|
|
|
;; The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'.
|
|
|
|
;;=fedoratest: One should recheck if it is really fixed upstream.
|
|
|
|
|
2006-09-21 13:07:53 +00:00
|
|
|
If you provided some relative path to the shared library, such as with
|
|
|
|
export LD_LIBRARY_PATH=.
|
|
|
|
then gdb would fail to match the shared library name during the TLS lookup.
|
|
|
|
|
2008-12-14 14:05:20 +00:00
|
|
|
Dropped the workaround/fix for gdb-6.8.50.20081128 - is it still needed?
|
|
|
|
|
2006-09-21 13:07:53 +00:00
|
|
|
The testsuite needs `gdb-6.3-bz146810-solib_absolute_prefix_is_empty.patch'.
|
|
|
|
The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'.
|
|
|
|
|
|
|
|
2006-09-01 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
|
|
|
|
* solib-svr4.c (svr4_fetch_objfile_link_map): Match even absolute
|
|
|
|
requested pathnames to the internal loaded relative pathnames.
|
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
|
2006-09-21 13:07:53 +00:00
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
Port to GDB-6.7.
|
|
|
|
|
2008-03-03 16:13:47 +00:00
|
|
|
2008-02-27 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
|
|
|
|
Port to gdb-6.7.50.20080227.
|
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-main.c b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
|
|
|
|
new file mode 100644
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
|
2021-03-26 18:40:18 +00:00
|
|
|
@@ -0,0 +1,31 @@
|
2006-09-21 13:07:53 +00:00
|
|
|
+/* This testcase is part of GDB, the GNU debugger.
|
|
|
|
+
|
|
|
|
+ Copyright 2006 Free Software Foundation, Inc.
|
|
|
|
+
|
|
|
|
+ This program is free software; you can redistribute it and/or modify
|
|
|
|
+ it under the terms of the GNU General Public License as published by
|
|
|
|
+ the Free Software Foundation; either version 2 of the License, or
|
|
|
|
+ (at your option) any later version.
|
|
|
|
+
|
|
|
|
+ This program is distributed in the hope that it will be useful,
|
|
|
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
+ GNU General Public License for more details.
|
2021-03-26 18:40:18 +00:00
|
|
|
+
|
2006-09-21 13:07:53 +00:00
|
|
|
+ You should have received a copy of the GNU General Public License
|
|
|
|
+ along with this program; if not, write to the Free Software
|
|
|
|
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
+
|
|
|
|
+ Please email any bugs, comments, and/or additions to this file to:
|
|
|
|
+ bug-gdb@prep.ai.mit.edu */
|
|
|
|
+
|
2021-03-26 18:40:18 +00:00
|
|
|
+#include <pthread.h>
|
|
|
|
+
|
|
|
|
+extern __thread int var;
|
|
|
|
+
|
2006-09-21 13:07:53 +00:00
|
|
|
+int main()
|
|
|
|
+{
|
2021-03-26 18:40:18 +00:00
|
|
|
+ /* Ensure we link against pthreads even with --as-needed. */
|
|
|
|
+ pthread_testcancel();
|
|
|
|
+ return var;
|
2006-09-21 13:07:53 +00:00
|
|
|
+}
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c b/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
|
|
|
|
new file mode 100644
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
|
2006-09-21 13:07:53 +00:00
|
|
|
@@ -0,0 +1,22 @@
|
|
|
|
+/* This testcase is part of GDB, the GNU debugger.
|
|
|
|
+
|
|
|
|
+ Copyright 2006 Free Software Foundation, Inc.
|
|
|
|
+
|
|
|
|
+ This program is free software; you can redistribute it and/or modify
|
|
|
|
+ it under the terms of the GNU General Public License as published by
|
|
|
|
+ the Free Software Foundation; either version 2 of the License, or
|
|
|
|
+ (at your option) any later version.
|
|
|
|
+
|
|
|
|
+ This program is distributed in the hope that it will be useful,
|
|
|
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
+ GNU General Public License for more details.
|
2021-03-26 18:40:18 +00:00
|
|
|
+
|
2006-09-21 13:07:53 +00:00
|
|
|
+ You should have received a copy of the GNU General Public License
|
|
|
|
+ along with this program; if not, write to the Free Software
|
|
|
|
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
+
|
|
|
|
+ Please email any bugs, comments, and/or additions to this file to:
|
|
|
|
+ bug-gdb@prep.ai.mit.edu */
|
|
|
|
+
|
|
|
|
+__thread int var = 42;
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug.exp b/gdb/testsuite/gdb.threads/tls-sepdebug.exp
|
|
|
|
new file mode 100644
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug.exp
|
2021-03-26 18:40:18 +00:00
|
|
|
@@ -0,0 +1,94 @@
|
2006-09-21 13:07:53 +00:00
|
|
|
+# Copyright 2006 Free Software Foundation, Inc.
|
|
|
|
+
|
|
|
|
+# This program is free software; you can redistribute it and/or modify
|
|
|
|
+# it under the terms of the GNU General Public License as published by
|
|
|
|
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
+# (at your option) any later version.
|
2021-03-26 18:40:18 +00:00
|
|
|
+#
|
2006-09-21 13:07:53 +00:00
|
|
|
+# This program is distributed in the hope that it will be useful,
|
|
|
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
+# GNU General Public License for more details.
|
2021-03-26 18:40:18 +00:00
|
|
|
+#
|
2006-09-21 13:07:53 +00:00
|
|
|
+# You should have received a copy of the GNU General Public License
|
|
|
|
+# along with this program; if not, write to the Free Software
|
2021-03-26 18:40:18 +00:00
|
|
|
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
+
|
|
|
|
+# This test uses gdb_exit and gdb_start, which are not supported
|
|
|
|
+# on non-extended-remote sessions.
|
|
|
|
+if {[use_gdb_stub]} {
|
|
|
|
+ untested "skipping test because of stub"
|
|
|
|
+ return 0
|
|
|
|
+}
|
2006-09-21 13:07:53 +00:00
|
|
|
+
|
|
|
|
+if $tracelevel then {
|
|
|
|
+ strace $tracelevel
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+set testfile tls-sepdebug
|
|
|
|
+set srcmainfile ${testfile}-main.c
|
|
|
|
+set srcsharedfile ${testfile}-shared.c
|
|
|
|
+
|
2016-02-16 09:54:56 +00:00
|
|
|
+set binmainfile [standard_output_file ${testfile}-main]
|
2009-02-11 00:04:48 +00:00
|
|
|
+set binsharedbase ${testfile}-shared.so
|
2016-02-16 09:54:56 +00:00
|
|
|
+set binsharedfile [standard_output_file ${binsharedbase}]
|
|
|
|
+set binshareddebugfile [standard_output_file ${binsharedbase}.debug]
|
2006-09-21 13:07:53 +00:00
|
|
|
+
|
2009-02-11 00:04:48 +00:00
|
|
|
+# Use explicit -soname as otherwise the full path to the library would get
|
|
|
|
+# encoded into ${binmainfile} making LD_LIBRARY_PATH tests useless.
|
2006-09-21 13:07:53 +00:00
|
|
|
+
|
2009-02-11 00:04:48 +00:00
|
|
|
+# FIXME: gcc dependency (-Wl,-soname).
|
|
|
|
+
|
|
|
|
+if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]] != "" } {
|
2006-09-21 13:07:53 +00:00
|
|
|
+ untested "Couldn't compile test library"
|
|
|
|
+ return -1
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+# eu-strip(1) works fine but it is a part of `elfutils', not `binutils'.
|
|
|
|
+if 0 then {
|
|
|
|
+ remote_exec build "eu-strip -f ${binshareddebugfile} ${binsharedfile}"
|
|
|
|
+} else {
|
|
|
|
+ remote_exec build "objcopy --only-keep-debug ${binsharedfile} ${binshareddebugfile}"
|
|
|
|
+ remote_exec build "objcopy --strip-debug ${binsharedfile}"
|
|
|
|
+ remote_exec build "objcopy --add-gnu-debuglink=${binshareddebugfile} ${binsharedfile}"
|
|
|
|
+}
|
|
|
|
+
|
2009-02-11 00:04:48 +00:00
|
|
|
+# Do not use `shlib=' as it will automatically add also -rpath for gcc.
|
|
|
|
+
|
|
|
|
+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcmainfile} ${binsharedfile}" "${binmainfile}" executable {debug}] != "" } {
|
2006-09-21 13:07:53 +00:00
|
|
|
+ untested "Couldn't compile test program"
|
|
|
|
+ return -1
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+# Get things started.
|
|
|
|
+
|
|
|
|
+# Test also the proper resolving of relative library names to absolute ones.
|
|
|
|
+# \$PWD is easy - it is the absolute way
|
|
|
|
+# ${subdir} would fail on "print var"
|
|
|
|
+
|
2016-02-16 09:54:56 +00:00
|
|
|
+set absdir [file dirname [standard_output_file ${binsharedbase}]]
|
|
|
|
+foreach ld_library_path [list $absdir [relative_filename [pwd] $absdir]] name { absolute relative } {
|
2006-09-21 13:07:53 +00:00
|
|
|
+
|
|
|
|
+ gdb_exit
|
|
|
|
+ gdb_start
|
|
|
|
+ ###gdb_reinitialize_dir $srcdir/$subdir
|
2021-03-26 18:40:18 +00:00
|
|
|
+
|
2006-09-21 13:07:53 +00:00
|
|
|
+ gdb_test "set env LD_LIBRARY_PATH=$ld_library_path" \
|
|
|
|
+ "" \
|
|
|
|
+ "set env LD_LIBRARY_PATH is $name"
|
2021-03-26 18:40:18 +00:00
|
|
|
+
|
2006-09-21 13:07:53 +00:00
|
|
|
+ gdb_load ${binmainfile}
|
2021-03-26 18:40:18 +00:00
|
|
|
+
|
2006-09-21 13:07:53 +00:00
|
|
|
+ # For C programs, "start" should stop in main().
|
2021-03-26 18:40:18 +00:00
|
|
|
+
|
2006-09-21 13:07:53 +00:00
|
|
|
+ gdb_test "start" \
|
|
|
|
+ "main \\(\\) at .*${srcmainfile}.*" \
|
|
|
|
+ "start"
|
2021-03-26 18:40:18 +00:00
|
|
|
+
|
2006-09-21 13:07:53 +00:00
|
|
|
+ # Check for: Cannot find shared library `/usr/lib/debug/lib/libc-2.4.90.so.debug' in dynamic linker's load module list
|
|
|
|
+ # as happens with TLS variables and `separate_debug_objfile_backlink'.
|
2021-03-26 18:40:18 +00:00
|
|
|
+
|
2006-09-21 13:07:53 +00:00
|
|
|
+ gdb_test "print var" \
|
|
|
|
+ "\\\$1 = \[0-9\].*" \
|
|
|
|
+ "print TLS variable from a shared library with $name-directory separate debug info file"
|
|
|
|
+}
|