[PATCH v2] gas: add --reloc-section-sym={all, internal, none} option for ELF

Jan Beulich jbeulich@suse.com
Mon Feb 23 07:20:29 GMT 2026


On 22.02.2026 03:03, Fangrui Song wrote:
> --- a/gas/testsuite/gas/elf/elf.exp
> +++ b/gas/testsuite/gas/elf/elf.exp
> @@ -4,15 +4,15 @@
>  # it under the terms of the GNU General Public License as published by
>  # the Free Software Foundation; either version 3 of the License, or
>  # (at your option) any later version.
> -# 
> +#
>  # This program is distributed in the hope that it will be useful,
>  # but WITHOUT ANY WARRANTY; without even the implied warranty of
>  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>  # GNU General Public License for more details.
> -# 
> +#
>  # You should have received a copy of the GNU General Public License
>  # along with this program; if not, write to the Free Software
> -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  
> +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
>  
>  #
>  # elf tests
> @@ -170,30 +170,32 @@ if { [is_elf_format] } then {
>      switch -glob $target_triplet {
>  	alpha*-*-* { }
>  	am3*-*-* { }
> +	avr-*-* { }
>  	*c54x*-*-* { }
>  	cr16*-*-* { }
>  	crx*-*-* { }
>  	h8300-*-* { }
> -	hppa*-*-* { }
> -	iq2000*-*-* { }
> -	mips*-*-* { }
> +	loongarch*-*-* { }
> +	m681*-*-* { }
> +	m68hc*-*-* { }
>  	mn10200-*-* { }
>  	mn10300-*-* { }
>  	msp43*-*-* { }
> -	rl78-*-* { }
>  	riscv*-*-* { }
> +	rl78-*-* { }
>  	rx-*-* { }
> -	loongarch*-*-* { }
> +	xgate-*-* { }
> +	vax-*-* { }
>  	default {
> -	    # The next test can fail if the target does not convert fixups
> -	    # against ordinary symbols into relocations against section symbols.
> -	    # This is usually revealed by the error message:
> -	    #  symbol `sym' required but not present
> -	    setup_xfail "m681*-*-*" "m68hc*-*-*" "xgate-*-*" "vax-*-*" "avr-*-*"
> -	    run_dump_test redef
> +	    # The following tests require that the target adjusts relocations
> +	    # referencing local binding symbols to be against section symbols.
>  	    run_dump_test equ-reloc
> +	    run_dump_test redef
> +	    run_dump_test "reloc-section-sym-all"
> +	    run_dump_test "reloc-section-sym-internal"
>  	}
>      }
> +    run_dump_test "reloc-section-sym-none"
>      run_dump_test "pseudo"
>      run_dump_test "text-prev" $dump_opts
>      run_dump_test "text-subsect" $dump_opts
> @@ -245,7 +247,7 @@ if { [is_elf_format] } then {
>      # in the symbol type test.
>      # We also need to exclude targets that do not support unique objects.
>      if {    [istarget "*-*-hpux*"]
> -	 || [istarget "arm*-*-*"]	
> +	 || [istarget "arm*-*-*"]
>           || [istarget "mips*-*-*"]
>           || [istarget "msp*-*-*"]
>  	 || [istarget "visium-*-*"]
> @@ -380,7 +382,7 @@ if { [is_elf_format] } then {
>      run_dump_test "startof"
>  
>      run_dump_test "missing-build-notes"
> -    
> +
>      run_dump_test "common1"
>      run_dump_test "common2"
>  

This became much more of a change than what v1 had, and I question parts thereof.
You're dropping XFAILs. If there's a proper reason for doing so, it needs stating
in the description. You're further excluding the equ-reloc test for more targets.
This pretty likely is wrong?

You apparently also try to re-sort the list of excluded targets in that switch,
yet then vax ends up after xgate.

I'm also unconvinced all the whitespace changes should go here.

With changes like these, btw, a revlog would also have been helpful.

Jan


More information about the Binutils mailing list