]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd/ELF: _bfd_elf_large_com_section is exposed to gas and x86-only
authorJan Beulich <jbeulich@suse.com>
Fri, 7 Nov 2025 13:59:45 +0000 (14:59 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 7 Nov 2025 13:59:45 +0000 (14:59 +0100)
As a non-private data item, it shouldn't have a "_bfd_" prefix, but merely
a "bfd_" one. Furthermore, as being x86-only (forever since its
introduction), it doesn't need to be present in libbfd.{a,so} at all for
other targets.

bfd/elf-bfd.h
bfd/elf.c
bfd/elf64-x86-64.c
bfd/elfxx-x86.c
gas/config/tc-i386.c

index daad203190293569506c15f32923b713d58e564b..6d55c745837056b242aa42bc5550413260c08024 100644 (file)
@@ -3222,8 +3222,8 @@ extern struct elf_link_hash_entry * _bfd_elf_get_link_hash_entry
 extern asection *_bfd_get_local_sym_section
   (struct elf_reloc_cookie *, unsigned int) ATTRIBUTE_HIDDEN;
 
-/* Large common section.  */
-extern asection _bfd_elf_large_com_section;
+/* Large common section (x86 only).  */
+extern asection bfd_elf_large_com_section;
 
 /* Hash for local symbol with the first section id, ID, in the input
    file and the local symbol index, SYM.  */
index 5e3ec17003e0335a57e8996aa6cee04daf5ced9f..e6e6a348ecab3579556d24720041845bf6da616e 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -13449,15 +13449,6 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd,
   return n;
 }
 
-/* It is only used by x86-64 so far.
-   ??? This repeats *COM* id of zero.  sec->id is supposed to be unique,
-   but current usage would allow all of _bfd_std_section to be zero.  */
-static const asymbol lcomm_sym
-  = GLOBAL_SYM_INIT ("LARGE_COMMON", &_bfd_elf_large_com_section);
-asection _bfd_elf_large_com_section
-  = BFD_FAKE_SECTION (_bfd_elf_large_com_section, &lcomm_sym,
-                     "LARGE_COMMON", 0, SEC_IS_COMMON);
-
 bool
 _bfd_elf_final_write_processing (bfd *abfd)
 {
index 199fe3bf139c7cedb93a801f5c531b5fa7587f67..26c6f0efc4ce4ad50b84c9d6b6e1348188c7dddb 100644 (file)
@@ -1961,7 +1961,7 @@ elf_x86_64_convert_load_reloc (bfd *abfd,
       else if (isym->st_shndx == SHN_COMMON)
        tsec = bfd_com_section_ptr;
       else if (isym->st_shndx == SHN_X86_64_LCOMMON)
-       tsec = &_bfd_elf_large_com_section;
+       tsec = &bfd_elf_large_com_section;
       else
        tsec = bfd_section_from_elf_index (abfd, isym->st_shndx);
     }
@@ -6055,7 +6055,7 @@ static bool
 elf_x86_64_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED,
                                         asection *sec, int *index_return)
 {
-  if (sec == &_bfd_elf_large_com_section)
+  if (sec == &bfd_elf_large_com_section)
     {
       *index_return = SHN_X86_64_LCOMMON;
       return true;
@@ -6074,7 +6074,7 @@ elf_x86_64_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
   switch (elfsym->internal_elf_sym.st_shndx)
     {
     case SHN_X86_64_LCOMMON:
-      asym->section = &_bfd_elf_large_com_section;
+      asym->section = &bfd_elf_large_com_section;
       asym->value = elfsym->internal_elf_sym.st_size;
       /* Common symbol doesn't set BSF_GLOBAL.  */
       asym->flags &= ~BSF_GLOBAL;
@@ -6104,7 +6104,7 @@ elf_x86_64_common_section (asection *sec)
   if ((elf_section_flags (sec) & SHF_X86_64_LARGE) == 0)
     return bfd_com_section_ptr;
   else
-    return &_bfd_elf_large_com_section;
+    return &bfd_elf_large_com_section;
 }
 
 static bool
index 842d600d5e41ddfa900dba235dc49c7b1137052c..94e22d4d04e950ecd0b4ffea24e590fc1186b3b3 100644 (file)
 #define ELF64_DYNAMIC_INTERPRETER "/lib/ld64.so.1"
 #define ELFX32_DYNAMIC_INTERPRETER "/lib/ldx32.so.1"
 
+/* ??? This repeats *COM* id of zero.  sec->id is supposed to be unique,
+   but current usage would allow all of _bfd_std_section to be zero.  */
+static const asymbol lcomm_sym
+  = GLOBAL_SYM_INIT ("LARGE_COMMON", &bfd_elf_large_com_section);
+asection bfd_elf_large_com_section
+  = BFD_FAKE_SECTION (bfd_elf_large_com_section, &lcomm_sym,
+                     "LARGE_COMMON", 0, SEC_IS_COMMON);
+
 bool
 _bfd_x86_elf_mkobject (bfd *abfd)
 {
@@ -1179,7 +1187,7 @@ _bfd_x86_elf_link_relax_section (bfd *abfd ATTRIBUTE_UNUSED,
            case SHN_X86_64_LCOMMON:
              if (!is_x86_64)
                abort ();
-             sec = &_bfd_elf_large_com_section;
+             sec = &bfd_elf_large_com_section;
              break;
            default:
              sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
index 44c8ae3a25b0b02d440b3463a308035c92a20182..eb282bff43c7865dba7a0cf83e52579f26eed24d 100644 (file)
@@ -18761,7 +18761,7 @@ handle_large_common (int small ATTRIBUTE_UNUSED)
          subseg_set (seg, subseg);
        }
 
-      elf_com_section_ptr = &_bfd_elf_large_com_section;
+      elf_com_section_ptr = &bfd_elf_large_com_section;
       bss_section = lbss_section;
 
       s_comm_internal (0, elf_common_parse);