[PATCH 21/27] bfd/ELF: properly mark elf_appent_rel{a,}() as private
Jan Beulich
jbeulich@suse.com
Mon Oct 27 14:22:25 GMT 2025
Add _bfd_ prefixes and make them hidden.
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -3172,8 +3172,10 @@ extern bool _bfd_elf_allocate_ifunc_dyn_
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);
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -2547,7 +2547,7 @@ elf_i386_relocate_section (bfd *output_b
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_b
(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_b
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_b
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_b
+ 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_b
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_b
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_b
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_b
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_b
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 *out
_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 *out
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;
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -2525,7 +2525,7 @@ elf_s390_relocate_section (bfd *output_b
}
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,
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -2886,7 +2886,7 @@ elf_s390_relocate_section (bfd *output_b
}
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,
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -3564,7 +3564,7 @@ elf_x86_64_relocate_section (bfd *output
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,
@@ -3719,7 +3719,7 @@ elf_x86_64_relocate_section (bfd *output
(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)
@@ -4136,7 +4136,7 @@ elf_x86_64_relocate_section (bfd *output
(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
@@ -4657,7 +4657,7 @@ elf_x86_64_relocate_section (bfd *output
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;
@@ -4679,7 +4679,7 @@ elf_x86_64_relocate_section (bfd *output
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))
{
@@ -4697,8 +4697,7 @@ elf_x86_64_relocate_section (bfd *output
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);
}
}
@@ -5001,8 +5000,7 @@ elf_x86_64_relocate_section (bfd *output
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
@@ -5537,7 +5535,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *o
_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);
}
}
@@ -5558,7 +5556,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *o
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;
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -15610,7 +15610,7 @@ _bfd_elf_copy_link_hash_symbol_type (bfd
/* 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);
@@ -15621,7 +15621,7 @@ elf_append_rela (bfd *abfd, asection *s,
/* 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);
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -5825,7 +5825,7 @@ elfNN_aarch64_final_link_relocate (reloc
}
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
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;
--- a/bfd/elfnn-kvx.c
+++ b/bfd/elfnn-kvx.c
@@ -2408,7 +2408,7 @@ elfNN_kvx_final_link_relocate (reloc_how
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);
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -731,7 +731,7 @@ _bfd_x86_elf_link_hash_table_create (bfd
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
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;
More information about the Binutils
mailing list