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