From: Jan Beulich Date: Fri, 7 Nov 2025 13:57:36 +0000 (+0100) Subject: bfd/ELF: properly mark elf_appent_rel{a,}() as private X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82cb152b06342e2af0a60af998153fa48252df8b;p=thirdparty%2Fbinutils-gdb.git bfd/ELF: properly mark elf_appent_rel{a,}() as private Add _bfd_ prefixes and make them hidden. --- diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 8c3639f00eb..8f5fb764324 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -3177,8 +3177,10 @@ extern bool _bfd_elf_allocate_ifunc_dyn_relocs struct elf_dyn_relocs **, unsigned int, unsigned int, unsigned int, bool) ATTRIBUTE_HIDDEN; -extern void elf_append_rela (bfd *, asection *, Elf_Internal_Rela *); -extern void elf_append_rel (bfd *, asection *, Elf_Internal_Rela *); +extern void _bfd_elf_append_rela + (bfd *, asection *, Elf_Internal_Rela *) ATTRIBUTE_HIDDEN; +extern void _bfd_elf_append_rel + (bfd *, asection *, Elf_Internal_Rela *) ATTRIBUTE_HIDDEN; extern bfd_vma elf64_r_info (bfd_vma, bfd_vma); extern bfd_vma elf64_r_sym (bfd_vma); diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 0d60eded701..c8871334427 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -2547,7 +2547,7 @@ elf_i386_relocate_section (bfd *output_bfd, sreloc = htab->elf.srelgot; else sreloc = htab->elf.irelplt; - elf_append_rel (output_bfd, sreloc, &outrel); + _bfd_elf_append_rel (output_bfd, sreloc, &outrel); /* If this reloc is against an external symbol, we do not want to fiddle with the addend. Otherwise, @@ -2666,7 +2666,7 @@ elf_i386_relocate_section (bfd *output_bfd, (info, input_section, h, sym, "R_386_RELATIVE", &outrel); - elf_append_rel (output_bfd, s, &outrel); + _bfd_elf_append_rel (output_bfd, s, &outrel); } if (off >= (bfd_vma) -2) @@ -2898,7 +2898,7 @@ elf_i386_relocate_section (bfd *output_bfd, goto check_relocation_error; } - elf_append_rel (output_bfd, sreloc, &outrel); + _bfd_elf_append_rel (output_bfd, sreloc, &outrel); } /* If this reloc is against an external symbol, we do @@ -2929,7 +2929,7 @@ elf_i386_relocate_section (bfd *output_bfd, sreloc = elf_section_data (input_section)->sreloc; if (sreloc == NULL) abort (); - elf_append_rel (output_bfd, sreloc, &outrel); + _bfd_elf_append_rel (output_bfd, sreloc, &outrel); } /* Fall through */ @@ -3192,7 +3192,7 @@ elf_i386_relocate_section (bfd *output_bfd, + offplt + htab->sgotplt_jump_table_size); sreloc = htab->rel_tls_desc; - elf_append_rel (output_bfd, sreloc, &outrel); + _bfd_elf_append_rel (output_bfd, sreloc, &outrel); if (indx == 0) { BFD_ASSERT (! unresolved_reloc); @@ -3236,7 +3236,7 @@ elf_i386_relocate_section (bfd *output_bfd, htab->elf.sgot->contents + off); outrel.r_info = ELF32_R_INFO (indx, dr_type); - elf_append_rel (output_bfd, sreloc, &outrel); + _bfd_elf_append_rel (output_bfd, sreloc, &outrel); if (GOT_TLS_GD_P (tls_type)) { @@ -3254,7 +3254,7 @@ elf_i386_relocate_section (bfd *output_bfd, outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_DTPOFF32); outrel.r_offset += 4; - elf_append_rel (output_bfd, sreloc, &outrel); + _bfd_elf_append_rel (output_bfd, sreloc, &outrel); } } else if (tls_type == GOT_TLS_IE_BOTH) @@ -3266,7 +3266,7 @@ elf_i386_relocate_section (bfd *output_bfd, htab->elf.sgot->contents + off + 4); outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_TPOFF); outrel.r_offset += 4; - elf_append_rel (output_bfd, sreloc, &outrel); + _bfd_elf_append_rel (output_bfd, sreloc, &outrel); } dr_done: @@ -3492,7 +3492,7 @@ elf_i386_relocate_section (bfd *output_bfd, bfd_put_32 (output_bfd, 0, htab->elf.sgot->contents + off + 4); outrel.r_info = ELF32_R_INFO (0, R_386_TLS_DTPMOD32); - elf_append_rel (output_bfd, htab->elf.srelgot, &outrel); + _bfd_elf_append_rel (output_bfd, htab->elf.srelgot, &outrel); htab->tls_ld_or_ldm_got.offset |= 1; } relocation = htab->elf.sgot->output_section->vma @@ -3532,7 +3532,7 @@ elf_i386_relocate_section (bfd *output_bfd, sreloc = elf_section_data (input_section)->sreloc; if (sreloc == NULL) abort (); - elf_append_rel (output_bfd, sreloc, &outrel); + _bfd_elf_append_rel (output_bfd, sreloc, &outrel); if (indx) continue; else if (r_type == R_386_TLS_LE_32) @@ -4026,7 +4026,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, _bfd_x86_elf_link_report_relative_reloc (info, relgot, h, sym, relative_reloc_name, &rel); - elf_append_rel (output_bfd, relgot, &rel); + _bfd_elf_append_rel (output_bfd, relgot, &rel); } } @@ -4046,7 +4046,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, s = htab->elf.sreldynrelro; else s = htab->elf.srelbss; - elf_append_rel (output_bfd, s, &rel); + _bfd_elf_append_rel (output_bfd, s, &rel); } return true; diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 1216aeed1ab..52aad070d44 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -2532,7 +2532,7 @@ elf_s390_relocate_section (bfd *output_bfd, } sreloc = htab->elf.irelifunc; - elf_append_rela (output_bfd, sreloc, &outrel); + _bfd_elf_append_rela (output_bfd, sreloc, &outrel); /* If this reloc is against an external symbol, we do not want to fiddle with the addend. Otherwise, diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 8e41104b580..96ba8b3cd77 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -2906,7 +2906,7 @@ elf_s390_relocate_section (bfd *output_bfd, } sreloc = htab->elf.irelifunc; - elf_append_rela (output_bfd, sreloc, &outrel); + _bfd_elf_append_rela (output_bfd, sreloc, &outrel); /* If this reloc is against an external symbol, we do not want to fiddle with the addend. Otherwise, diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index a4a5ebf595e..199fe3bf139 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -3566,7 +3566,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, sreloc = htab->elf.srelgot; else sreloc = htab->elf.irelplt; - elf_append_rela (output_bfd, sreloc, &outrel); + _bfd_elf_append_rela (output_bfd, sreloc, &outrel); /* If this reloc is against an external symbol, we do not want to fiddle with the addend. Otherwise, @@ -3721,7 +3721,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, (info, input_section, h, sym, "R_X86_64_RELATIVE", &outrel); - elf_append_rela (output_bfd, s, &outrel); + _bfd_elf_append_rela (output_bfd, s, &outrel); } if (off >= (bfd_vma) -2) @@ -4138,7 +4138,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, (info, input_section, h, sym, relative_reloc_name, &outrel); - elf_append_rela (output_bfd, sreloc, &outrel); + _bfd_elf_append_rela (output_bfd, sreloc, &outrel); } /* If this reloc is against an external symbol, we do @@ -4659,7 +4659,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, outrel.r_addend = relocation - _bfd_x86_elf_dtpoff_base (info); else outrel.r_addend = 0; - elf_append_rela (output_bfd, sreloc, &outrel); + _bfd_elf_append_rela (output_bfd, sreloc, &outrel); } sreloc = htab->elf.srelgot; @@ -4681,7 +4681,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, outrel.r_addend = relocation - _bfd_x86_elf_dtpoff_base (info); outrel.r_info = htab->r_info (indx, dr_type); - elf_append_rela (output_bfd, sreloc, &outrel); + _bfd_elf_append_rela (output_bfd, sreloc, &outrel); if (GOT_TLS_GD_P (tls_type)) { @@ -4699,8 +4699,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, outrel.r_info = htab->r_info (indx, R_X86_64_DTPOFF64); outrel.r_offset += GOT_ENTRY_SIZE; - elf_append_rela (output_bfd, sreloc, - &outrel); + _bfd_elf_append_rela (output_bfd, sreloc, &outrel); } } @@ -5003,8 +5002,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, htab->elf.sgot->contents + off + GOT_ENTRY_SIZE); outrel.r_info = htab->r_info (0, R_X86_64_DTPMOD64); outrel.r_addend = 0; - elf_append_rela (output_bfd, htab->elf.srelgot, - &outrel); + _bfd_elf_append_rela (output_bfd, htab->elf.srelgot, &outrel); htab->tls_ld_or_ldm_got.offset |= 1; } relocation = htab->elf.sgot->output_section->vma @@ -5539,7 +5537,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, _bfd_x86_elf_link_report_relative_reloc (info, relgot, h, sym, relative_reloc_name, &rela); - elf_append_rela (output_bfd, relgot, &rela); + _bfd_elf_append_rela (output_bfd, relgot, &rela); } } @@ -5560,7 +5558,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, s = htab->elf.sreldynrelro; else s = htab->elf.srelbss; - elf_append_rela (output_bfd, s, &rela); + _bfd_elf_append_rela (output_bfd, s, &rela); } return true; diff --git a/bfd/elflink.c b/bfd/elflink.c index f73ceb23c8b..635fdec8bbe 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -15620,7 +15620,7 @@ _bfd_elf_copy_link_hash_symbol_type (bfd *abfd, /* Append a RELA relocation REL to section S in BFD. */ void -elf_append_rela (bfd *abfd, asection *s, Elf_Internal_Rela *rel) +_bfd_elf_append_rela (bfd *abfd, asection *s, Elf_Internal_Rela *rel) { const struct elf_backend_data *bed = get_elf_backend_data (abfd); bfd_byte *loc = s->contents + (s->reloc_count++ * bed->s->sizeof_rela); @@ -15631,7 +15631,7 @@ elf_append_rela (bfd *abfd, asection *s, Elf_Internal_Rela *rel) /* Append a REL relocation REL to section S in BFD. */ void -elf_append_rel (bfd *abfd, asection *s, Elf_Internal_Rela *rel) +_bfd_elf_append_rel (bfd *abfd, asection *s, Elf_Internal_Rela *rel) { const struct elf_backend_data *bed = get_elf_backend_data (abfd); bfd_byte *loc = s->contents + (s->reloc_count++ * bed->s->sizeof_rel); diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index b529c3d43cc..60bc946d196 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -5825,7 +5825,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, } sreloc = globals->root.irelifunc; - elf_append_rela (output_bfd, sreloc, &outrel); + _bfd_elf_append_rela (output_bfd, sreloc, &outrel); /* If this reloc is against an external symbol, we do not want to fiddle with the addend. Otherwise, @@ -6290,7 +6290,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, outrel.r_offset = got_entry_addr; outrel.r_info = ELFNN_R_INFO (0, AARCH64_R (RELATIVE)); outrel.r_addend = orig_value; - elf_append_rela (output_bfd, s, &outrel); + _bfd_elf_append_rela (output_bfd, s, &outrel); } break; diff --git a/bfd/elfnn-kvx.c b/bfd/elfnn-kvx.c index 3b44db57421..fb71a5bc962 100644 --- a/bfd/elfnn-kvx.c +++ b/bfd/elfnn-kvx.c @@ -2408,7 +2408,7 @@ elfNN_kvx_final_link_relocate (reloc_howto_type *howto, outrel.r_offset = got_entry_addr; outrel.r_info = ELFNN_R_INFO (0, R_KVX_RELATIVE); outrel.r_addend = value; - elf_append_rela (output_bfd, s, &outrel); + _bfd_elf_append_rela (output_bfd, s, &outrel); } symbol_got_offset_mark (input_bfd, h, r_symndx); diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index 7a54722bd27..842d600d5e4 100644 --- a/bfd/elfxx-x86.c +++ b/bfd/elfxx-x86.c @@ -731,7 +731,7 @@ _bfd_x86_elf_link_hash_table_create (bfd *abfd) ret->relative_r_type = R_X86_64_RELATIVE; ret->relative_r_name = "R_X86_64_RELATIVE"; ret->ax_register = "RAX"; - ret->elf_append_reloc = elf_append_rela; + ret->elf_append_reloc = _bfd_elf_append_rela; ret->elf_write_addend_in_got = _bfd_elf64_write_addend; } if (ABI_64_P (abfd)) @@ -763,7 +763,7 @@ _bfd_x86_elf_link_hash_table_create (bfd *abfd) ret->relative_r_type = R_386_RELATIVE; ret->relative_r_name = "R_386_RELATIVE"; ret->ax_register = "EAX"; - ret->elf_append_reloc = elf_append_rel; + ret->elf_append_reloc = _bfd_elf_append_rel; ret->elf_write_addend = _bfd_elf32_write_addend; ret->elf_write_addend_in_got = _bfd_elf32_write_addend; ret->dynamic_interpreter = ELF32_DYNAMIC_INTERPRETER;