[PATCH] ld: testsuite: Fix "Build libpr23161c.so" etc. on Solaris/x86

H.J. Lu hjl.tools@gmail.com
Thu Jul 31 13:40:40 GMT 2025


On Thu, Jul 31, 2025 at 5:37 AM Alan Modra <amodra@gmail.com> wrote:
>
> On Mon, Jul 28, 2025 at 04:12:08PM +0200, Rainer Orth wrote:
> >       * testsuite/ld-elf/pr23161c.rd: Allow for intervening symbols.
> >       * testsuite/ld-elf/pr23161d.rd: Likewise.
>
> Not OK.  If I understand the test correctly it is to ensure that _end,
> _edata and __bss_start are not made dynamic.
>
> It would also be nice to run those tests on other than x86, but that
> means not doing any dynamic reloc checks due to some architectures
> needing them for PIC.  I don't think the reloc checks are necessary.
> We dropped them from pr23161a and pr23161b tests a while ago (without
> removing the -r from readelf invocation).
>
> HJ, do you have any objection to the following?

Works for me.

> diff --git a/ld/testsuite/ld-elf/pr23161c.rd b/ld/testsuite/ld-elf/pr23161c.rd
> index be99655e7ab..9b19b366aa8 100644
> --- a/ld/testsuite/ld-elf/pr23161c.rd
> +++ b/ld/testsuite/ld-elf/pr23161c.rd
> @@ -1,6 +1,3 @@
> -There are no relocations in this file.
> -
> -Symbol table '\.dynsym' contains [0-9]+ entries:
> - +Num: +Value +Size Type +Bind +Vis +Ndx Name
> - +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
> - +1: +[a-f0-9]+ +[0-9]+ +FUNC +GLOBAL +DEFAULT +[0-9]+ +foo
> +#failif
> +#...
> +.* _?_(end|edata|_bss_start)
> diff --git a/ld/testsuite/ld-elf/pr23161d.rd b/ld/testsuite/ld-elf/pr23161d.rd
> deleted file mode 100644
> index e7756b3f61b..00000000000
> --- a/ld/testsuite/ld-elf/pr23161d.rd
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -Relocation section '\.rel(a|)\.plt' at offset 0x[0-9a-f]+ contains 1 entry:
> - +Offset +Info +Type +Sym.* Value +Sym.* Name( \+ Addend|)
> -[a-f0-9]+ +[0-9a-f]+ +R_.*_JUMP_SLOT +[a-f0-9]+ +foo( \+ [a-f0-9]+|)
> -
> -Symbol table '\.dynsym' contains [0-9]+ entries:
> - +Num: +Value +Size Type +Bind +Vis +Ndx Name
> - +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
> - +[0-9]+: +[a-f0-9]+ +0 +FUNC +GLOBAL +DEFAULT +UND +foo
> diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
> index 84100a7e6d9..ee881c2d619 100644
> --- a/ld/testsuite/ld-elf/shared.exp
> +++ b/ld/testsuite/ld-elf/shared.exp
> @@ -1764,7 +1764,7 @@ if { ([istarget "*-*-linux*"]
>             "" \
>             $AFLAGS_PIE \
>             { pr23161b.c } \
> -           {{readelf {--dyn-syms -rW} pr23161b.rd}} \
> +           {{readelf {--dyn-syms -W} pr23161b.rd}} \
>             "pr23161a" \
>             "-fPIC -O0 $NOSANITIZE_CFLAGS" \
>         ] \
> @@ -1784,23 +1784,17 @@ if { ([istarget "*-*-linux*"]
>             "" \
>             $AFLAGS_PIE \
>             { pr23161b.c } \
> -           {{readelf {--dyn-syms -rW} pr23161b.rd}} \
> +           {{readelf {--dyn-syms -W} pr23161b.rd}} \
>             "pr23161b" \
>             "-fPIC -O0 $NOSANITIZE_CFLAGS" \
>         ] \
> -    ]
> -}
> -
> -if { [istarget "i?86-*-*"]
> -     || [istarget "x86_64-*-*"] } {
> -    run_ld_link_tests [list \
>         [list \
>             "Build libpr23161c.so" \
>             "-shared" \
>             "" \
>             "$AFLAGS_PIC" \
>             { pr23161c.c } \
> -           {{readelf {--dyn-syms -rW} pr23161c.rd}} \
> +           {{readelf {--dyn-syms -W} pr23161c.rd}} \
>             "libpr23161c.so" \
>             "-fPIC -O2 $NOSANITIZE_CFLAGS" \
>         ] \
> @@ -1810,7 +1804,7 @@ if { [istarget "i?86-*-*"]
>             "" \
>             $AFLAGS_PIE \
>             { pr23161b.c } \
> -           {{readelf {--dyn-syms -rW} pr23161d.rd}} \
> +           {{readelf {--dyn-syms -W} pr23161c.rd}} \
>             "pr23161c" \
>             "-fPIC -O0 $NOSANITIZE_CFLAGS" \
>         ] \
>
>
> --
> Alan Modra



-- 
H.J.


More information about the Binutils mailing list