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  <will.newton@linaro.org>

	* 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.
This commit is contained in:
Will Newton 2013-07-18 15:49:22 +00:00
parent 39b0730382
commit 623cc28540
4 changed files with 18 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2013-07-18 Will Newton <will.newton@linaro.org>
* 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 <yao@codesourcery.com>
* lib/future.exp (gdb_default_target_compile): Use tail name

View File

@ -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;
}

View File

@ -1,6 +1,11 @@
#include <pthread.h>
__thread int i_tls = 1;
int foo ()
{
/* Ensure we link against pthreads even with --as-needed. */
pthread_testcancel();
return i_tls;
}

View File

@ -15,8 +15,12 @@
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)
{
/* Ensure we link against pthreads even with --as-needed. */
pthread_testcancel();
return 0;
}