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