public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Enable shared lib tests for frv, lm32, m32r, microblaze, nds32 and or1k
@ 2017-12-06  7:26 Alan Modra
  2017-12-06 10:04 ` Nick Clifton
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Modra @ 2017-12-06  7:26 UTC (permalink / raw)
  To: binutils

These claim to support shared libs when configuring for <target>-linux
(in contrast to <target>-elf which doesn't support shared libs).

	* testsuite/lib/ld-lib.exp (check_shared_lib_support): Return true
	for frv, lm32, m32r, microblaze, nds32 and or1k linux targets.

diff --git a/ld/ChangeLog b/ld/ChangeLog
index 179d229..c5f1486 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2017-12-06  Alan Modra  <amodra@gmail.com>
+
+	* testsuite/lib/ld-lib.exp (check_shared_lib_support): Return true
+	for frv, lm32, m32r, microblaze, nds32 and or1k linux targets.
+
 2017-12-05  Jim Wilson  <jimw@sifive.com>
 	    Andrew Waterman  <andrew@sifive.com>
 
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index c240410..ecac87f 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1797,30 +1797,30 @@ proc check_shared_lib_support { } {
 	 && ![istarget dlx-*-*]
 	 && ![istarget epiphany-*-*]
 	 && ![istarget fr30-*-*]
-	 && ![istarget frv-*-*]
+	 && ![istarget frv-*-elf]
 	 && ![istarget ft32-*-*]
 	 && ![istarget h8300-*-*]
 	 && ![istarget i860-*-*]
 	 && ![istarget i960-*-*]
 	 && ![istarget ip2k-*-*]
 	 && ![istarget iq2000-*-*]
-	 && ![istarget lm32-*-*]
+	 && ![istarget lm32-*-elf]
 	 && ![istarget m32c-*-*]
-	 && ![istarget m32r-*-*]
+	 && ![istarget m32r-*-elf]
 	 && ![istarget m6811-*-*]
 	 && ![istarget m6812-*-*]
 	 && ![istarget m68hc1*-*-*]
 	 && ![istarget mcore*-*-*]
 	 && ![istarget mep-*-*]
-	 && ![istarget microblaze-*-*]
+	 && ![istarget microblaze-*-elf]
 	 && ![istarget mips*-*-elf]
 	 && ![istarget mn10200-*-*]
 	 && ![istarget moxie-*-*]
 	 && ![istarget msp430-*-*]
 	 && ![istarget mt-*-*]
-	 && ![istarget nds32*-*-*]
+	 && ![istarget nds32*-*-elf]
 	 && ![istarget nios2-*-elf]
-	 && ![istarget or1k*-*-*]
+	 && ![istarget or1k*-*-elf]
 	 && ![istarget pj-*-*]
 	 && ![istarget pru-*-*]
 	 && ![istarget rl78-*-*]

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: Enable shared lib tests for frv, lm32, m32r, microblaze, nds32 and or1k
  2017-12-06  7:26 Enable shared lib tests for frv, lm32, m32r, microblaze, nds32 and or1k Alan Modra
@ 2017-12-06 10:04 ` Nick Clifton
  2017-12-07  9:50   ` Alan Modra
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Clifton @ 2017-12-06 10:04 UTC (permalink / raw)
  To: Alan Modra, binutils

Hi Alan,

> +	* testsuite/lib/ld-lib.exp (check_shared_lib_support): Return true
> +	for frv, lm32, m32r, microblaze, nds32 and or1k linux targets.

> -	 && ![istarget lm32-*-*]
> +	 && ![istarget lm32-*-elf]

This introduced a whole slew of new failures when I tested a lm32-rtems4.10 
toolchain so I have checked in a little fix for this target:

Cheers
  Nick

ld/ChangeLog
2017-12-06  Nick Clifton  <nickc@redhat.com>

	* testsuite/lib/ld-lib.exp (check_shared_lib_support): Return
	false for lm32-rtems targets.

diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index ecac87f766..280a7b1e97 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1805,6 +1805,7 @@ proc check_shared_lib_support { } {
         && ![istarget ip2k-*-*]
         && ![istarget iq2000-*-*]
         && ![istarget lm32-*-elf]
+        && ![istarget lm32-*-rtems*]
         && ![istarget m32c-*-*]
         && ![istarget m32r-*-elf]
         && ![istarget m6811-*-*]

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

* Re: Enable shared lib tests for frv, lm32, m32r, microblaze, nds32 and or1k
  2017-12-06 10:04 ` Nick Clifton
