meaning of supports_gnu_unique
Alan Modra
amodra@gmail.com
Thu Apr 2 10:49:50 GMT 2026
On Wed, Apr 01, 2026 at 10:42:27AM +0200, Jan Beulich wrote:
> On 01.04.2026 10:17, Alan Modra wrote:
> > On Tue, Mar 31, 2026 at 03:22:54PM +0200, Jan Beulich wrote:
> >> testsuite: supports_gnu_osabi vs Arm
> >>
> >> Arm is yet more special than the function presently expresses: Even
> >> targets with "gnu" in the name (e.g. arm-unknown-linux-gnu) aren't
> >> ELFOSABI_GNU. Handle Arm first, and drop other Arm special casing in
> >> exchange.
> >>
> >> --- a/binutils/testsuite/lib/binutils-common.exp
> >> +++ b/binutils/testsuite/lib/binutils-common.exp
> >> @@ -234,11 +234,17 @@ proc match_target { target } {
> >> # testcases will generally need to exclude tic6x or use a -m option.)
> >> #
> >> proc supports_gnu_osabi {} {
> >> + if { [istarget arm*-*-*] } {
> >> + if { [istarget arm*-*-*eabi*] } {
> >> + return 1
> >> + }
> >> + return 0
> >> + }
> >> if { [istarget *-*-gnu*]
> >> || [istarget *-*-linux*]
> >> - || ( [istarget *-*-*bsd*] && ![istarget arm*-*-netbsd*] )
> >> + || [istarget *-*-*bsd*]
> >> || [istarget *-*-lynxos]
> >> - || ( [istarget *-*-nto*] && ![istarget arm*-*-*] )
> >> + || [istarget *-*-nto*]
> >> || [istarget *-*-irix*]
> >> || [istarget *-*-*eabi*]
> >> || [istarget *-*-rtems*] } {
> >> @@ -250,8 +256,7 @@ proc supports_gnu_osabi {} {
> >> if { ![istarget "*-*-elf*"] } {
> >> return 0
> >> }
> >> - if { [istarget "arm*-*-*"]
> >> - || [istarget "msp430-*-*"]
> >> + if { [istarget "msp430-*-*"]
> >> || [istarget "hppa-unknown-elf"]
> >> || [istarget "kvx*-*-*"]
> >> || [istarget "visium-*-*"] } {
> >
> > Going by what is in gas/configure.tgt, I think other arm targets
> > should be included, specifically freebsd and rtems.
>
> I was wondering, but I went from gas/config/tc-arm.c:meabi_flags handling.
> Without a command line option, it would be different from
> EF_ARM_EABI_UNKNOWN only when te-arm*eabi.h is in use. And
> bfd/elf32-arm.c:elf32_arm_init_file_header() simply goes from what was put
> there, using ELFOSABI_ARM only when the eabi version still is
> EF_ARM_EABI_UNKNOWN.
>
> Hmm, then neither mine nor your ...
>
> > Perhaps the following? I'm not an arm maintainer though...
> >
> > remove arm-linux-gnu from supports_gnu_osabi
> >
> > arm-linux-gnueabi allows OS/ABI to be set to ELFOSABI_GNU, but plain
> > arm-linux-gnu like arm-elf is ELFOSABI_ARM.
> >
> > --- a/binutils/testsuite/lib/binutils-common.exp
> > +++ b/binutils/testsuite/lib/binutils-common.exp
> > @@ -234,27 +234,32 @@ proc match_target { target } {
> > # testcases will generally need to exclude tic6x or use a -m option.)
> > #
> > proc supports_gnu_osabi {} {
> > - if { [istarget *-*-gnu*]
> > + if { [istarget *-*-*eabi*]
> > + || [istarget *-*-freebsd*]
>
> ... logic here looks correct. arm{,eb}-*-freebsd[89].* use te-freebsd.h,
> only other (presumably newer) arm*-*-freebsd* use te-armfbsdeabi.h
I did see the other arm freebsd targets but I misread the glob and
tested an arm-freebsd8 target which (unsurprisingly) behaved the same
as arm-freebsd regarding test results, and I failed to investigate
why. Retesting properly with arm-freebsd8.0 show failures, along with
messages like "as-new: GNU_RETAIN section is supported only by GNU and
FreeBSD targets".
> > + || [istarget *-*-rtems*] } {
>
> Along with this arm-*-genode* would then also look to need including.
I missed that one. Hmm, arm-*-genode* is not supported in BFD..
I probably should have just kept silent on your patch, which really
was good enough. I'll commit the following and we can tweak it
further if necessary.
diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index 5026c0c0a9a..8683202a3cc 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -234,27 +234,33 @@ proc match_target { target } {
# testcases will generally need to exclude tic6x or use a -m option.)
#
proc supports_gnu_osabi {} {
- if { [istarget *-*-gnu*]
+ if { [istarget *-*-*eabi*]
+ || ([istarget *-*-freebsd*] && ![istarget {*-*-freebsd[89].*}])
+ || [istarget *-*-genode*]
+ || [istarget *-*-rtems*] } {
+ return 1
+ }
+ if { [istarget arm*-*-*] } {
+ return 0
+ }
+ if { [istarget *-*-*bsd*]
+ || [istarget *-*-gnu*]
+ || [istarget *-*-irix*]
|| [istarget *-*-linux*]
- || ( [istarget *-*-*bsd*] && ![istarget arm*-*-netbsd*] )
|| [istarget *-*-lynxos]
- || ( [istarget *-*-nto*] && ![istarget arm*-*-*] )
- || [istarget *-*-irix*]
- || [istarget *-*-*eabi*]
- || [istarget *-*-rtems*] } {
+ || [istarget *-*-nto*] } {
return 1
}
- if { [istarget "wasm32*-*-*"] } {
+ if { [istarget wasm32*-*-*] } {
return 1
}
- if { ![istarget "*-*-elf*"] } {
+ if { ![istarget *-*-elf*] } {
return 0
}
- if { [istarget "arm*-*-*"]
- || [istarget "msp430-*-*"]
- || [istarget "hppa-unknown-elf"]
- || [istarget "kvx*-*-*"]
- || [istarget "visium-*-*"] } {
+ if { [istarget hppa-*-*]
+ || [istarget kvx*-*-*]
+ || [istarget msp430-*-*]
+ || [istarget visium-*-*] } {
return 0
}
return 1
--
Alan Modra
More information about the Binutils
mailing list