From patchwork Fri Jul 15 14:16:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 2715 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id C754B23F55 for ; Fri, 15 Jul 2011 14:16:34 +0000 (UTC) Received: from mail-qw0-f52.google.com (mail-qw0-f52.google.com [209.85.216.52]) by fiordland.canonical.com (Postfix) with ESMTP id 7D4A5A18793 for ; Fri, 15 Jul 2011 14:16:34 +0000 (UTC) Received: by qwb8 with SMTP id 8so876846qwb.11 for ; Fri, 15 Jul 2011 07:16:34 -0700 (PDT) Received: by 10.229.25.212 with SMTP id a20mr2715707qcc.148.1310739393906; Fri, 15 Jul 2011 07:16:33 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.217.78 with SMTP id hl14cs49401qcb; Fri, 15 Jul 2011 07:16:33 -0700 (PDT) Received: by 10.227.200.198 with SMTP id ex6mr3080184wbb.73.1310739392768; Fri, 15 Jul 2011 07:16:32 -0700 (PDT) Received: from mtagate1.uk.ibm.com (mtagate1.uk.ibm.com [194.196.100.161]) by mx.google.com with ESMTPS id fq12si2815792wbb.39.2011.07.15.07.16.32 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 15 Jul 2011 07:16:32 -0700 (PDT) Received-SPF: pass (google.com: domain of uweigand@de.ibm.com designates 194.196.100.161 as permitted sender) client-ip=194.196.100.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of uweigand@de.ibm.com designates 194.196.100.161 as permitted sender) smtp.mail=uweigand@de.ibm.com Received: from d06nrmr1307.portsmouth.uk.ibm.com (d06nrmr1307.portsmouth.uk.ibm.com [9.149.38.129]) by mtagate1.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p6FEGV43010586 for ; Fri, 15 Jul 2011 14:16:31 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p6FEGV292506862 for ; Fri, 15 Jul 2011 15:16:31 +0100 Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p6FEGVKA004191 for ; Fri, 15 Jul 2011 08:16:31 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id p6FEGUJF004156 for ; Fri, 15 Jul 2011 08:16:30 -0600 Message-Id: <201107151416.p6FEGUJF004156@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Fri, 15 Jul 2011 16:16:30 +0200 Subject: [rfc] Fix tls-shared.exp remote test (fwd) To: patches@linaro.org Date: Fri, 15 Jul 2011 16:16:30 +0200 (CEST) From: "Ulrich Weigand" X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 http://sourceware.org/ml/gdb-patches/2011-07/msg00242.html ChangeLog: * lib/gdb.exp (gdb_compile_shlib_pthreads): New helper. * gdb.threads/tls-shared.exp: Use it. Call gdb_load_shlibs. Index: gdb/testsuite/gdb.threads/tls-shared.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/tls-shared.exp,v retrieving revision 1.10 diff -u -p -r1.10 tls-shared.exp --- gdb/testsuite/gdb.threads/tls-shared.exp 1 Jan 2011 15:33:50 -0000 1.10 +++ gdb/testsuite/gdb.threads/tls-shared.exp 7 Jul 2011 13:20:30 -0000 @@ -24,6 +24,8 @@ set testfile tls-main set libfile tls-shared set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} +set srcfile_lib ${libfile}.c +set binfile_lib ${objdir}/${subdir}/${libfile}.so remote_exec build "rm -f ${binfile}" @@ -32,48 +34,9 @@ if [get_compiler_info ${binfile}] { return -1 } -if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}.o" object {debug}] != "" } { - return -1 -} - -# Build the shared libraries this test case needs. -# - -if {$gcc_compiled == 0} { - if [istarget "hppa*-hp-hpux*"] then { - set additional_flags "additional_flags=+z" - } elseif { [istarget "mips-sgi-irix*"] } { - # Disable SGI compiler's implicit -Dsgi - set additional_flags "additional_flags=-Usgi" - } else { - # don't know what the compiler is... - set additional_flags "" - } -} else { - if { ([istarget "powerpc*-*-aix*"] - || [istarget "rs6000*-*-aix*"]) } { - set additional_flags "" - } else { - set additional_flags "additional_flags=-fpic" - } -} - -set additional_flags "$additional_flags -shared" -if {[gdb_compile_pthreads "${srcdir}/${subdir}/${libfile}.c" "${objdir}/${subdir}/${libfile}.so" executable [list debug $additional_flags "incdir=${objdir}"]] != ""} { - return -1 -} - -if { ($gcc_compiled -&& ([istarget "powerpc*-*-aix*"] -|| [istarget "rs6000*-*-aix*"] )) } { - set additional_flags "additional_flags=-L${objdir}/${subdir}" -} elseif { [istarget "mips-sgi-irix*"] } { - set additional_flags "additional_flags=-rpath ${objdir}/${subdir}" -} else { - set additional_flags "" -} -if {[gdb_compile_pthreads "${objdir}/${subdir}/${testfile}.o ${objdir}/${subdir}/${libfile}.so" "${binfile}" executable [list debug $additional_flags]] != ""} { +if { [gdb_compile_shlib_pthreads ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} {debug}] != "" + || [gdb_compile_pthreads ${srcdir}/${subdir}/${srcfile} ${binfile} executable [list debug shlib=${binfile_lib}]] != ""} { return -1 } @@ -82,6 +45,7 @@ gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} +gdb_load_shlibs ${binfile_lib} if ![runto_main] then { fail "Can't run to main" Index: gdb/testsuite/lib/gdb.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v retrieving revision 1.182 diff -u -p -r1.182 gdb.exp --- gdb/testsuite/lib/gdb.exp 1 Jul 2011 00:19:25 -0000 1.182 +++ gdb/testsuite/lib/gdb.exp 7 Jul 2011 13:20:31 -0000 @@ -2391,6 +2401,41 @@ proc gdb_compile_shlib {sources dest opt } } +# This is just like gdb_compile_shlib, above, except that it tries compiling +# against several different thread libraries, to see which one this +# system has. +proc gdb_compile_shlib_pthreads {sources dest options} { + set built_binfile 0 + set why_msg "unrecognized error" + foreach lib {-lpthreads -lpthread -lthread ""} { + # This kind of wipes out whatever libs the caller may have + # set. Or maybe theirs will override ours. How infelicitous. + set options_with_lib [concat $options [list libs=$lib quiet]] + set ccout [gdb_compile_shlib $sources $dest $options_with_lib] + switch -regexp -- $ccout { + ".*no posix threads support.*" { + set why_msg "missing threads include file" + break + } + ".*cannot open -lpthread.*" { + set why_msg "missing runtime threads library" + } + ".*Can't find library for -lpthread.*" { + set why_msg "missing runtime threads library" + } + {^$} { + pass "successfully compiled posix threads test case" + set built_binfile 1 + break + } + } + } + if {!$built_binfile} { + unsupported "Couldn't compile $sources: ${why_msg}" + return -1 + } +} + # This is just like gdb_compile_pthreads, above, except that we always add the # objc library for compiling Objective-C programs proc gdb_compile_objc {source dest type options} {