@ 2017-12-07  9:50   ` Alan Modra
  2017-12-07 10:37     ` Alan Modra
  2017-12-08 18:06     ` Kyrill Tkachov
  0 siblings, 2 replies; 7+ messages in thread
From: Alan Modra @ 2017-12-07  9:50 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

On Wed, Dec 06, 2017 at 10:04:37AM +0000, Nick Clifton wrote:
> Hi Alan,
> 
> > +	* testsuite/lib/ld-lib.exp (check_shared_lib_support): Return true
> > +	for frv, lm32, m32r, microblaze, nds32 and or1k linux targets.
> 
> > -	 && ![istarget lm32-*-*]
> > +	 && ![istarget lm32-*-elf]
> 
> This introduced a whole slew of new failures when I tested a lm32-rtems4.10 
> toolchain so I have checked in a little fix for this target:
> 
> Cheers
>   Nick
> 
> ld/ChangeLog
> 2017-12-06  Nick Clifton  <nickc@redhat.com>
> 
> 	* testsuite/lib/ld-lib.exp (check_shared_lib_support): Return
> 	false for lm32-rtems targets.

Yes, I looked at that function and noticed it wasn't really doing the
right thing.  I should have been a little less lazy and rewritten it.

	* testsuite/lib/ld-lib.exp (check_shared_lib_support): Ask ld
	under test whether -shared is supported.

diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 280a7b1..f960824 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1782,61 +1782,20 @@ proc check_gc_sections_available { } {
 }
 
 # Returns true if -shared is supported on the target
-# Only used and accurate for ELF targets at the moment
 
 proc check_shared_lib_support { } {
-    if {![istarget aarch64*-*-elf]
-	 && ![istarget arc*-*-elf*]
-	 && ![istarget arm*-*-elf]
-	 && ![istarget avr-*-*]
-	 && ![istarget cr16-*-*]
-	 && ![istarget cris*-*-elf]
-	 && ![istarget crx-*-*]
-	 && ![istarget d10v-*-*]
-	 && ![istarget d30v-*-*]
-	 && ![istarget dlx-*-*]
-	 && ![istarget epiphany-*-*]
-	 && ![istarget fr30-*-*]
-	 && ![istarget frv-*-elf]
-	 && ![istarget ft32-*-*]
-	 && ![istarget h8300-*-*]
-	 && ![istarget i860-*-*]
-	 && ![istarget i960-*-*]
-	 && ![istarget ip2k-*-*]
-	 && ![istarget iq2000-*-*]
-	 && ![istarget lm32-*-elf]
-	 && ![istarget lm32-*-rtems*]
-	 && ![istarget m32c-*-*]
-	 && ![istarget m32r-*-elf]
-	 && ![istarget m6811-*-*]
-	 && ![istarget m6812-*-*]
-	 && ![istarget m68hc1*-*-*]
-	 && ![istarget mcore*-*-*]
-	 && ![istarget mep-*-*]
-	 && ![istarget microblaze-*-elf]
-	 && ![istarget mips*-*-elf]
-	 && ![istarget mn10200-*-*]
-	 && ![istarget moxie-*-*]
-	 && ![istarget msp430-*-*]
-	 && ![istarget mt-*-*]
-	 && ![istarget nds32*-*-elf]
-	 && ![istarget nios2-*-elf]
-	 && ![istarget or1k*-*-elf]
-	 && ![istarget pj-*-*]
-	 && ![istarget pru-*-*]
-	 && ![istarget rl78-*-*]
-	 && ![istarget rx-*-*]
-	 && ![istarget spu-*-*]
-	 && ![istarget v850*-*-*]
-	 && ![istarget visium-*-*]
-	 && ![istarget xc16x-*-elf]
-	 && ![istarget xgate-*-*]
-	 && ![istarget xstormy16-*-*]
-	 && ![istarget *-*-irix*]
-	 && ![istarget *-*-rtems] } {
-	return 1
+    global shared_available_saved
+    global ld
+
+    if {![info exists shared_available_saved]} {
+	set ld_output [remote_exec host $ld "-shared"]
+	if { [ string first "not supported" $ld_output ] >= 0 } {
+	    set shared_available_saved 0
+	} else {
+	    set shared_available_saved 1
+	}
     }
-    return 0
+    return $shared_available_saved
 }
 
 # Return true if target uses genelf.em (assuming it is ELF).


-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: Enable shared lib tests for frv, lm32, m32r, microblaze, nds32 and or1k
  2017-12-07  9:50   ` Alan Modra
@ 2017-12-07 10:37     ` Alan Modra
  2017-12-08 10:26       ` Nick Clifton
  2017-12-08 18:06     ` Kyrill Tkachov
  1 sibling, 1 reply; 7+ messages in thread
From: Alan Modra @ 2017-12-07 10:37 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

On Thu, Dec 07, 2017 at 08:20:40PM +1030, Alan Modra wrote:
> 	* testsuite/lib/ld-lib.exp (check_shared_lib_support): Ask ld
> 	under test whether -shared is supported.

And of course that exposed a whole lot of test failures.  The majority
being mcore-elf and mipstx39-elf.  mcore-elf is obviously a configury
problem:  The backend doesn't provide necessary functions to support
shared libs, so shouldn't be advertising -shared support.  I'm not
sure what to do about the mips fails.

	* emulparams/elf32mcore.sh (GENERATE_SHLIB_SCRIPT): Don't define.

diff --git a/ld/emulparams/elf32mcore.sh b/ld/emulparams/elf32mcore.sh
index 512a9b0..9a83999 100644
--- a/ld/emulparams/elf32mcore.sh
+++ b/ld/emulparams/elf32mcore.sh
@@ -28,7 +28,6 @@ OTHER_BSS_END_SYMBOLS="__bss_end__ = . ;"
 STACK_ADDR=0x80000
 
 TEMPLATE_NAME=elf32
-GENERATE_SHLIB_SCRIPT=yes
 
 # This code gets inserted into the generic elf32.sc linker script
 # and allows us to define our own command line switches.


-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: Enable shared lib tests for frv, lm32, m32r, microblaze, nds32 and or1k
  2017-12-07 10:37     ` Alan Modra
@ 2017-12-08 10:26       ` Nick Clifton
  0 siblings, 0 replies; 7+ messages in thread
From: Nick Clifton @ 2017-12-08 10:26 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

Hi Alan,

>> 	* testsuite/lib/ld-lib.exp (check_shared_lib_support): Ask ld
>> 	under test whether -shared is supported.

Thanks for pursuing this.

> And of course that exposed a whole lot of test failures.  The majority
> being mcore-elf and mipstx39-elf.  mcore-elf is obviously a configury
> problem:  The backend doesn't provide necessary functions to support
> shared libs, so shouldn't be advertising -shared support.  I'm not
> sure what to do about the mips fails.
 
With luck Maciej will have an idea about how to solve this one.

Cheers
  Nick

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

* Re: Enable shared lib tests for frv, lm32, m32r, microblaze, nds32 and or1k
  2017-12-07  9:50   ` Alan Modra
  2017-12-07 10:37     ` Alan Modra
@ 2017-12-08 18:06     ` Kyrill Tkachov
  2017-12-08 22:21       ` Alan Modra
  1 sibling, 1 reply; 7+ messages in thread
From: Kyrill Tkachov @ 2017-12-08 18:06 UTC (permalink / raw)
  To: Alan Modra, nickc; +Cc: binutils

Hi Alan,

On 07/12/17 09:50, Alan Modra wrote:
> On Wed, Dec 06, 2017 at 10:04:37AM +0000, Nick Clifton wrote:
> > Hi Alan,
> >
> > > +   * testsuite/lib/ld-lib.exp (check_shared_lib_support): Return true
> > > +   for frv, lm32, m32r, microblaze, nds32 and or1k linux targets.
> >
> > > -    && ![istarget lm32-*-*]
> > > +    && ![istarget lm32-*-elf]
> >
> > This introduced a whole slew of new failures when I tested a 
> lm32-rtems4.10
> > toolchain so I have checked in a little fix for this target:
> >
> > Cheers
> >   Nick
> >
> > ld/ChangeLog
> > 2017-12-06  Nick Clifton  <nickc@redhat.com>
> >
> >        * testsuite/lib/ld-lib.exp (check_shared_lib_support): Return
> >        false for lm32-rtems targets.
>
> Yes, I looked at that function and noticed it wasn't really doing the
> right thing.  I should have been a little less lazy and rewritten it.
>
>         * testsuite/lib/ld-lib.exp (check_shared_lib_support): Ask ld
>         under test whether -shared is supported.
>
> diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
> index 280a7b1..f960824 100644
> --- a/ld/testsuite/lib/ld-lib.exp
> +++ b/ld/testsuite/lib/ld-lib.exp
> @@ -1782,61 +1782,20 @@ proc check_gc_sections_available { } {
>  }
>
>  # Returns true if -shared is supported on the target
> -# Only used and accurate for ELF targets at the moment
>
>  proc check_shared_lib_support { } {
> -    if {![istarget aarch64*-*-elf]
> -        && ![istarget arc*-*-elf*]
> -        && ![istarget arm*-*-elf]
> -        && ![istarget avr-*-*]
> -        && ![istarget cr16-*-*]
> -        && ![istarget cris*-*-elf]
> -        && ![istarget crx-*-*]
> -        && ![istarget d10v-*-*]
> -        && ![istarget d30v-*-*]
> -        && ![istarget dlx-*-*]
> -        && ![istarget epiphany-*-*]
> -        && ![istarget fr30-*-*]
> -        && ![istarget frv-*-elf]
> -        && ![istarget ft32-*-*]
> -        && ![istarget h8300-*-*]
> -        && ![istarget i860-*-*]
> -        && ![istarget i960-*-*]
> -        && ![istarget ip2k-*-*]
> -        && ![istarget iq2000-*-*]
> -        && ![istarget lm32-*-elf]
> -        && ![istarget lm32-*-rtems*]
> -        && ![istarget m32c-*-*]
> -        && ![istarget m32r-*-elf]
> -        && ![istarget m6811-*-*]
> -        && ![istarget m6812-*-*]
> -        && ![istarget m68hc1*-*-*]
> -        && ![istarget mcore*-*-*]
> -        && ![istarget mep-*-*]
> -        && ![istarget microblaze-*-elf]
> -        && ![istarget mips*-*-elf]
> -        && ![istarget mn10200-*-*]
> -        && ![istarget moxie-*-*]
> -        && ![istarget msp430-*-*]
> -        && ![istarget mt-*-*]
> -        && ![istarget nds32*-*-elf]
> -        && ![istarget nios2-*-elf]
> -        && ![istarget or1k*-*-elf]
> -        && ![istarget pj-*-*]
> -        && ![istarget pru-*-*]
> -        && ![istarget rl78-*-*]
> -        && ![istarget rx-*-*]
> -        && ![istarget spu-*-*]
> -        && ![istarget v850*-*-*]
> -        && ![istarget visium-*-*]
> -        && ![istarget xc16x-*-elf]
> -        && ![istarget xgate-*-*]
> -        && ![istarget xstormy16-*-*]
> -        && ![istarget *-*-irix*]
> -        && ![istarget *-*-rtems] } {
> -       return 1
> +    global shared_available_saved
> +    global ld
> +
> +    if {![info exists shared_available_saved]} {
> +       set ld_output [remote_exec host $ld "-shared"]
> +       if { [ string first "not supported" $ld_output ] >= 0 } {
> +           set shared_available_saved 0
> +       } else {
> +           set shared_available_saved 1
> +       }
>      }
> -    return 0
> +    return $shared_available_saved
>  }
>
>  # Return true if target uses genelf.em (assuming it is ELF).
>

I'm seeing 202 unexpected failures on aarch64-none-elf with this patch.
With errors telling me to recompile with -fPIC or
"newlib/libgloss/aarch64/syscalls.c:639:(.text._sbrk+0x6c): dangerous 
relocation: unsupported relocation"
Should the tests perhaps be skipped on a bare-metal target?

Thanks,
Kyrill
>
> -- 
> Alan Modra
> Australia Development Lab, IBM

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

* Re: Enable shared lib tests for frv, lm32, m32r, microblaze, nds32 and or1k
  2017-12-08 18:06     ` Kyrill Tkachov
