From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7821 invoked by alias); 11 Jun 2013 23:02:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 7798 invoked by uid 89); 11 Jun 2013 23:02:36 -0000 X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,SPF_PASS autolearn=ham version=3.3.1 Received: from mail-ve0-f179.google.com (HELO mail-ve0-f179.google.com) (209.85.128.179) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 11 Jun 2013 23:02:35 +0000 Received: by mail-ve0-f179.google.com with SMTP id d10so6122631vea.24 for ; Tue, 11 Jun 2013 16:02:34 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.52.166.46 with SMTP id zd14mr7626710vdb.0.1370991754175; Tue, 11 Jun 2013 16:02:34 -0700 (PDT) Received: by 10.58.219.6 with HTTP; Tue, 11 Jun 2013 16:02:34 -0700 (PDT) In-Reply-To: <51B22910.7010208@linaro.org> References: <51B22910.7010208@linaro.org> Date: Tue, 11 Jun 2013 23:39:00 -0000 Message-ID: Subject: Re: [PATCH] gdb/testsuite/gdb.threads: Make sure TLS tests link against pthreads. From: Andrew Pinski To: Will Newton Cc: "gdb-patches@sourceware.org" , Patch Tracking Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2013-06/txt/msg00266.txt.bz2 On Fri, Jun 7, 2013 at 11:40 AM, Will Newton wrote: > > 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. I think this should be an debian/Ubuntu local only patch as the default for FSF GCC/binutils is not to pass --as-needed. Thanks, Andrew > > gdb/testsuite/ChangeLog: > > 2013-06-07 Will Newton > > * 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 > + > __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 . */ > > +#include > + > int > main (void) > { > - return 0; > + return pthread_self(); > } > -- > 1.8.1.4 >