Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] [testsuite] Pass -lpthread in libs
@ 2017-11-17 15:22 Yao Qi
  2017-11-17 16:54 ` Simon Marchi
  0 siblings, 1 reply; 5+ messages in thread
From: Yao Qi @ 2017-11-17 15:22 UTC (permalink / raw)
  To: gdb-patches

"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
 }
 
-- 
1.9.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] [testsuite] Pass -lpthread in libs
  2017-11-17 15:22 [PATCH] [testsuite] Pass -lpthread in libs Yao Qi
@ 2017-11-17 16:54 ` Simon Marchi
  2017-11-22 15:17   ` Yao Qi
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2017-11-17 16:54 UTC (permalink / raw)
  To: Yao Qi, gdb-patches

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] [testsuite] Pass -lpthread in libs
  2017-11-17 16:54 ` Simon Marchi
@ 2017-11-22 15:17   ` Yao Qi
  2017-11-22 15:30     ` Simon Marchi
  0 siblings, 1 reply; 5+ messages in thread
From: Yao Qi @ 2017-11-22 15:17 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches

Simon Marchi <simon.marchi@ericsson.com> writes:

> 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.

Yes, it is another patch in my tree, to be posted.

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

OK, how about the patch below?

-- 
Yao (齐尧)

From c7392e6f937bf342daee99dfd5bcc6daf91af417 Mon Sep 17 00:00:00 2001
From: Yao Qi <yao.qi@linaro.org>
Date: Fri, 17 Nov 2017 13:04:10 +0000
Subject: [PATCH] [testsuite] Pass pthreads in prepare_for_testing

"pthreads" in the right flag to pass in prepare_for_testing to 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-22  Yao Qi  <yao.qi@linaro.org>

	* gdb.base/info-os.exp: Pass pthreads.
	* gdb.multi/multi-attach.exp: Likewise.

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
 }
diff --git a/gdb/testsuite/gdb.multi/multi-attach.exp b/gdb/testsuite/gdb.multi/multi-attach.exp
index 9397f85..0e54b4f 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 pthreads}]} {
     return -1
 }
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] [testsuite] Pass -lpthread in libs
  2017-11-22 15:17   ` Yao Qi
@ 2017-11-22 15:30     ` Simon Marchi
  2017-11-22 16:52       ` Yao Qi
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2017-11-22 15:30 UTC (permalink / raw)
  To: Yao Qi; +Cc: Simon Marchi, gdb-patches

On 2017-11-22 10:17, Yao Qi wrote:
> Simon Marchi <simon.marchi@ericsson.com> writes:
> 
>> 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.
> 
> Yes, it is another patch in my tree, to be posted.
> 
>> 
>> Instead of passing -lpthread directly, it would probably be better to 
>> pass the
>> "pthreads" option, like this:
> 
> OK, how about the patch below?
> 
> --
> Yao (齐尧)
> 
> From c7392e6f937bf342daee99dfd5bcc6daf91af417 Mon Sep 17 00:00:00 2001
> From: Yao Qi <yao.qi@linaro.org>
> Date: Fri, 17 Nov 2017 13:04:10 +0000
> Subject: [PATCH] [testsuite] Pass pthreads in prepare_for_testing
> 
> "pthreads" in the right flag to pass in prepare_for_testing to 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-22  Yao Qi  <yao.qi@linaro.org>
> 
> 	* gdb.base/info-os.exp: Pass pthreads.
> 	* gdb.multi/multi-attach.exp: Likewise.
> 
> 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
>  }
> diff --git a/gdb/testsuite/gdb.multi/multi-attach.exp
> b/gdb/testsuite/gdb.multi/multi-attach.exp
> index 9397f85..0e54b4f 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 pthreads}]} {
>      return -1
>  }

LGTM.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] [testsuite] Pass -lpthread in libs
  2017-11-22 15:30     ` Simon Marchi
@ 2017-11-22 16:52       ` Yao Qi
  0 siblings, 0 replies; 5+ messages in thread
From: Yao Qi @ 2017-11-22 16:52 UTC (permalink / raw)
  To: Simon Marchi; +Cc: Simon Marchi, gdb-patches

Simon Marchi <simon.marchi@polymtl.ca> writes:

> LGTM.

I pushed it in.

-- 
Yao (齐尧)


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-22 16:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-17 15:22 [PATCH] [testsuite] Pass -lpthread in libs Yao Qi
2017-11-17 16:54 ` Simon Marchi
2017-11-22 15:17   ` Yao Qi
2017-11-22 15:30     ` Simon Marchi
2017-11-22 16:52       ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox