From: Will Newton Date: Thu, 18 Jul 2013 15:49:22 +0000 (+0000) Subject: gdb/testsuite/gdb.threads: Ensure TLS tests link against pthreads. X-Git-Tag: sid-snapshot-20130801~111 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=623cc2854011a4ffa83755d7ce9a9e078fa7ec80;p=thirdparty%2Fbinutils-gdb.git gdb/testsuite/gdb.threads: Ensure TLS tests link against pthreads. On Ubuntu by default the compiler passes --as-needed to ld which means no DT_NEEDED entry is added for libpthread when building the TLS tests. This causes the test to fail as libpthread is required to look up TLS variables. Add calls to pthread_testcancel to make sure libpthread gets linked. gdb/testsuite/ChangeLog: 2013-07-18 Will Newton * gdb.threads/tls-nodebug.c: Call pthread_testcancel to ensure the test is linked against pthreads. * gdb.threads/tls-var-main.c: Likewise. * gdb.threads/tls-shared.c: Likewise. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 47b7f6bcbf4..473c326add6 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2013-07-18 Will Newton + + * gdb.threads/tls-nodebug.c: Call pthread_testcancel + to ensure the test is linked against pthreads. + * gdb.threads/tls-var-main.c: Likewise. + * gdb.threads/tls-shared.c: Likewise. + 2013-07-18 Yao Qi * lib/future.exp (gdb_default_target_compile): Use tail name diff --git a/gdb/testsuite/gdb.threads/tls-nodebug.c b/gdb/testsuite/gdb.threads/tls-nodebug.c index 73d96f0f3cd..d3b31b7609c 100644 --- a/gdb/testsuite/gdb.threads/tls-nodebug.c +++ b/gdb/testsuite/gdb.threads/tls-nodebug.c @@ -6,5 +6,7 @@ __thread int thread_local = 42; int main(void) { + /* Ensure we link against pthreads even with --as-needed. */ + pthread_testcancel(); return 0; } diff --git a/gdb/testsuite/gdb.threads/tls-shared.c b/gdb/testsuite/gdb.threads/tls-shared.c index d4f8e5cc6e0..02b13083ab9 100644 --- a/gdb/testsuite/gdb.threads/tls-shared.c +++ b/gdb/testsuite/gdb.threads/tls-shared.c @@ -1,6 +1,11 @@ + +#include + __thread int i_tls = 1; int foo () { + /* Ensure we link against pthreads even with --as-needed. */ + 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 34a25227065..afad94539f1 100644 --- a/gdb/testsuite/gdb.threads/tls-var-main.c +++ b/gdb/testsuite/gdb.threads/tls-var-main.c @@ -15,8 +15,12 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include + int main (void) { + /* Ensure we link against pthreads even with --as-needed. */ + pthread_testcancel(); return 0; }