ld/testsuite: enable build-id for ELF platforms

Message ID 20260529133254.1429717-1-chigot@adacore.com
State New
Headers
Series ld/testsuite: enable build-id for ELF platforms |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
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_check--master-arm success Test passed

Commit Message

Clément Chigot May 29, 2026, 1:32 p.m. UTC
  --build-id is defined within elf.em and thus should be available for
all platforms matching "is_elf_format".
---
 ld/testsuite/ld-elf/build-id.exp | 7 -------
 1 file changed, 7 deletions(-)
  

Comments

Clément Chigot May 29, 2026, 1:45 p.m. UTC | #1
On Fri, May 29, 2026 at 3:33 PM Clément Chigot <chigot@adacore.com> wrote:
>
> --build-id is defined within elf.em and thus should be available for
> all platforms matching "is_elf_format".

@Alan Modra I've tested a couple of ELF platforms internally. But I
don't know if there is a way to trigger this test for all ELF
emulations ? `--enable-targets=all` doesn't seem to be enough.
Otherwise, I'll adjust if some ELF targets don't support it.

> ---
>  ld/testsuite/ld-elf/build-id.exp | 7 -------
>  1 file changed, 7 deletions(-)
>
> diff --git a/ld/testsuite/ld-elf/build-id.exp b/ld/testsuite/ld-elf/build-id.exp
> index cabbcbd289a..15f90d3205e 100644
> --- a/ld/testsuite/ld-elf/build-id.exp
> +++ b/ld/testsuite/ld-elf/build-id.exp
> @@ -29,13 +29,6 @@ if { [istarget frv-*-*] || [istarget lm32-*-*] } {
>      return
>  }
>
> -if { !([istarget *-*-linux*]
> -       || [istarget arm*-*-uclinuxfdpiceabi]
> -       || [istarget *-*-gnu*]) } then {
> -    return
> -}
> -
> -
>  set stylelist {"" "--build-id" "--build-id=none" "--build-id=md5"
>      "--build-id=sha1" "--build-id=guid" "--build-id=0xdeadbeef"}
>
> --
> 2.43.0
>
  
Jan Beulich June 2, 2026, 8:43 a.m. UTC | #2
On 29.05.2026 15:45, Clément Chigot wrote:
> On Fri, May 29, 2026 at 3:33 PM Clément Chigot <chigot@adacore.com> wrote:
>>
>> --build-id is defined within elf.em and thus should be available for
>> all platforms matching "is_elf_format".
> 
> @Alan Modra I've tested a couple of ELF platforms internally. But I
> don't know if there is a way to trigger this test for all ELF
> emulations ? `--enable-targets=all` doesn't seem to be enough.

While that's enough to make the linker capable of linking for such targets,
it indeed isn't sufficient to have those cases covered by the testsuite. The
way the testsuite presently is written, you won't get around testing a build
for every one such target.

Jan
  
Alan Modra June 2, 2026, 9:08 a.m. UTC | #3
On Fri, May 29, 2026 at 03:32:54PM +0200, Clément Chigot wrote:
> --build-id is defined within elf.em and thus should be available for
> all platforms matching "is_elf_format".

No, there are ELF targets that don't use elf.em.  See lib/ld-lib.exp
uses_genelf.  I think the test should be using

if { ![is_elf_format] || [uses_genelf] } {
    return
}

and no other exclusions.  I'll see if that is correct.
  
Alan Modra June 2, 2026, 10:45 a.m. UTC | #4
On Tue, Jun 02, 2026 at 06:38:01PM +0930, Alan Modra wrote:
> On Fri, May 29, 2026 at 03:32:54PM +0200, Clément Chigot wrote:
> > --build-id is defined within elf.em and thus should be available for
> > all platforms matching "is_elf_format".
> 
> No, there are ELF targets that don't use elf.em.  See lib/ld-lib.exp
> uses_genelf.  I think the test should be using
> 
> if { ![is_elf_format] || [uses_genelf] } {
>     return
> }
> 
> and no other exclusions.  I'll see if that is correct.

I'll apply the following.  spu-elf fails the tests due to a readelf
complaint:
Displaying notes found in: .note.spu_name
readelf: Warning: Corrupt note: alignment 16, expecting 4 or 8

diff --git a/ld/testsuite/ld-elf/build-id.exp b/ld/testsuite/ld-elf/build-id.exp
index cabbcbd289a..6899cdbf2a2 100644
--- a/ld/testsuite/ld-elf/build-id.exp
+++ b/ld/testsuite/ld-elf/build-id.exp
@@ -19,23 +19,10 @@
 # MA 02110-1301, USA.
 #
 
-# Exclude non-ELF targets.
-
-if ![is_elf_format] {
-    return
-}
-
-if { [istarget frv-*-*] || [istarget lm32-*-*] } {
+if { ![is_elf_format] || [uses_genelf] } {
     return
 }
 
-if { !([istarget *-*-linux*]
-       || [istarget arm*-*-uclinuxfdpiceabi]
-       || [istarget *-*-gnu*]) } then {
-    return
-}
-
-
 set stylelist {"" "--build-id" "--build-id=none" "--build-id=md5"
     "--build-id=sha1" "--build-id=guid" "--build-id=0xdeadbeef"}
  
Clément Chigot June 2, 2026, 11:22 a.m. UTC | #5
On Tue, Jun 2, 2026 at 12:45 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Tue, Jun 02, 2026 at 06:38:01PM +0930, Alan Modra wrote:
> > On Fri, May 29, 2026 at 03:32:54PM +0200, Clément Chigot wrote:
> > > --build-id is defined within elf.em and thus should be available for
> > > all platforms matching "is_elf_format".
> >
> > No, there are ELF targets that don't use elf.em.  See lib/ld-lib.exp
> > uses_genelf.  I think the test should be using
> >
> > if { ![is_elf_format] || [uses_genelf] } {
> >     return
> > }
> >
> > and no other exclusions.  I'll see if that is correct.
>
> I'll apply the following.  spu-elf fails the tests due to a readelf
> complaint:
> Displaying notes found in: .note.spu_name
> readelf: Warning: Corrupt note: alignment 16, expecting 4 or 8

Perfect. Thanks a lot.
Clément

> diff --git a/ld/testsuite/ld-elf/build-id.exp b/ld/testsuite/ld-elf/build-id.exp
> index cabbcbd289a..6899cdbf2a2 100644
> --- a/ld/testsuite/ld-elf/build-id.exp
> +++ b/ld/testsuite/ld-elf/build-id.exp
> @@ -19,23 +19,10 @@
>  # MA 02110-1301, USA.
>  #
>
> -# Exclude non-ELF targets.
> -
> -if ![is_elf_format] {
> -    return
> -}
> -
> -if { [istarget frv-*-*] || [istarget lm32-*-*] } {
> +if { ![is_elf_format] || [uses_genelf] } {
>      return
>  }
>
> -if { !([istarget *-*-linux*]
> -       || [istarget arm*-*-uclinuxfdpiceabi]
> -       || [istarget *-*-gnu*]) } then {
> -    return
> -}
> -
> -
>  set stylelist {"" "--build-id" "--build-id=none" "--build-id=md5"
>      "--build-id=sha1" "--build-id=guid" "--build-id=0xdeadbeef"}
>
>
>
> --
> Alan Modra
  

Patch

diff --git a/ld/testsuite/ld-elf/build-id.exp b/ld/testsuite/ld-elf/build-id.exp
index cabbcbd289a..15f90d3205e 100644
--- a/ld/testsuite/ld-elf/build-id.exp
+++ b/ld/testsuite/ld-elf/build-id.exp
@@ -29,13 +29,6 @@  if { [istarget frv-*-*] || [istarget lm32-*-*] } {
     return
 }
 
-if { !([istarget *-*-linux*]
-       || [istarget arm*-*-uclinuxfdpiceabi]
-       || [istarget *-*-gnu*]) } then {
-    return
-}
-
-
 set stylelist {"" "--build-id" "--build-id=none" "--build-id=md5"
     "--build-id=sha1" "--build-id=guid" "--build-id=0xdeadbeef"}