]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd: avoid elf-sframe.c for SFrame-unaware targets
authorJan Beulich <jbeulich@suse.com>
Fri, 13 Mar 2026 06:51:46 +0000 (07:51 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 13 Mar 2026 06:51:46 +0000 (07:51 +0100)
It is wasteful to build this file when it's not actually used. Limit it
to targets actually using SFrame and introduce a compiler define
(paralleling OBJ_MAYBE_ELF, as having similar purpose) to guard internal
function decls.

bfd/configure
bfd/configure.ac
bfd/elf-bfd.h

index ccaf53b09149ef9e2639f6947ba843da762bebe8..0d55a4128e103465c2521f37f64629e9b8fd4741 100755 (executable)
@@ -15829,14 +15829,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"
@@ -16050,7 +16050,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" ;;
@@ -16112,9 +16112,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 ;;
     x86_64_mach_o_vec)          tb="$tb mach-o-x86-64.lo" ;;
     x86_64_pe_vec)              tb="$tb pe-x86_64.lo pex64igen.lo $coff"; target_size=64 ;;
     x86_64_pe_big_vec)          tb="$tb pe-x86_64.lo pex64igen.lo $coff"; target_size=64 ;;
@@ -16191,7 +16191,7 @@ if test x${all_targets} = xtrue ; then
     esac
   done
   assocvecs=$f
-  TDEFINES="$TDEFINES -DOBJ_MAYBE_ELF -DOBJ_MAYBE_ELF_ATTRIBUTES"
+  TDEFINES="$TDEFINES -DOBJ_MAYBE_ELF -DOBJ_MAYBE_ELF_ATTRIBUTES -DOBJ_MAYBE_ELF_SFRAME"
 else   # all_targets is true
   # Only set these if they will be nonempty, for the clever echo.
   havevecs=
@@ -16207,6 +16207,7 @@ else    # all_targets is true
     case "$i" in
     elf.*) TDEFINES="$TDEFINES -DOBJ_MAYBE_ELF" ;;
     elf-attrs.*) TDEFINES="$TDEFINES -DOBJ_MAYBE_ELF_ATTRIBUTES" ;;
+    elf-sframe.*) TDEFINES="$TDEFINES -DOBJ_MAYBE_ELF_SFRAME" ;;
     esac
   done
 fi     # all_targets is true
index 877ba4a64f2e996787e0b87f1b6de405c55adee9..06e02a2d507f2554d91a303ece950030d1d17ef5 100644 (file)
@@ -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 ;;
     x86_64_mach_o_vec)          tb="$tb mach-o-x86-64.lo" ;;
     x86_64_pe_vec)              tb="$tb pe-x86_64.lo pex64igen.lo $coff"; target_size=64 ;;
     x86_64_pe_big_vec)          tb="$tb pe-x86_64.lo pex64igen.lo $coff"; target_size=64 ;;
@@ -732,7 +732,7 @@ if test x${all_targets} = xtrue ; then
     esac
   done
   assocvecs=$f
-  TDEFINES="$TDEFINES -DOBJ_MAYBE_ELF -DOBJ_MAYBE_ELF_ATTRIBUTES"
+  TDEFINES="$TDEFINES -DOBJ_MAYBE_ELF -DOBJ_MAYBE_ELF_ATTRIBUTES -DOBJ_MAYBE_ELF_SFRAME"
 else   # all_targets is true
   # Only set these if they will be nonempty, for the clever echo.
   havevecs=
@@ -748,6 +748,7 @@ else        # all_targets is true
     case "$i" in
     elf.*) TDEFINES="$TDEFINES -DOBJ_MAYBE_ELF" ;;
     elf-attrs.*) TDEFINES="$TDEFINES -DOBJ_MAYBE_ELF_ATTRIBUTES" ;;
+    elf-sframe.*) TDEFINES="$TDEFINES -DOBJ_MAYBE_ELF_SFRAME" ;;
     esac
   done
 fi     # all_targets is true
index 58db4eb81b08345550da54c4653bf7a70cfff54e..3d2fad49aa4c4e53dbb90467e8a9d5130a9d3dcb 100644 (file)
@@ -2631,6 +2631,8 @@ extern bool _bfd_elf_eh_frame_entry_present
 extern bool _bfd_elf_maybe_strip_eh_frame_hdr
   (struct bfd_link_info *) ATTRIBUTE_HIDDEN;
 
+#ifdef OBJ_MAYBE_ELF_SFRAME
+
 extern bool _bfd_elf_sframe_present
   (struct bfd_link_info *) ATTRIBUTE_HIDDEN;
 extern bool _bfd_elf_sframe_present_input_bfds
@@ -2650,6 +2652,41 @@ extern bool _bfd_elf_write_section_sframe
 extern bool _bfd_elf_set_section_sframe
   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
 
+#else /* !OBJ_MAYBE_ELF_SFRAME */
+
+static inline bool _bfd_elf_sframe_present
+  (struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{ return false; }
+static inline bool _bfd_elf_sframe_present_input_bfds
+  (struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{ return false; }
+static inline bool _bfd_elf_parse_sframe
+  (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info ATTRIBUTE_UNUSED,
+   asection *sec ATTRIBUTE_UNUSED,
+   struct elf_reloc_cookie *cookie ATTRIBUTE_UNUSED)
+{ return false; }
+static inline bool _bfd_elf_discard_section_sframe
+  (asection *sec ATTRIBUTE_UNUSED,
+  bool (*reloc_symbol_deleted_p) (bfd_vma, void *) ATTRIBUTE_UNUSED,
+  struct elf_reloc_cookie *cookie ATTRIBUTE_UNUSED)
+{ return false; }
+static inline bool _bfd_elf_merge_section_sframe
+  (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info ATTRIBUTE_UNUSED,
+   asection *sec ATTRIBUTE_UNUSED, bfd_byte *contents ATTRIBUTE_UNUSED)
+{ return false; }
+static inline bfd_vma _bfd_elf_sframe_section_offset
+  (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info ATTRIBUTE_UNUSED,
+   asection *sec ATTRIBUTE_UNUSED, bfd_vma offset)
+{ return offset; }
+static inline bool _bfd_elf_write_section_sframe
+  (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{ return true; }
+static inline bool _bfd_elf_set_section_sframe
+  (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{ return false; }
+
+#endif /* OBJ_MAYBE_ELF_SFRAME */
+
 extern bool _bfd_elf_hash_symbol
   (struct elf_link_hash_entry *) ATTRIBUTE_HIDDEN;