aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2009-05-21 14:15:50 +0000
committerAlan Modra <amodra@gmail.com>2009-05-21 14:15:50 +0000
commit6e0b88f1b8d24ad0c318a989dd582e0d2205e03f (patch)
tree5d5f15d944c47e24ccc89a52398f5e7ff7dea0ba /bfd
parent5ef11c0214f8a01a6bc0a5dd9c51383012c372c5 (diff)
downloadgdb-6e0b88f1b8d24ad0c318a989dd582e0d2205e03f.zip
gdb-6e0b88f1b8d24ad0c318a989dd582e0d2205e03f.tar.gz
gdb-6e0b88f1b8d24ad0c318a989dd582e0d2205e03f.tar.bz2
* elf-bfd.h (struct elf_backend_data
<elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog33
-rw-r--r--bfd/elf-bfd.h6
-rw-r--r--bfd/elf-vxworks.c4
-rw-r--r--bfd/elf32-arm.c20
-rw-r--r--bfd/elf32-cr16c.c4
-rw-r--r--bfd/elf32-score.c8
-rw-r--r--bfd/elf32-score.h2
-rw-r--r--bfd/elf32-score7.c4
-rw-r--r--bfd/elf32-sh64.c6
-rw-r--r--bfd/elf32-spu.c4
-rw-r--r--bfd/elf32-v850.c4
-rw-r--r--bfd/elf64-hppa.c8
-rw-r--r--bfd/elf64-mmix.c6
-rw-r--r--bfd/elf64-ppc.c14
-rw-r--r--bfd/elf64-sh64.c4
-rw-r--r--bfd/elf64-sparc.c17
-rw-r--r--bfd/elflink.c74
-rw-r--r--bfd/elfxx-mips.c4
-rw-r--r--bfd/elfxx-mips.h2
19 files changed, 139 insertions, 85 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 50ef873..68443df 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,38 @@
2009-05-21 Alan Modra <amodra@bigpond.net.au>
+ * elf-bfd.h (struct elf_backend_data
+ <elf_backend_link_output_symbol_hook>): Return an int.
+ * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop
+ symbols on deleted .opd entries.
+ * elflink.c (elf_link_output_sym): Return without outputting sym
+ if output_symbol_hook returns 2.
+ (elf_link_output_extsym): Don't assign h->indx when symbol discarded.
+ Abort if we must not discard sym.
+ (elf_link_input_bfd): Similarly, don't set finfo->indices for
+ local syms.
+ (bfd_elf_final_link): Adjust elf_link_output_sym calls.
+ * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for
+ elf_backend_link_output_symbol_hook return type change.
+ * elf32-arm.c (output_arch_syminfo): Likewise.
+ (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise.
+ (elf32_arm_output_arch_local_syms): Likewise.
+ * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise.
+ * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise.
+ (bfd_score_elf_link_output_symbol_hook): Likewise.
+ * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise.
+ * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise.
+ * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise.
+ * elf32-spu.c (spu_elf_output_symbol_hook): Likewise.
+ * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise.
+ * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise.
+ * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise.
+ * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise.
+ * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise.
+ * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
+
+2009-05-21 Alan Modra <amodra@bigpond.net.au>
+
* elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Don't segfault on
out of range .opd symbols.
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 5761923..2fbff30 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -745,8 +745,10 @@ struct elf_backend_data
const char **name, flagword *flags, asection **sec, bfd_vma *value);
/* If this field is not NULL, it is called by the elf_link_output_sym
- phase of a link for each symbol which will appear in the object file. */
- bfd_boolean (*elf_backend_link_output_symbol_hook)
+ phase of a link for each symbol which will appear in the object file.
+ On error, this function returns 0. 1 is returned when the symbol
+ should be output, 2 is returned when the symbol should be discarded. */
+ int (*elf_backend_link_output_symbol_hook)
(struct bfd_link_info *info, const char *, Elf_Internal_Sym *,
asection *, struct elf_link_hash_entry *);
diff --git a/bfd/elf-vxworks.c b/bfd/elf-vxworks.c
index 2b0c725..b26320c 100644
--- a/bfd/elf-vxworks.c
+++ b/bfd/elf-vxworks.c
@@ -127,7 +127,7 @@ elf_vxworks_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info,
}
/* Tweak magic VxWorks symbols as they are written to the output file. */
-bfd_boolean
+int
elf_vxworks_link_output_symbol_hook (struct bfd_link_info *info
ATTRIBUTE_UNUSED,
const char *name,
@@ -141,7 +141,7 @@ elf_vxworks_link_output_symbol_hook (struct bfd_link_info *info
&& elf_vxworks_gott_symbol_p (h->root.u.undef.abfd, name))
sym->st_info = ELF_ST_INFO (STB_GLOBAL, ELF_ST_TYPE (sym->st_info));
- return TRUE;
+ return 1;
}
/* Copy relocations into the output file. Fixes up relocations against PLT
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 1dbac1d..7c82966 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -11998,8 +11998,8 @@ typedef struct
struct bfd_link_info *info;
asection *sec;
int sec_shndx;
- bfd_boolean (*func) (void *, const char *, Elf_Internal_Sym *,
- asection *, struct elf_link_hash_entry *);
+ int (*func) (void *, const char *, Elf_Internal_Sym *,
+ asection *, struct elf_link_hash_entry *);
} output_arch_syminfo;
enum map_symbol_type
@@ -12029,9 +12029,7 @@ elf32_arm_output_map_sym (output_arch_syminfo *osi,
sym.st_other = 0;
sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_NOTYPE);
sym.st_shndx = osi->sec_shndx;
- if (!osi->func (osi->finfo, names[type], &sym, osi->sec, NULL))
- return FALSE;
- return TRUE;
+ return osi->func (osi->finfo, names[type], &sym, osi->sec, NULL) == 1;
}
@@ -12129,9 +12127,7 @@ elf32_arm_output_stub_sym (output_arch_syminfo *osi, const char *name,
sym.st_other = 0;
sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FUNC);
sym.st_shndx = osi->sec_shndx;
- if (!osi->func (osi->finfo, name, &sym, osi->sec, NULL))
- return FALSE;
- return TRUE;
+ return osi->func (osi->finfo, name, &sym, osi->sec, NULL) == 1;
}
static bfd_boolean
@@ -12244,10 +12240,10 @@ static bfd_boolean
elf32_arm_output_arch_local_syms (bfd *output_bfd,
struct bfd_link_info *info,
void *finfo,
- bfd_boolean (*func) (void *, const char *,
- Elf_Internal_Sym *,
- asection *,
- struct elf_link_hash_entry *))
+ int (*func) (void *, const char *,
+ Elf_Internal_Sym *,
+ asection *,
+ struct elf_link_hash_entry *))
{
output_arch_syminfo osi;
struct elf32_arm_link_hash_table *htab;
diff --git a/bfd/elf32-cr16c.c b/bfd/elf32-cr16c.c
index 08730e2..fa37c1a 100644
--- a/bfd/elf32-cr16c.c
+++ b/bfd/elf32-cr16c.c
@@ -927,7 +927,7 @@ elf32_cr16c_add_symbol_hook (bfd *abfd,
return TRUE;
}
-static bfd_boolean
+static int
elf32_cr16c_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
const char *name ATTRIBUTE_UNUSED,
Elf_Internal_Sym *sym,
@@ -946,7 +946,7 @@ elf32_cr16c_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED
sym->st_shndx = SHN_CR16C_NCOMMON;
}
- return TRUE;
+ return 1;
}
/* Definitions for setting CR16C target vector. */
diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c
index d5e21b5..a330828 100644
--- a/bfd/elf32-score.c
+++ b/bfd/elf32-score.c
@@ -3068,7 +3068,7 @@ s3_bfd_score_elf_symbol_processing (bfd *abfd, asymbol *asym)
}
}
-static bfd_boolean
+static int
s3_bfd_score_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
const char *name ATTRIBUTE_UNUSED,
Elf_Internal_Sym *sym,
@@ -3081,7 +3081,7 @@ s3_bfd_score_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_U
if (sym->st_shndx == SHN_COMMON && strcmp (input_sec->name, ".scommon") == 0)
sym->st_shndx = SHN_SCORE_SCOMMON;
- return TRUE;
+ return 1;
}
static bfd_boolean
@@ -4179,7 +4179,7 @@ _bfd_score_elf_symbol_processing (bfd *abfd, asymbol *asym)
return s7_bfd_score_elf_symbol_processing (abfd, asym);
}
-static bfd_boolean
+static int
_bfd_score_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
const char *name ATTRIBUTE_UNUSED,
Elf_Internal_Sym *sym,
@@ -4194,7 +4194,7 @@ _bfd_score_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNU
common in the output file. */
if (sym->st_shndx == SHN_COMMON && strcmp (input_sec->name, ".scommon") == 0)
sym->st_shndx = SHN_SCORE_SCOMMON;
- return TRUE;
+ return 1;
}
if (bfd_get_mach (info->input_bfds) == bfd_mach_score3)
diff --git a/bfd/elf32-score.h b/bfd/elf32-score.h
index d842051..54bd092 100644
--- a/bfd/elf32-score.h
+++ b/bfd/elf32-score.h
@@ -61,7 +61,7 @@ s7_bfd_score_elf_add_symbol_hook (bfd *,
extern void
s7_bfd_score_elf_symbol_processing (bfd *, asymbol *);
-extern bfd_boolean
+extern int
s7_bfd_score_elf_link_output_symbol_hook (struct bfd_link_info *,
const char *,
Elf_Internal_Sym *,
diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c
index 81d0dcb..af37817 100644
--- a/bfd/elf32-score7.c
+++ b/bfd/elf32-score7.c
@@ -2903,7 +2903,7 @@ s7_bfd_score_elf_symbol_processing (bfd *abfd, asymbol *asym)
}
}
-bfd_boolean
+int
s7_bfd_score_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
const char *name ATTRIBUTE_UNUSED,
Elf_Internal_Sym *sym,
@@ -2916,7 +2916,7 @@ s7_bfd_score_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_U
if (sym->st_shndx == SHN_COMMON && strcmp (input_sec->name, ".scommon") == 0)
sym->st_shndx = SHN_SCORE_SCOMMON;
- return TRUE;
+ return 1;
}
bfd_boolean
diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c
index 3de8562..cc48032 100644
--- a/bfd/elf32-sh64.c
+++ b/bfd/elf32-sh64.c
@@ -60,7 +60,7 @@ static int sh64_elf_get_symbol_type
static bfd_boolean sh64_elf_add_symbol_hook
(bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **,
flagword *, asection **, bfd_vma *);
-static bfd_boolean sh64_elf_link_output_symbol_hook
+static int sh64_elf_link_output_symbol_hook
(struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *,
struct elf_link_hash_entry *);
static bfd_boolean sh64_backend_section_from_shdr
@@ -477,7 +477,7 @@ sh64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
we don't need to look up and make sure to emit the main symbol for each
DataLabel symbol. */
-bfd_boolean
+static int
sh64_elf_link_output_symbol_hook (struct bfd_link_info *info,
const char *cname,
Elf_Internal_Sym *sym,
@@ -492,7 +492,7 @@ sh64_elf_link_output_symbol_hook (struct bfd_link_info *info,
name[strlen (name) - strlen (DATALABEL_SUFFIX)] = 0;
}
- return TRUE;
+ return 1;
}
/* Check a SH64-specific reloc and put the value to relocate to into
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
index 5c63d15..728cb45 100644
--- a/bfd/elf32-spu.c
+++ b/bfd/elf32-spu.c
@@ -4984,7 +4984,7 @@ spu_elf_relocate_section (bfd *output_bfd,
/* Adjust _SPUEAR_ syms to point at their overlay stubs. */
-static bfd_boolean
+static int
spu_elf_output_symbol_hook (struct bfd_link_info *info,
const char *sym_name ATTRIBUTE_UNUSED,
Elf_Internal_Sym *sym,
@@ -5016,7 +5016,7 @@ spu_elf_output_symbol_hook (struct bfd_link_info *info,
}
}
- return TRUE;
+ return 1;
}
static int spu_plugin = 0;
diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c
index 8f9eda4..5ecfa69 100644
--- a/bfd/elf32-v850.c
+++ b/bfd/elf32-v850.c
@@ -2095,7 +2095,7 @@ v850_elf_add_symbol_hook (bfd *abfd,
return TRUE;
}
-static bfd_boolean
+static int
v850_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
const char *name ATTRIBUTE_UNUSED,
Elf_Internal_Sym *sym,
@@ -2122,7 +2122,7 @@ v850_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
sym->st_other &= ~(V850_OTHER_SDA | V850_OTHER_ZDA | V850_OTHER_TDA
| V850_OTHER_ERROR);
- return TRUE;
+ return 1;
}
static bfd_boolean
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index 1b5de6e..0b762e4 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -184,7 +184,7 @@ static bfd_boolean elf64_hppa_mark_milli_and_exported_functions
static bfd_boolean elf64_hppa_size_dynamic_sections
(bfd *, struct bfd_link_info *);
-static bfd_boolean elf64_hppa_link_output_symbol_hook
+static int elf64_hppa_link_output_symbol_hook
(struct bfd_link_info *, const char *, Elf_Internal_Sym *,
asection *, struct elf_link_hash_entry *);
@@ -1914,7 +1914,7 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
the symbols have their expected value in the normal symbol
table. Ick. */
-static bfd_boolean
+static int
elf64_hppa_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
const char *name,
Elf_Internal_Sym *sym,
@@ -1926,7 +1926,7 @@ elf64_hppa_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
/* We may be called with the file symbol or section symbols.
They never need munging, so it is safe to ignore them. */
if (!name || !eh)
- return TRUE;
+ return 1;
/* Function symbols for which we created .opd entries *may* have been
munged by finish_dynamic_symbol and have to be un-munged here.
@@ -1942,7 +1942,7 @@ elf64_hppa_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
sym->st_shndx = hh->st_shndx;
}
- return TRUE;
+ return 1;
}
/* Finish up dynamic symbol handling. We set the contents of various
diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c
index 9a37840..4793047 100644
--- a/bfd/elf64-mmix.c
+++ b/bfd/elf64-mmix.c
@@ -159,7 +159,7 @@ struct bpo_greg_section_info
struct bpo_reloc_request *reloc_request;
};
-static bfd_boolean mmix_elf_link_output_symbol_hook
+static int mmix_elf_link_output_symbol_hook
PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *,
asection *, struct elf_link_hash_entry *));
@@ -2082,7 +2082,7 @@ _bfd_mmix_check_all_relocs (abfd, info)
the register section, and scale them down to correspond to the register
number. */
-static bfd_boolean
+static int
mmix_elf_link_output_symbol_hook (info, name, sym, input_sec, h)
struct bfd_link_info *info ATTRIBUTE_UNUSED;
const char *name ATTRIBUTE_UNUSED;
@@ -2099,7 +2099,7 @@ mmix_elf_link_output_symbol_hook (info, name, sym, input_sec, h)
sym->st_shndx = SHN_REGISTER;
}
- return TRUE;
+ return 1;
}
/* We fake a register section that holds values that are register numbers.
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index ae3c3b9..e68edf1 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -11759,7 +11759,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
/* Adjust the value of any local symbols in opd sections. */
-static bfd_boolean
+static int
ppc64_elf_output_symbol_hook (struct bfd_link_info *info,
const char *name ATTRIBUTE_UNUSED,
Elf_Internal_Sym *elfsym,
@@ -11771,11 +11771,11 @@ ppc64_elf_output_symbol_hook (struct bfd_link_info *info,
bfd_vma value;
if (h != NULL)
- return TRUE;
+ return 1;
opd = get_opd_info (input_sec);
if (opd == NULL || opd->adjust == NULL)
- return TRUE;
+ return 1;
value = elfsym->st_value - input_sec->output_offset;
if (!info->relocatable)
@@ -11783,10 +11783,10 @@ ppc64_elf_output_symbol_hook (struct bfd_link_info *info,
adjust = opd->adjust[value / 8];
if (adjust == -1)
- elfsym->st_value = 0;
- else
- elfsym->st_value += adjust;
- return TRUE;
+ return 2;
+
+ elfsym->st_value += adjust;
+ return 1;
}
/* Finish up dynamic symbol handling. We set the contents of various
diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c
index e76aeb7..4d47438 100644
--- a/bfd/elf64-sh64.c
+++ b/bfd/elf64-sh64.c
@@ -2879,7 +2879,7 @@ sh64_elf64_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
we don't need to look up and make sure to emit the main symbol for each
DataLabel symbol. */
-static bfd_boolean
+static int
sh64_elf64_link_output_symbol_hook (struct bfd_link_info *info,
const char *cname,
Elf_Internal_Sym *sym,
@@ -2894,7 +2894,7 @@ sh64_elf64_link_output_symbol_hook (struct bfd_link_info *info,
name[strlen (name) - strlen (DATALABEL_SUFFIX)] = 0;
}
- return TRUE;
+ return 1;
}
/* Set bit 0 on the entry address; it always points to SHmedia code. This
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index df3fb8b..e5af728 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -538,10 +538,11 @@ elf64_sparc_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
static bfd_boolean
elf64_sparc_output_arch_syms (bfd *output_bfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info,
- PTR finfo, bfd_boolean (*func) (PTR, const char *,
- Elf_Internal_Sym *,
- asection *,
- struct elf_link_hash_entry *))
+ PTR finfo,
+ int (*func) (PTR, const char *,
+ Elf_Internal_Sym *,
+ asection *,
+ struct elf_link_hash_entry *))
{
int reg;
struct _bfd_sparc_elf_app_reg *app_regs =
@@ -585,10 +586,10 @@ elf64_sparc_output_arch_syms (bfd *output_bfd ATTRIBUTE_UNUSED,
sym.st_other = 0;
sym.st_info = ELF_ST_INFO (app_regs [reg].bind, STT_REGISTER);
sym.st_shndx = app_regs [reg].shndx;
- if (! (*func) (finfo, app_regs [reg].name, &sym,
- sym.st_shndx == SHN_ABS
- ? bfd_abs_section_ptr : bfd_und_section_ptr,
- NULL))
+ if ((*func) (finfo, app_regs [reg].name, &sym,
+ sym.st_shndx == SHN_ABS
+ ? bfd_abs_section_ptr : bfd_und_section_ptr,
+ NULL) != 1)
return FALSE;
}
diff --git a/bfd/elflink.c b/bfd/elflink.c
index bfbf79a..61c510f 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -8196,7 +8196,7 @@ elf_link_flush_output_syms (struct elf_final_link_info *finfo,
/* Add a symbol to the output symbol table. */
-static bfd_boolean
+static int
elf_link_output_sym (struct elf_final_link_info *finfo,
const char *name,
Elf_Internal_Sym *elfsym,
@@ -8205,7 +8205,7 @@ elf_link_output_sym (struct elf_final_link_info *finfo,
{
bfd_byte *dest;
Elf_External_Sym_Shndx *destshndx;
- bfd_boolean (*output_symbol_hook)
+ int (*output_symbol_hook)
(struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *,
struct elf_link_hash_entry *);
const struct elf_backend_data *bed;
@@ -8214,8 +8214,9 @@ elf_link_output_sym (struct elf_final_link_info *finfo,
output_symbol_hook = bed->elf_backend_link_output_symbol_hook;
if (output_symbol_hook != NULL)
{
- if (! (*output_symbol_hook) (finfo->info, name, elfsym, input_sec, h))
- return FALSE;
+ int ret = (*output_symbol_hook) (finfo->info, name, elfsym, input_sec, h);
+ if (ret != 1)
+ return ret;
}
if (name == NULL || *name == '\0')
@@ -8227,13 +8228,13 @@ elf_link_output_sym (struct elf_final_link_info *finfo,
elfsym->st_name = (unsigned long) _bfd_stringtab_add (finfo->symstrtab,
name, TRUE, FALSE);
if (elfsym->st_name == (unsigned long) -1)
- return FALSE;
+ return 0;
}
if (finfo->symbuf_count >= finfo->symbuf_size)
{
if (! elf_link_flush_output_syms (finfo, bed))
- return FALSE;
+ return 0;
}
dest = finfo->symbuf + finfo->symbuf_count * bed->s->sizeof_sym;
@@ -8247,7 +8248,7 @@ elf_link_output_sym (struct elf_final_link_info *finfo,
amt = finfo->shndxbuf_size * sizeof (Elf_External_Sym_Shndx);
destshndx = bfd_realloc (destshndx, amt * 2);
if (destshndx == NULL)
- return FALSE;
+ return 0;
finfo->symshndxbuf = destshndx;
memset ((char *) destshndx + amt, 0, amt);
finfo->shndxbuf_size *= 2;
@@ -8259,7 +8260,7 @@ elf_link_output_sym (struct elf_final_link_info *finfo,
finfo->symbuf_count += 1;
bfd_get_symcount (finfo->output_bfd) += 1;
- return TRUE;
+ return 1;
}
/* Return TRUE if the dynamic symbol SYM in ABFD is supported. */
@@ -8445,6 +8446,8 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
Elf_Internal_Sym sym;
asection *input_sec;
const struct elf_backend_data *bed;
+ long indx;
+ int ret;
if (h->root.type == bfd_link_hash_warning)
{
@@ -8787,13 +8790,17 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
if (strip || (input_sec->flags & SEC_EXCLUDE) != 0)
return TRUE;
- h->indx = bfd_get_symcount (finfo->output_bfd);
-
- if (! elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec, h))
+ indx = bfd_get_symcount (finfo->output_bfd);
+ ret = elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec, h);
+ if (ret == 0)
{
eoinfo->failed = TRUE;
return FALSE;
}
+ else if (ret == 1)
+ h->indx = indx;
+ else if (h->indx == -2)
+ abort();
return TRUE;
}
@@ -8961,6 +8968,8 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
asection *isec;
const char *name;
Elf_Internal_Sym osym;
+ long indx;
+ int ret;
*pindex = -1;
@@ -9048,8 +9057,6 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
&& bfd_is_local_label_name (input_bfd, name)))
continue;
- /* If we get here, we are going to output this symbol. */
-
osym = *isym;
/* Adjust the section index for the output file. */
@@ -9079,8 +9086,12 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
}
}
- if (! elf_link_output_sym (finfo, name, &osym, isec, NULL))
+ indx = bfd_get_symcount (output_bfd);
+ ret = elf_link_output_sym (finfo, name, &osym, isec, NULL);
+ if (ret == 0)
return FALSE;
+ else if (ret == 1)
+ *pindex = indx;
}
/* Relocate the contents of each section. */
@@ -9129,6 +9140,8 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
Elf_Internal_Sym sym = isymbuf[symndx];
asection *sec = finfo->sections[symndx]->output_section;
const char *name;
+ long indx;
+ int ret;
name = bfd_elf_string_from_elf_section (input_bfd,
symtab_hdr->sh_link,
@@ -9143,9 +9156,14 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
sym.st_value += o->output_offset;
- finfo->indices[symndx] = bfd_get_symcount (output_bfd);
- if (! elf_link_output_sym (finfo, name, &sym, o, NULL))
+ indx = bfd_get_symcount (output_bfd);
+ ret = elf_link_output_sym (finfo, name, &sym, o, NULL);
+ if (ret == 0)
return FALSE;
+ else if (ret == 1)
+ finfo->indices[symndx] = indx;
+ else
+ abort ();
}
elf_section_data (osec)->this_hdr.sh_info
= finfo->indices[symndx];
@@ -9536,6 +9554,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
unsigned long shlink;
const char *name;
asection *osec;
+ long indx;
if (finfo->info->strip == strip_all)
{
@@ -9575,12 +9594,15 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
}
}
- finfo->indices[r_symndx]
- = bfd_get_symcount (output_bfd);
-
- if (! elf_link_output_sym (finfo, name, &sym, sec,
- NULL))
+ indx = bfd_get_symcount (output_bfd);
+ ret = elf_link_output_sym (finfo, name, &sym, sec,
+ NULL);
+ if (ret == 0)
return FALSE;
+ else if (ret == 1)
+ finfo->indices[r_symndx] = indx;
+ else
+ abort ();
}
r_symndx = finfo->indices[r_symndx];
@@ -10332,8 +10354,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
elfsym.st_info = 0;
elfsym.st_other = 0;
elfsym.st_shndx = SHN_UNDEF;
- if (! elf_link_output_sym (&finfo, NULL, &elfsym, bfd_und_section_ptr,
- NULL))
+ if (elf_link_output_sym (&finfo, NULL, &elfsym, bfd_und_section_ptr,
+ NULL) != 1)
goto error_return;
}
@@ -10358,7 +10380,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
elfsym.st_shndx = i;
if (!info->relocatable)
elfsym.st_value = o->vma;
- if (!elf_link_output_sym (&finfo, NULL, &elfsym, o, NULL))
+ if (elf_link_output_sym (&finfo, NULL, &elfsym, o, NULL) != 1)
goto error_return;
}
}
@@ -10534,7 +10556,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
table, do it now. */
if (bed->elf_backend_output_arch_local_syms)
{
- typedef bfd_boolean (*out_sym_func)
+ typedef int (*out_sym_func)
(void *, const char *, Elf_Internal_Sym *, asection *,
struct elf_link_hash_entry *);
@@ -10645,7 +10667,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
table, do it now. */
if (bed->elf_backend_output_arch_syms)
{
- typedef bfd_boolean (*out_sym_func)
+ typedef int (*out_sym_func)
(void *, const char *, Elf_Internal_Sym *, asection *,
struct elf_link_hash_entry *);
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 94d56be..034c82a 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -6785,7 +6785,7 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
symbol. We mark symbols as small common if appropriate. This is
also where we undo the increment of the value for a mips16 symbol. */
-bfd_boolean
+int
_bfd_mips_elf_link_output_symbol_hook
(struct bfd_link_info *info ATTRIBUTE_UNUSED,
const char *name ATTRIBUTE_UNUSED, Elf_Internal_Sym *sym,
@@ -6801,7 +6801,7 @@ _bfd_mips_elf_link_output_symbol_hook
if (ELF_ST_IS_MIPS16 (sym->st_other))
sym->st_value &= ~1;
- return TRUE;
+ return 1;
}
/* Functions for the dynamic linker. */
diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h
index 15bd4be..74735fd 100644
--- a/bfd/elfxx-mips.h
+++ b/bfd/elfxx-mips.h
@@ -41,7 +41,7 @@ extern bfd_boolean _bfd_mips_elf_section_from_bfd_section
extern bfd_boolean _bfd_mips_elf_add_symbol_hook
(bfd *, struct bfd_link_info *, Elf_Internal_Sym *,
const char **, flagword *, asection **, bfd_vma *);
-extern bfd_boolean _bfd_mips_elf_link_output_symbol_hook
+extern int _bfd_mips_elf_link_output_symbol_hook
(struct bfd_link_info *, const char *, Elf_Internal_Sym *,
asection *, struct elf_link_hash_entry *);
extern bfd_boolean _bfd_mips_elf_create_dynamic_sections