@ 2017-12-08 22:21       ` Alan Modra
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Modra @ 2017-12-08 22:21 UTC (permalink / raw)
  To: Kyrill Tkachov; +Cc: nickc, binutils

On Fri, Dec 08, 2017 at 06:06:27PM +0000, Kyrill Tkachov wrote:
> I'm seeing 202 unexpected failures on aarch64-none-elf with this patch.
> With errors telling me to recompile with -fPIC or
> "newlib/libgloss/aarch64/syscalls.c:639:(.text._sbrk+0x6c): dangerous
> relocation: unsupported relocation"
> Should the tests perhaps be skipped on a bare-metal target?

aarch64-none-elf uses ld/emulparams/aarch64elf.em, which enables
shared lib and PIE support.  So it seems to me that shared lib support
ought to be tested..

If the aarch64-elf environment never provides the necessary shared
libs for these tests to pass, I think you'd be better off disabling
the ld shared lib support.  If you sometimes do have shared libs, then
the situation isn't much different to one I hit on powerpc linux
occasionally:  People report testsuite failures due to not having
static libraries installed.

Well, that's the purist argument.  Pragmatic considerations might say
otherwise.  I'm fine with putting an exception into
check_shared_lib_support for aarch64-*-elf if that's what target
maintainers decide.

-- 
Alan Modra
Australia Development Lab, IBM

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

end of thread, other threads:[~2017-12-08 22:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-06  7:26 Enable shared lib tests for frv, lm32, m32r, microblaze, nds32 and or1k Alan Modra
2017-12-06 10:04 ` Nick Clifton
2017-12-07  9:50   ` Alan Modra
2017-12-07 10:37     ` Alan Modra
2017-12-08 10:26       ` Nick Clifton
2017-12-08 18:06     ` Kyrill Tkachov
2017-12-08 22:21       ` Alan Modra

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