[PATCH v2 3/5] bfd: avoid elf-sframe.c for SFrame-unaware targets

Indu Bhagat indu.bhagat@oracle.com
Tue Mar 10 05:47:58 GMT 2026


On 3/9/26 12:16 AM, Jan Beulich wrote:
> On 07.03.2026 01:33, Indu Bhagat wrote:
>> On 3/1/26 11:44 PM, Jan Beulich wrote:
>>> --- a/bfd/configure.ac
>>> +++ b/bfd/configure.ac
>>> @@ -370,14 +370,14 @@ selarchs="$f"
>>>    tb=
>>>    
>>>    elf="elf.lo elflink.lo elf-strtab.lo elf-eh-frame.lo elf-properties.lo
>>> -     elf-sframe.lo dwarf1.lo dwarf2.lo"
>>> +     dwarf1.lo dwarf2.lo"
>>>    coffgen="coffgen.lo dwarf2.lo"
>>>    coff="cofflink.lo $coffgen"
>>>    ecoff="ecofflink.lo $coffgen"
>>>    xcoff="xcofflink.lo $coffgen"
>>>    
>>>    elf32_aarch64="elf32-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf32.lo elf-attrs.lo"
>>> -elf64_aarch64="elf64-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf64.lo elf-attrs.lo"
>>> +elf64_aarch64="elf64-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf64.lo elf-attrs.lo elf-sframe.lo"
>>>    elf_arc="elf32-arc.lo elf32.lo elf-attrs.lo"
>>>    elf_arm="elf32-arm.lo elf32.lo elf-attrs.lo elf-vxworks.lo"
>>>    elf_csky="elf32-csky.lo elf32.lo elf-attrs.lo"
>>> @@ -591,7 +591,7 @@ do
>>>        rx_elf32_le_vec)		 tb="$tb elf32-rx.lo elf32.lo $elf" ;;
>>>        rx_elf32_linux_le_vec)	 tb="$tb elf32-rx.lo elf32.lo $elf" ;;
>>>        s390_elf32_vec)		 tb="$tb elf32-s390.lo elf32.lo elf-attrs.lo $elf" ;;
>>> -    s390_elf64_vec)		 tb="$tb elf64-s390.lo elf64.lo elf-attrs.lo $elf"; target_size=64 ;;
>>> +    s390_elf64_vec)		 tb="$tb elf64-s390.lo elf64.lo elf-attrs.lo elf-sframe.lo $elf"; target_size=64 ;;
>>>        score_elf32_be_vec)		 tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
>>>        score_elf32_le_vec)		 tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
>>>        sh_coff_vec)		 tb="$tb coff-sh.lo $coff" ;;
>>> @@ -653,9 +653,9 @@ do
>>>        wasm32_elf32_vec)            tb="$tb elf32-wasm32.lo elf32.lo $elf" ;;
>>>        x86_64_coff_vec)		 tb="$tb coff-x86_64.lo $coff"; target_size=64 ;;
>>>        x86_64_elf32_vec)		 tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo elf32.lo $elf"; target_size=64 ;;
>>> -    x86_64_elf64_vec)		 tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo $elf"; target_size=64 ;;
>>> -    x86_64_elf64_fbsd_vec)	 tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo $elf"; target_size=64 ;;
>>> -    x86_64_elf64_sol2_vec)	 tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo $elf"; target_size=64 ;;
>>> +    x86_64_elf64_vec)		 tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo elf-sframe.lo $elf"; target_size=64 ;;
>>> +    x86_64_elf64_fbsd_vec)	 tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo elf-sframe.lo $elf"; target_size=64 ;;
>>> +    x86_64_elf64_sol2_vec)	 tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo elf-sframe.lo $elf"; target_size=64 ;;
>>
>> Thanks Jan for the changes.
>>
>> Is the case of adding elf-sframe.lo to fbsd_vec due to the following
>> (config.bfd) ?
>>
>>     x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
>>       targ_defvec=x86_64_elf64_fbsd_vec
>>       targ_selvecs="i386_elf32_fbsd_vec iamcu_elf32_vec i386_coff_vec
>> i386_pei_vec x86_64_pe_vec x86_64_pei_vec i386_elf32_vec x86_64_elf64_vec"
>>       want64=true
>>       ;;
>>
>> Also for sol2, do you think we should include elf-sframe.lo ? (I
>> understand that your patch is making things cleaner than status quo.)
> 
> Not really, no. Right here the goal to "no change for arch-es using SFrame".
> 
>> In essence, my concern is "leaking" SHT_GNU_SFRAME section type to
>> freebsd and solaris.  To that end (unrelated to the current patch), is
>> there a good way to detect OS (specifically GNU) in GAS ?  I thought
>> about doing something like 'endswith (TARGET_OS, "gnu")' ...
> 
> See Rainer's reply. Any further reduction of exposure would want to be a
> separate change, with suitable justification. I'm not quite sure about all
> of the BSDs having picked up GNU extensions, but for the particular case
> here (FreeBSD) iirc we have code elsewhere in the codebase which enables
> use of them (maybe not all but just some, yet that would likely take a
> FreeBSD person to clarify).
> 

Thanks Rainer and Jan for your replies.

I agree with the current patch.

Thanks
Indu



More information about the Binutils mailing list