]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas: sframe: guard block with support_sframe_p
authorIndu Bhagat <indu.bhagat@oracle.com>
Sat, 12 Jul 2025 06:31:50 +0000 (23:31 -0700)
committerIndu Bhagat <indu.bhagat@oracle.com>
Sat, 12 Jul 2025 06:31:50 +0000 (23:31 -0700)
SFrame is generated for ELF targets only.  Guard the block with
support_sframe_p like others for consistency.

Also, in a later commit, we would like to do a:
  elf_section_type (sframe_seg) = SHT_GNU_SFRAME;

This cannot be done for non-ELF targets, hence the need to guard with
some pre-processor conditional to enable it for only OBJ_ELF.  Guarding
with support_sframe_p works for now, because those targets that support
SFrame define support_sframe_p:
  - x86_64 and aarch64 define support_sframe_p when OBJ_ELF is defined
  - s390x has no non-LEF target.

We continue to issue an error on targets where SFrame is not supported:
    .sframe not supported for target

gas/
* dw2gencfi.c (cfi_finish): Guard with support_sframe_p.
(support_sframe_p): Remove stub to define to false for backends
not supporting SFrame.

gas/dw2gencfi.c

index 5eb8a5d1de82331465ca79999ac6bb370eb2268b..6f8d5912a36061dd1d44ac6098158bc9efc47417 100644 (file)
 #define tc_cfi_reloc_for_encoding(e) BFD_RELOC_NONE
 #endif
 
-/* Targets which support SFrame format will define this and return true.  */
-#ifndef support_sframe_p
-# define support_sframe_p() false
-#endif
-
 /* Private segment collection list.  */
 struct dwcfi_seg_list
 {
@@ -2606,6 +2601,7 @@ cfi_finish (void)
        - .sframe in the .cfi_sections directive.  */
   if (flag_gen_sframe || (all_cfi_sections & CFI_EMIT_sframe) != 0)
     {
+#ifdef support_sframe_p
       if (support_sframe_p () && !SUPPORT_FRAME_LINKONCE)
        {
          segT sframe_seg;
@@ -2618,6 +2614,7 @@ cfi_finish (void)
          output_sframe (sframe_seg);
        }
       else
+#endif
        as_bad (_(".sframe not supported for target"));
     }