testsuite: Also exclude `*-*-kfreebsd*-gnu' from STB_GNU_UNIQUE tests

Message ID alpine.DEB.2.21.2607211343170.14485@angie.orcam.me.uk
State Committed
Headers
Series testsuite: Also exclude `*-*-kfreebsd*-gnu' from STB_GNU_UNIQUE tests |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

Maciej W. Rozycki July 21, 2026, 12:56 p.m. UTC
  Fix commit 02e0be69012a ("mbind gas tests and supports_gnu_osabi 
testsuite infrastructure") and also match `*-*-kfreebsd*-gnu' targets 
when determining whether STB_GNU_UNIQUE binding is supported for 
symbols.  These targets use the same BFD vectors as `*-*-freebsd*' do, 
choosing ELFOSABI_FREEBSD, and therefore need to be treated analogously.

This fixes numerous regressions, e.g.:

mips-kfreebsd-gnu  -FAIL: weaken STB_GNU_UNIQUE symbols
mips-kfreebsd-gnu  -FAIL: strip on STB_GNU_UNIQUE
mips-kfreebsd-gnu  -FAIL: diagnostics for visibility directives
mips-kfreebsd-gnu  -FAIL: ld-unique/pr21529
mips-kfreebsd-gnu  -FAIL: Linker setting GNU OSABI on STB_GNU_UNIQUE symbol (PR 10549)

caused by the missing feature:

.../gas/testsuite/gas/elf/visibility.s:14: Error: symbol type "gnu_unique_object" is supported only by GNU targets
---
 binutils/testsuite/lib/binutils-common.exp |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

binutils-test-gnu-unique-kfreebsd.diff
  

Comments

Jan Beulich July 21, 2026, 1:09 p.m. UTC | #1
On 21.07.2026 14:56, Maciej W. Rozycki wrote:
> --- binutils-gdb.orig/binutils/testsuite/lib/binutils-common.exp
> +++ binutils-gdb/binutils/testsuite/lib/binutils-common.exp
> @@ -308,7 +308,7 @@ proc is_elf_unused_section_symbols {} {
>  # This require ELFOSABI_GNU, and `bfd_elf_final_link'.
>  #
>  proc supports_gnu_unique {} {
> -    if { [istarget *-*-freebsd*] } {
> +    if { [istarget *-*-freebsd*] || [istarget *-*-kfreebsd*-gnu] } {

Is the -gnu at the end really needed here? If yes, it's okay as-is, but
preferably it would be put in without that tail.

Jan

>  	return 0
>      }
>      if { [supports_gnu_osabi] && ![is_generic] } {
  
Maciej W. Rozycki July 21, 2026, 1:42 p.m. UTC | #2
On Tue, 21 Jul 2026, Jan Beulich wrote:

> > --- binutils-gdb.orig/binutils/testsuite/lib/binutils-common.exp
> > +++ binutils-gdb/binutils/testsuite/lib/binutils-common.exp
> > @@ -308,7 +308,7 @@ proc is_elf_unused_section_symbols {} {
> >  # This require ELFOSABI_GNU, and `bfd_elf_final_link'.
> >  #
> >  proc supports_gnu_unique {} {
> > -    if { [istarget *-*-freebsd*] } {
> > +    if { [istarget *-*-freebsd*] || [istarget *-*-kfreebsd*-gnu] } {
> 
> Is the -gnu at the end really needed here? If yes, it's okay as-is, but
> preferably it would be put in without that tail.

 See bfd/config.bfd for how the targets are referred there; we obviously 
need to stay consistent, because `foo-kfreebsd-bar' will choose different 
BFD vectors (whether it makes sense or not, but that's not the matter of 
this fix).

  Maciej
  
Jan Beulich July 21, 2026, 1:58 p.m. UTC | #3
On 21.07.2026 15:42, Maciej W. Rozycki wrote:
> On Tue, 21 Jul 2026, Jan Beulich wrote:
> 
>>> --- binutils-gdb.orig/binutils/testsuite/lib/binutils-common.exp
>>> +++ binutils-gdb/binutils/testsuite/lib/binutils-common.exp
>>> @@ -308,7 +308,7 @@ proc is_elf_unused_section_symbols {} {
>>>  # This require ELFOSABI_GNU, and `bfd_elf_final_link'.
>>>  #
>>>  proc supports_gnu_unique {} {
>>> -    if { [istarget *-*-freebsd*] } {
>>> +    if { [istarget *-*-freebsd*] || [istarget *-*-kfreebsd*-gnu] } {
>>
>> Is the -gnu at the end really needed here? If yes, it's okay as-is, but
>> preferably it would be put in without that tail.
> 
>  See bfd/config.bfd for how the targets are referred there; we obviously 
> need to stay consistent, because `foo-kfreebsd-bar' will choose different 
> BFD vectors (whether it makes sense or not, but that's not the matter of 
> this fix).

Afaict `foo-kfreebsd-bar' will simply not match anything, hitting the
"BFD does not support target" case. Therefore I don't see it as wrong to
have a wider match here than what bfd/config.bfd has. Yet no, I'm not
going to insist.

Jan
  
Maciej W. Rozycki July 23, 2026, 7:04 p.m. UTC | #4
On Tue, 21 Jul 2026, Jan Beulich wrote:

> >  See bfd/config.bfd for how the targets are referred there; we obviously 
> > need to stay consistent, because `foo-kfreebsd-bar' will choose different 
> > BFD vectors (whether it makes sense or not, but that's not the matter of 
> > this fix).
> 
> Afaict `foo-kfreebsd-bar' will simply not match anything, hitting the
> "BFD does not support target" case. Therefore I don't see it as wrong to
> have a wider match here than what bfd/config.bfd has. Yet no, I'm not
> going to insist.

 I think there's value in having triplet match patterns consistent where 
appropriate, as it makes tree-wide changes easier, in particular to avoid 
discrepancies between components.  I've seen too many of them recently.

 Change committed now, thank you for your review.

  Maciej
  

Patch

Index: binutils-gdb/binutils/testsuite/lib/binutils-common.exp
===================================================================
--- binutils-gdb.orig/binutils/testsuite/lib/binutils-common.exp
+++ binutils-gdb/binutils/testsuite/lib/binutils-common.exp
@@ -308,7 +308,7 @@  proc is_elf_unused_section_symbols {} {
 # This require ELFOSABI_GNU, and `bfd_elf_final_link'.
 #
 proc supports_gnu_unique {} {
-    if { [istarget *-*-freebsd*] } {
+    if { [istarget *-*-freebsd*] || [istarget *-*-kfreebsd*-gnu] } {
 	return 0
     }
     if { [supports_gnu_osabi] && ![is_generic] } {