public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [v2 PATCH 0/1] Fix ld error due to '-shared' not support
@ 2021-12-23  6:19 jiawei
  2021-12-23  6:19 ` [v2 PATCH 1/1] Fix ld error due to -shared " jiawei
  2021-12-27 23:07 ` [v2 PATCH 0/1] Fix ld error due to '-shared' " Jim Wilson
  0 siblings, 2 replies; 4+ messages in thread
From: jiawei @ 2021-12-23  6:19 UTC (permalink / raw)
  To: binutils
  Cc: kito.cheng, nelson.chu, jim.wilson.gcc, palmer, cmuellner,
	philipp.tomsich, nick.alcock, lazyparser, sinan, shihua, yulong,
	jiawei

When target not support shared lib, these testcases peport error and not
work right. So add check condition in .exp to disable test when shared lib
not support.

V2: Thanks for Nelson Chu's comment! Merge all xfail cases into .exp
file to check.

jiawei (1):
  Fix ld error due to -shared not support.

 ld/testsuite/ld-ctf/ctf.exp    | 5 +++++
 ld/testsuite/ld-plugin/lto.exp | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

-- 
2.25.1


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

* [v2 PATCH 1/1] Fix ld error due to -shared not support.
  2021-12-23  6:19 [v2 PATCH 0/1] Fix ld error due to '-shared' not support jiawei
@ 2021-12-23  6:19 ` jiawei
  2021-12-27 23:07 ` [v2 PATCH 0/1] Fix ld error due to '-shared' " Jim Wilson
  1 sibling, 0 replies; 4+ messages in thread
From: jiawei @ 2021-12-23  6:19 UTC (permalink / raw)
  To: binutils
  Cc: kito.cheng, nelson.chu, jim.wilson.gcc, palmer, cmuellner,
	philipp.tomsich, nick.alcock, lazyparser, sinan, shihua, yulong,
	jiawei

ld/ChangeLog:

        * testsuite/ld-ctf/ctf.exp: Add shared lib check.
        * testsuite/ld-plugin/lto.exp: Add lto shared check.

---
 ld/testsuite/ld-ctf/ctf.exp    | 5 +++++
 ld/testsuite/ld-plugin/lto.exp | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ld/testsuite/ld-ctf/ctf.exp b/ld/testsuite/ld-ctf/ctf.exp
index 0e74d6c569c..7f540072bf9 100644
--- a/ld/testsuite/ld-ctf/ctf.exp
+++ b/ld/testsuite/ld-ctf/ctf.exp
@@ -28,6 +28,11 @@ if ![is_elf_format] {
     return 0
 }
 
+if ![check_shared_lib_support] {
+    unsupported "CTF needs shared lib support"
+    return 0
+}
+
 if {[info exists env(LC_ALL)]} {
     set old_lc_all $env(LC_ALL)
 }
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 51e01046a12..e63e7916531 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -233,7 +233,7 @@ set lto_link_tests [list \
    [list [list "nm" "$plug_opt" "pr26389.d"]]] \
 ]
 
-if { [at_least_gcc_version 10 0] } {
+if { [at_least_gcc_version 10 0] && [check_lto_shared_available] } {
     set lto_link_tests [concat $lto_link_tests [list \
 	[list "pr25355.o" \
 	 "" \
-- 
2.25.1


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

* Re: [v2 PATCH 0/1] Fix ld error due to '-shared' not support
  2021-12-23  6:19 [v2 PATCH 0/1] Fix ld error due to '-shared' not support jiawei
  2021-12-23  6:19 ` [v2 PATCH 1/1] Fix ld error due to -shared " jiawei
@ 2021-12-27 23:07 ` Jim Wilson
  2021-12-28  4:20   ` Nelson Chu
  1 sibling, 1 reply; 4+ messages in thread
From: Jim Wilson @ 2021-12-27 23:07 UTC (permalink / raw)
  To: jiawei
  Cc: binutils, Kito Cheng, Nelson Chu, Palmer Dabbelt, cmuellner,
	philipp.tomsich, nick.alcock, lazyparser, sinan, shihua, yulong

On Wed, Dec 22, 2021 at 10:20 PM jiawei <jiawei@iscas.ac.cn> wrote:

> jiawei (1):
>   Fix ld error due to -shared not support.
>
>  ld/testsuite/ld-ctf/ctf.exp    | 5 +++++
>  ld/testsuite/ld-plugin/lto.exp | 2 +-
>  2 files changed, 6 insertions(+), 1 deletion(-)
>

This looks OK to me.  I don't think --shared is required by the ctf
support, maybe adding that just made the tests easier to write.  Meanwhile,
since they all use --shared it is OK to add the check to verify that
--shared is supported.  And the lto.exp change is trivially correct also.

Another way to fix this is to add the missing newlib support we need to
make riscv*-elf shared library support work, and then we can enable the
linker shared library support for riscv*-elf.  The linker support is fine.
it is just that all --shared tests will fail because of the newlib problem,
which then leads to confusing ld testsuite results.  But fixing newlib is
more of a long term issue, and in the short term we should fix the ld
testsuite.

Jim

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

* Re: [v2 PATCH 0/1] Fix ld error due to '-shared' not support
  2021-12-27 23:07 ` [v2 PATCH 0/1] Fix ld error due to '-shared' " Jim Wilson
@ 2021-12-28  4:20   ` Nelson Chu
  0 siblings, 0 replies; 4+ messages in thread
From: Nelson Chu @ 2021-12-28  4:20 UTC (permalink / raw)
  To: Jim Wilson
  Cc: jiawei, Binutils, Kito Cheng, Palmer Dabbelt, cmuellner,
	Philipp Tomsich, Nick Alcock, Wei Wu (吴伟),
	sinan, shihua, yulong

On Tue, Dec 28, 2021 at 7:07 AM Jim Wilson <jim.wilson.gcc@gmail.com> wrote:
>
> On Wed, Dec 22, 2021 at 10:20 PM jiawei <jiawei@iscas.ac.cn> wrote:
>>
>> jiawei (1):
>>   Fix ld error due to -shared not support.
>>
>>  ld/testsuite/ld-ctf/ctf.exp    | 5 +++++
>>  ld/testsuite/ld-plugin/lto.exp | 2 +-
>>  2 files changed, 6 insertions(+), 1 deletion(-)
>
>
> This looks OK to me.  I don't think --shared is required by the ctf support, maybe adding that just made the tests easier to write.  Meanwhile, since they all use --shared it is OK to add the check to verify that --shared is supported.  And the lto.exp change is trivially correct also.

Thanks, committed.

> Another way to fix this is to add the missing newlib support we need to make riscv*-elf shared library support work, and then we can enable the linker shared library support for riscv*-elf.  The linker support is fine.  it is just that all --shared tests will fail because of the newlib problem, which then leads to confusing ld testsuite results.  But fixing newlib is more of a long term issue, and in the short term we should fix the ld testsuite.

Yeah, I remember we have similar pr in the sourceware that need to
support riscv shared newlib.
https://sourceware.org/bugzilla/show_bug.cgi?id=25527

Thanks
Nelson
>

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

end of thread, other threads:[~2021-12-28  4:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-23  6:19 [v2 PATCH 0/1] Fix ld error due to '-shared' not support jiawei
2021-12-23  6:19 ` [v2 PATCH 1/1] Fix ld error due to -shared " jiawei
2021-12-27 23:07 ` [v2 PATCH 0/1] Fix ld error due to '-shared' " Jim Wilson
2021-12-28  4:20   ` Nelson Chu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).