Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb/testsuite/gdb.threads: Make sure TLS tests link against pthreads.
@ 2013-06-07 18:41 Will Newton
  2013-06-11 23:39 ` Andrew Pinski
  2013-07-17 18:18 ` Tom Tromey
  0 siblings, 2 replies; 8+ messages in thread
From: Will Newton @ 2013-06-07 18:41 UTC (permalink / raw)
  To: gdb-patches; +Cc: patches


On Ubuntu the compiler passes --as-needed to the linker which means
no DT_NEEDED entry is added for libpthread when building the TLS
tests. This causes the test to fail as a libpthread is required to
look up TLS variables. Add some calls to pthread functions to make
sure libpthread is linked.

gdb/testsuite/ChangeLog:

2013-06-07  Will Newton  <will.newton@linaro.org>

	* gdb.threads/tls-nodebug.c: Call pthread_self to ensure
	the test is linked against pthreads.
	* gdb.threads/tls-var-main.c: Likewise.
	* gdb.threads/tls-shared.c: Call pthread_testcancel to
	ensure the test is linked against pthreads.
---
 gdb/testsuite/gdb.threads/tls-nodebug.c  | 2 +-
 gdb/testsuite/gdb.threads/tls-shared.c   | 4 ++++
 gdb/testsuite/gdb.threads/tls-var-main.c | 4 +++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.threads/tls-nodebug.c b/gdb/testsuite/gdb.threads/tls-nodebug.c
index 73d96f0..10aa8c8 100644
--- a/gdb/testsuite/gdb.threads/tls-nodebug.c
+++ b/gdb/testsuite/gdb.threads/tls-nodebug.c
@@ -6,5 +6,5 @@ __thread int thread_local = 42;

 int main(void)
 {
-  return 0;
+  return pthread_self();
 }
diff --git a/gdb/testsuite/gdb.threads/tls-shared.c b/gdb/testsuite/gdb.threads/tls-shared.c
index d4f8e5c..1ef7949 100644
--- a/gdb/testsuite/gdb.threads/tls-shared.c
+++ b/gdb/testsuite/gdb.threads/tls-shared.c
@@ -1,6 +1,10 @@
+
+#include <pthread.h>
+
 __thread int i_tls = 1;
 int foo ()
 {
+  pthread_testcancel();
   return i_tls;
 }

diff --git a/gdb/testsuite/gdb.threads/tls-var-main.c b/gdb/testsuite/gdb.threads/tls-var-main.c
index 34a2522..4728ea3 100644
--- a/gdb/testsuite/gdb.threads/tls-var-main.c
+++ b/gdb/testsuite/gdb.threads/tls-var-main.c
@@ -15,8 +15,10 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

+#include <pthread.h>
+
 int
 main (void)
 {
-  return 0;
+  return pthread_self();
 }
-- 
1.8.1.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-07-17 20:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-07 18:41 [PATCH] gdb/testsuite/gdb.threads: Make sure TLS tests link against pthreads Will Newton
2013-06-11 23:39 ` Andrew Pinski
2013-06-12 10:26   ` Will Newton
2013-06-12 11:57     ` Joel Brobecker
2013-07-17 18:16   ` Tom Tromey
2013-07-17 18:18 ` Tom Tromey
2013-07-17 19:05   ` Mark Kettenis
2013-07-17 20:17   ` Will Newton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox