[PATCH] ld: testsuite: Add a bootstrap test using -Wl,-z,pack-relative-relocs if DT_RELR supported

Xi Ruoyao xry111@xry111.site
Sun Jun 23 01:06:57 GMT 2024


On Sat, 2024-06-22 at 18:05 +0800, Xi Ruoyao wrote:
> This helps to test the correctness of DT_RELR.
> 
> Signed-off-by: Xi Ruoyao <xry111@xry111.site>

The patch is dropped because it won't work with old Glibc.

> ---
>  ld/testsuite/ld-bootstrap/bootstrap.exp | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/ld/testsuite/ld-bootstrap/bootstrap.exp b/ld/testsuite/ld-bootstrap/bootstrap.exp
> index 437a3bc6842..2eaae3a0d45 100644
> --- a/ld/testsuite/ld-bootstrap/bootstrap.exp
> +++ b/ld/testsuite/ld-bootstrap/bootstrap.exp
> @@ -69,6 +69,9 @@ if { [istarget "powerpc-*-*"] } {
>  if { [is_elf_format] && ![is_bad_symtab] } {
>      lappend test_flags "-Wl,-z,nosectionheader"
>  }
> +if { [supports_dt_relr] } then {
> +    lappend test_flags "-Wl,-z,pack-relative-relocs"
> +}
>  
>  set gcc_B_opt_save $gcc_B_opt
>  
> @@ -97,12 +100,13 @@ foreach flags $test_flags {
>  	set testname "bootstrap"
>      }}
>  
> -    # --static is meaningless.  --relax and -z nosectionheader are
> -    # incompatible with -r.
> +    # --static is meaningless.  --relax, -z nosectionheader, and
> +    # -z pack-relative-relocs are incompatible with -r.
>      regsub -- "-Wl," $flags "" partial_flags
>      if { "$partial_flags" == "--static" \
>  	 || "$partial_flags" == "--relax" \
> -	 || [string match "*nosectionheader*" "$partial_flags"] } {
> +	 || [string match "*nosectionheader*" "$partial_flags"]
> +	 || [string match "*pack-relative-relocs*" "$partial_flags"] } {
>  	set partial_flags ""
>      }
>  

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University


More information about the Binutils mailing list