projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ELF: Consolidate readonly_dynrelocs
[deliverable/binutils-gdb.git]
/
bfd
/
elf-m10300.c
diff --git
a/bfd/elf-m10300.c
b/bfd/elf-m10300.c
index 82f225391b41738682e1658d96dc9ae5f1128fd9..696514ab054c64824f6a81392748046b85608d33 100644
(file)
--- a/
bfd/elf-m10300.c
+++ b/
bfd/elf-m10300.c
@@
-1,5
+1,5
@@
/* Matsushita 10300 specific support for 32-bit ELF
/* Matsushita 10300 specific support for 32-bit ELF
- Copyright (C) 1996-20
18
Free Software Foundation, Inc.
+ Copyright (C) 1996-20
20
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
@@
-725,7
+725,7
@@
_bfd_mn10300_elf_create_got_section (bfd * abfd,
s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags);
htab->splt = s;
if (s == NULL
s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags);
htab->splt = s;
if (s == NULL
- || !
bfd_set_section_alignment (abfd,
s, bed->plt_alignment))
+ || !
bfd_set_section_alignment (
s, bed->plt_alignment))
return FALSE;
/* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the
return FALSE;
/* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the
@@
-742,7
+742,7
@@
_bfd_mn10300_elf_create_got_section (bfd * abfd,
s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
htab->sgot = s;
if (s == NULL
s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
htab->sgot = s;
if (s == NULL
- || !
bfd_set_section_alignment (abfd,
s, ptralign))
+ || !
bfd_set_section_alignment (
s, ptralign))
return FALSE;
if (bed->want_got_plt)
return FALSE;
if (bed->want_got_plt)
@@
-750,7
+750,7
@@
_bfd_mn10300_elf_create_got_section (bfd * abfd,
s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
htab->sgotplt = s;
if (s == NULL
s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
htab->sgotplt = s;
if (s == NULL
- || !
bfd_set_section_alignment (abfd,
s, ptralign))
+ || !
bfd_set_section_alignment (
s, ptralign))
return FALSE;
}
return FALSE;
}
@@
-798,8
+798,8
@@
bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
/* Set the howto pointer for an MN10300 ELF reloc. */
/* Set the howto pointer for an MN10300 ELF reloc. */
-static
void
-mn10300_info_to_howto (bfd *abfd
ATTRIBUTE_UNUSED
,
+static
bfd_boolean
+mn10300_info_to_howto (bfd *abfd,
arelent *cache_ptr,
Elf_Internal_Rela *dst)
{
arelent *cache_ptr,
Elf_Internal_Rela *dst)
{
@@
-809,12
+809,13
@@
mn10300_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
if (r_type >= R_MN10300_MAX)
{
/* xgettext:c-format */
if (r_type >= R_MN10300_MAX)
{
/* xgettext:c-format */
- _bfd_error_handler (_("%
B: unrecognised MN10300 reloc number: %d
"),
+ _bfd_error_handler (_("%
pB: unsupported relocation type %#x
"),
abfd, r_type);
bfd_set_error (bfd_error_bad_value);
abfd, r_type);
bfd_set_error (bfd_error_bad_value);
- r
_type = R_MN10300_NON
E;
+ r
eturn FALS
E;
}
cache_ptr->howto = elf_mn10300_howto_table + r_type;
}
cache_ptr->howto = elf_mn10300_howto_table + r_type;
+ return TRUE;
}
static int
}
static int
@@
-1025,7
+1026,7
@@
mn10300_do_tls_transition (bfd * input_bfd,
default:
_bfd_error_handler
/* xgettext:c-format */
default:
_bfd_error_handler
/* xgettext:c-format */
- (_("%
B: U
nsupported transition from %s to %s"),
+ (_("%
pB: u
nsupported transition from %s to %s"),
input_bfd,
elf_mn10300_howto_table[r_type].name,
elf_mn10300_howto_table[tls_r_type].name);
input_bfd,
elf_mn10300_howto_table[r_type].name,
elf_mn10300_howto_table[tls_r_type].name);
@@
-1135,9
+1136,7
@@
mn10300_elf_check_relocs (bfd *abfd,
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_MN10300_GNU_VTENTRY:
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_MN10300_GNU_VTENTRY:
- BFD_ASSERT (h != NULL);
- if (h != NULL
- && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+ if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
goto fail;
break;
goto fail;
break;
@@
-1194,7
+1193,7
@@
mn10300_elf_check_relocs (bfd *abfd,
else
_bfd_error_handler
/* xgettext:c-format */
else
_bfd_error_handler
/* xgettext:c-format */
- (_("%B: %s' accessed both as normal and thread local symbol"),
+ (_("%
p
B: %s' accessed both as normal and thread local symbol"),
abfd, h ? h->root.root.string : "<local>");
}
abfd, h ? h->root.root.string : "<local>");
}
@@
-1373,7
+1372,7
@@
mn10300_elf_check_relocs (bfd *abfd,
result = TRUE;
fail:
result = TRUE;
fail:
- if (
isymbuf != NULL &&
symtab_hdr->contents != (unsigned char *) isymbuf)
+ if (symtab_hdr->contents != (unsigned char *) isymbuf)
free (isymbuf);
return result;
free (isymbuf);
return result;
@@
-2090,10
+2089,11
@@
mn10300_elf_relocate_section (bfd *output_bfd,
_bfd_error_handler
/* xgettext:c-format */
_bfd_error_handler
/* xgettext:c-format */
- (_("%B(%A+%#Lx): unresolvable %s relocation against symbol `%s'"),
+ (_("%pB(%pA+%#" PRIx64 "): "
+ "unresolvable %s relocation against symbol `%s'"),
input_bfd,
input_section,
input_bfd,
input_section,
- rel->r_offset,
+
(uint64_t)
rel->r_offset,
howto->name,
h->root.root.root.string);
}
howto->name,
h->root.root.root.string);
}
@@
-2125,7
+2125,7
@@
mn10300_elf_relocate_section (bfd *output_bfd,
name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0')
name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0')
- name = bfd_section_name (
input_bfd,
sec);
+ name = bfd_section_name (sec);
}
switch (r)
}
switch (r)
@@
-2155,7
+2155,7
@@
mn10300_elf_relocate_section (bfd *output_bfd,
" library (did you forget -fpic?)");
else if (r_type == R_MN10300_GOT32)
/* xgettext:c-format */
" library (did you forget -fpic?)");
else if (r_type == R_MN10300_GOT32)
/* xgettext:c-format */
- msg = _("%B: taking the address of protected function"
+ msg = _("%
p
B: taking the address of protected function"
" '%s' cannot be done when making a shared library");
else
msg = _("internal error: suspicious relocation type used"
" '%s' cannot be done when making a shared library");
else
msg = _("internal error: suspicious relocation type used"
@@
-2743,7
+2743,7
@@
mn10300_elf_relax_section (bfd *abfd,
/* A local symbol. */
Elf_Internal_Sym *isym;
struct elf_link_hash_table *elftab;
/* A local symbol. */
Elf_Internal_Sym *isym;
struct elf_link_hash_table *elftab;
-
bfd_size_type
amt;
+
size_t
amt;
isym = isymbuf + r_index;
if (isym->st_shndx == SHN_UNDEF)
isym = isymbuf + r_index;
if (isym->st_shndx == SHN_UNDEF)
@@
-2844,7
+2844,7
@@
mn10300_elf_relax_section (bfd *abfd,
&& ELF_ST_TYPE (isym->st_info) == STT_FUNC)
{
struct elf_link_hash_table *elftab;
&& ELF_ST_TYPE (isym->st_info) == STT_FUNC)
{
struct elf_link_hash_table *elftab;
-
bfd_size_type
amt;
+
size_t
amt;
struct elf_link_hash_entry **lhashes = hashes;
/* Skip a local symbol if it aliases a
struct elf_link_hash_entry **lhashes = hashes;
/* Skip a local symbol if it aliases a
@@
-2912,8
+2912,7
@@
mn10300_elf_relax_section (bfd *abfd,
}
/* Cache or free any memory we allocated for the relocs. */
}
/* Cache or free any memory we allocated for the relocs. */
- if (internal_relocs != NULL
- && elf_section_data (section)->relocs != internal_relocs)
+ if (elf_section_data (section)->relocs != internal_relocs)
free (internal_relocs);
internal_relocs = NULL;
free (internal_relocs);
internal_relocs = NULL;
@@
-3069,7
+3068,7
@@
mn10300_elf_relax_section (bfd *abfd,
const char *sym_name;
char *new_name;
struct elf_link_hash_table *elftab;
const char *sym_name;
char *new_name;
struct elf_link_hash_table *elftab;
-
bfd_size_type
amt;
+
size_t
amt;
if (isym->st_shndx != sec_shndx)
continue;
if (isym->st_shndx != sec_shndx)
continue;
@@
-3222,8
+3221,7
@@
mn10300_elf_relax_section (bfd *abfd,
}
/* Cache or free any memory we allocated for the relocs. */
}
/* Cache or free any memory we allocated for the relocs. */
- if (internal_relocs != NULL
- && elf_section_data (section)->relocs != internal_relocs)
+ if (elf_section_data (section)->relocs != internal_relocs)
free (internal_relocs);
internal_relocs = NULL;
free (internal_relocs);
internal_relocs = NULL;
@@
-4391,21
+4389,17
@@
mn10300_elf_relax_section (bfd *abfd,
}
}
}
}
- if (internal_relocs != NULL
- && elf_section_data (sec)->relocs != internal_relocs)
+ if (elf_section_data (sec)->relocs != internal_relocs)
free (internal_relocs);
return TRUE;
error_return:
free (internal_relocs);
return TRUE;
error_return:
- if (isymbuf != NULL
- && symtab_hdr->contents != (unsigned char *) isymbuf)
+ if (symtab_hdr->contents != (unsigned char *) isymbuf)
free (isymbuf);
free (isymbuf);
- if (contents != NULL
- && elf_section_data (section)->this_hdr.contents != contents)
+ if (elf_section_data (section)->this_hdr.contents != contents)
free (contents);
free (contents);
- if (internal_relocs != NULL
- && elf_section_data (section)->relocs != internal_relocs)
+ if (elf_section_data (section)->relocs != internal_relocs)
free (internal_relocs);
return FALSE;
free (internal_relocs);
return FALSE;
@@
-4494,9
+4488,8
@@
mn10300_elf_get_relocated_section_contents (bfd *output_bfd,
isymbuf, sections))
goto error_return;
isymbuf, sections))
goto error_return;
- if (sections != NULL)
- free (sections);
- if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf)
+ free (sections);
+ if (symtab_hdr->contents != (unsigned char *) isymbuf)
free (isymbuf);
if (internal_relocs != elf_section_data (input_section)->relocs)
free (internal_relocs);
free (isymbuf);
if (internal_relocs != elf_section_data (input_section)->relocs)
free (internal_relocs);
@@
-4505,12
+4498,10
@@
mn10300_elf_get_relocated_section_contents (bfd *output_bfd,
return data;
error_return:
return data;
error_return:
- if (sections != NULL)
- free (sections);
- if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf)
+ free (sections);
+ if (symtab_hdr->contents != (unsigned char *) isymbuf)
free (isymbuf);
free (isymbuf);
- if (internal_relocs != NULL
- && internal_relocs != elf_section_data (input_section)->relocs)
+ if (internal_relocs != elf_section_data (input_section)->relocs)
free (internal_relocs);
return NULL;
}
free (internal_relocs);
return NULL;
}
@@
-4602,7
+4593,7
@@
static struct bfd_link_hash_table *
elf32_mn10300_link_hash_table_create (bfd *abfd)
{
struct elf32_mn10300_link_hash_table *ret;
elf32_mn10300_link_hash_table_create (bfd *abfd)
{
struct elf32_mn10300_link_hash_table *ret;
-
bfd_size_type
amt = sizeof (* ret);
+
size_t
amt = sizeof (* ret);
ret = bfd_zmalloc (amt);
if (ret == NULL)
ret = bfd_zmalloc (amt);
if (ret == NULL)
@@
-4667,9
+4658,8
@@
elf_mn10300_mach (flagword flags)
file. This gets the MN10300 architecture right based on the machine
number. */
file. This gets the MN10300 architecture right based on the machine
number. */
-static void
-_bfd_mn10300_elf_final_write_processing (bfd *abfd,
- bfd_boolean linker ATTRIBUTE_UNUSED)
+static bfd_boolean
+_bfd_mn10300_elf_final_write_processing (bfd *abfd)
{
unsigned long val;
{
unsigned long val;
@@
-4691,6
+4681,7
@@
_bfd_mn10300_elf_final_write_processing (bfd *abfd,
elf_elfheader (abfd)->e_flags &= ~ (EF_MN10300_MACH);
elf_elfheader (abfd)->e_flags |= val;
elf_elfheader (abfd)->e_flags &= ~ (EF_MN10300_MACH);
elf_elfheader (abfd)->e_flags |= val;
+ return _bfd_elf_final_write_processing (abfd);
}
static bfd_boolean
}
static bfd_boolean
@@
-4821,7
+4812,7
@@
_bfd_mn10300_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
flags | SEC_READONLY);
htab->root.srelplt = s;
if (s == NULL
flags | SEC_READONLY);
htab->root.srelplt = s;
if (s == NULL
- || !
bfd_set_section_alignment (abfd,
s, ptralign))
+ || !
bfd_set_section_alignment (
s, ptralign))
return FALSE;
if (! _bfd_mn10300_elf_create_got_section (abfd, info))
return FALSE;
if (! _bfd_mn10300_elf_create_got_section (abfd, info))
@@
-4858,7
+4849,7
@@
_bfd_mn10300_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
? ".rela.bss" : ".rel.bss"),
flags | SEC_READONLY);
if (s == NULL
? ".rela.bss" : ".rel.bss"),
flags | SEC_READONLY);
if (s == NULL
- || !
bfd_set_section_alignment (abfd,
s, ptralign))
+ || !
bfd_set_section_alignment (
s, ptralign))
return FALSE;
}
}
return FALSE;
}
}
@@
-5073,7
+5064,7
@@
_bfd_mn10300_elf_size_dynamic_sections (bfd * output_bfd,
/* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */
/* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */
- name = bfd_
get_section_name (dynobj,
s);
+ name = bfd_
section_name (
s);
if (streq (name, ".plt"))
{
if (streq (name, ".plt"))
{
@@
-5099,8
+5090,7
@@
_bfd_mn10300_elf_size_dynamic_sections (bfd * output_bfd,
entry. The entries in the .rela.plt section
really apply to the .got section, which we
created ourselves and so know is not readonly. */
entry. The entries in the .rela.plt section
really apply to the .got section, which we
created ourselves and so know is not readonly. */
- outname = bfd_get_section_name (output_bfd,
- s->output_section);
+ outname = bfd_section_name (s->output_section);
target = bfd_get_section_by_name (output_bfd, outname + 5);
if (target != NULL
&& (target->flags & SEC_READONLY) != 0
target = bfd_get_section_by_name (output_bfd, outname + 5);
if (target != NULL
&& (target->flags & SEC_READONLY) != 0
@@
-5543,7
+5533,7
@@
mn10300_elf_mkobject (bfd *abfd)
#endif
#define elf_info_to_howto mn10300_info_to_howto
#endif
#define elf_info_to_howto mn10300_info_to_howto
-#define elf_info_to_howto_rel
0
+#define elf_info_to_howto_rel
NULL
#define elf_backend_can_gc_sections 1
#define elf_backend_rela_normal 1
#define elf_backend_check_relocs mn10300_elf_check_relocs
#define elf_backend_can_gc_sections 1
#define elf_backend_rela_normal 1
#define elf_backend_check_relocs mn10300_elf_check_relocs
@@
-5574,8
+5564,7
@@
mn10300_elf_mkobject (bfd *abfd)
_bfd_mn10300_elf_adjust_dynamic_symbol
#define elf_backend_size_dynamic_sections \
_bfd_mn10300_elf_size_dynamic_sections
_bfd_mn10300_elf_adjust_dynamic_symbol
#define elf_backend_size_dynamic_sections \
_bfd_mn10300_elf_size_dynamic_sections
-#define elf_backend_omit_section_dynsym \
- ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) (bfd_boolean (*)) bfd_true)
+#define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all
#define elf_backend_finish_dynamic_symbol \
_bfd_mn10300_elf_finish_dynamic_symbol
#define elf_backend_finish_dynamic_sections \
#define elf_backend_finish_dynamic_symbol \
_bfd_mn10300_elf_finish_dynamic_symbol
#define elf_backend_finish_dynamic_sections \
This page took
0.028112 seconds
and
4
git commands to generate.