Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: Yao Qi <qiyaoltc@gmail.com>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH] [testsuite] Pass -lpthread in libs
Date: Fri, 17 Nov 2017 16:54:00 -0000	[thread overview]
Message-ID: <a6ce31ba-d802-653a-c7bf-cfd162d4053b@ericsson.com> (raw)
In-Reply-To: <1510932166-11816-1-git-send-email-yao.qi@linaro.org>

On 2017-11-17 10:22 AM, Yao Qi wrote:
> "libs" is the right flag to pass a library to a linker, instead of
> additional_flags.  Without this patch, the test case can't be complied
> by clang.
> 
> gdb compile failed, clang: warning: -lpthread: 'linker' input unused
> 
> gdb/testsuite:
> 
> 2017-11-17  Yao Qi  <yao.qi@linaro.org>
> 
> 	* gdb.base/info-os.exp: Pass -lpthread in libs.
> 	* gdb.multi/multi-attach.exp: Likewise.
> ---
>  gdb/testsuite/gdb.base/info-os.exp       | 2 +-
>  gdb/testsuite/gdb.multi/multi-attach.exp | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.base/info-os.exp b/gdb/testsuite/gdb.base/info-os.exp
> index 574da26..b3109e1 100644
> --- a/gdb/testsuite/gdb.base/info-os.exp
> +++ b/gdb/testsuite/gdb.base/info-os.exp
> @@ -28,7 +28,7 @@ if [gdb_skip_xml_test] then {
>  }
>  
>  # Compile test program.
> -if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug additional_flags=-lpthread}] } {
> +if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug libs=-lpthread}] } {
>      fail "cannot compile test program"
>      return -1
>  }
> diff --git a/gdb/testsuite/gdb.multi/multi-attach.exp b/gdb/testsuite/gdb.multi/multi-attach.exp
> index 9397f85..52acc91 100644
> --- a/gdb/testsuite/gdb.multi/multi-attach.exp
> +++ b/gdb/testsuite/gdb.multi/multi-attach.exp
> @@ -23,7 +23,7 @@ if {![can_spawn_for_attach]} {
>      return 0
>  }
>  
> -if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug additional_flags=-lpthread}]} {
> +if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug libs=-lpthread}]} {
>      return -1
>  }
>  
> 

Hi Yao,

I am seeing:

  gdb compile failed, .../info-os.c:51:1: warning: control reaches end of non-void function [-Wreturn-type]

with clang-6.0.  Once I fix it, the test passes for me.

Instead of passing -lpthread directly, it would probably be better to pass the
"pthreads" option, like this:

diff --git a/gdb/testsuite/gdb.base/info-os.exp b/gdb/testsuite/gdb.base/info-os.exp
index 574da26..3267eec 100644
--- a/gdb/testsuite/gdb.base/info-os.exp
+++ b/gdb/testsuite/gdb.base/info-os.exp
@@ -28,7 +28,7 @@ if [gdb_skip_xml_test] then {
 }

 # Compile test program.
-if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug additional_flags=-lpthread}] } {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] } {
     fail "cannot compile test program"
     return -1
 }

build_executable_from_specs eventually converts that into a call to gdb_compile_pthreads,
which then chooses the right linker flag based on the platform.  So it's a bit more portable.

Simon



  reply	other threads:[~2017-11-17 16:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-17 15:22 Yao Qi
2017-11-17 16:54 ` Simon Marchi [this message]
2017-11-22 15:17   ` Yao Qi
2017-11-22 15:30     ` Simon Marchi
2017-11-22 16:52       ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a6ce31ba-d802-653a-c7bf-cfd162d4053b@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox