mirror of
https://github.com/bminor/binutils-gdb.git
synced 2026-02-04 17:11:30 +00:00
BFD: Make `bfd_finalize_section_relocs' return status
Update `bfd_finalize_section_relocs' to return status so that backends can fail in this interface and propagate that to the respective callers. Add suitable error reporting there. No failure cases in the existing handlers though.
This commit is contained in:
@@ -1517,13 +1517,14 @@ coff_frob_file_after_relocs (void)
|
||||
/* Set relocations for the section and then store the number of relocations
|
||||
in its aux entry. */
|
||||
|
||||
void
|
||||
bool
|
||||
obj_coff_finalize_section_relocs (asection *sec, arelent **relocs,
|
||||
unsigned int n)
|
||||
{
|
||||
symbolS *sect_sym;
|
||||
|
||||
bfd_finalize_section_relocs (stdoutput, sec, n ? relocs : NULL, n);
|
||||
if (!bfd_finalize_section_relocs (stdoutput, sec, n ? relocs : NULL, n))
|
||||
return false;
|
||||
sect_sym = section_symbol (sec);
|
||||
#ifdef OBJ_XCOFF
|
||||
if (S_GET_STORAGE_CLASS (sect_sym) == C_DWARF)
|
||||
@@ -1531,6 +1532,7 @@ obj_coff_finalize_section_relocs (asection *sec, arelent **relocs,
|
||||
else
|
||||
#endif
|
||||
SA_SET_SCN_NRELOC (sect_sym, n);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Implement the .section pseudo op:
|
||||
|
||||
@@ -296,7 +296,7 @@ extern void coff_pop_insert (void);
|
||||
/* We need to store the number of relocations in the section aux entry. */
|
||||
#define FINALIZE_SECTION_RELOCS(sec, relocs, n) \
|
||||
obj_coff_finalize_section_relocs (sec, relocs, n)
|
||||
extern void obj_coff_finalize_section_relocs (asection *, arelent **,
|
||||
extern bool obj_coff_finalize_section_relocs (asection *, arelent **,
|
||||
unsigned int);
|
||||
|
||||
extern int S_SET_DATA_TYPE (symbolS *, int);
|
||||
|
||||
@@ -1879,7 +1879,7 @@ obj_mach_o_frob_file_after_relocs (void)
|
||||
|
||||
/* Reverse relocations order to make ld happy. */
|
||||
|
||||
void
|
||||
bool
|
||||
obj_mach_o_reorder_section_relocs (asection *sec, arelent **rels, unsigned int n)
|
||||
{
|
||||
unsigned int i;
|
||||
@@ -1891,7 +1891,7 @@ obj_mach_o_reorder_section_relocs (asection *sec, arelent **rels, unsigned int n
|
||||
rels[i] = rels[n - i - 1];
|
||||
rels[n - i - 1] = r;
|
||||
}
|
||||
bfd_finalize_section_relocs (stdoutput, sec, rels, n);
|
||||
return bfd_finalize_section_relocs (stdoutput, sec, rels, n);
|
||||
}
|
||||
|
||||
/* Relocation rules are different in frame sections. */
|
||||
|
||||
@@ -101,7 +101,7 @@ extern void obj_mach_o_frob_file_after_relocs (void);
|
||||
|
||||
#define FINALIZE_SECTION_RELOCS(sec, relocs, n) \
|
||||
obj_mach_o_reorder_section_relocs (sec, relocs, n)
|
||||
extern void obj_mach_o_reorder_section_relocs (asection *, arelent **,
|
||||
extern bool obj_mach_o_reorder_section_relocs (asection *, arelent **,
|
||||
unsigned int);
|
||||
|
||||
/* Emit relocs for local subtracts, to cater for subsections-via-symbols. */
|
||||
|
||||
@@ -1419,7 +1419,8 @@ write_relocs (bfd *abfd ATTRIBUTE_UNUSED, asection *sec,
|
||||
}
|
||||
#endif
|
||||
|
||||
FINALIZE_SECTION_RELOCS (sec, relocs, n);
|
||||
if (!FINALIZE_SECTION_RELOCS (sec, relocs, n))
|
||||
as_bad (_("%s: unable to finalize relocations"), sec->name);
|
||||
|
||||
#ifdef DEBUG3
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user