From 75f2446ec3c13eca3fe0c7cfdbb232e760d36596 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sun, 14 Oct 2007 06:49:14 +0000 Subject: Run all error handling through an Errors object. Delete output file on error. --- gold/reloc.cc | 64 +++++++++++++++++++++++++---------------------------------- 1 file changed, 27 insertions(+), 37 deletions(-) (limited to 'gold/reloc.cc') diff --git a/gold/reloc.cc b/gold/reloc.cc index bf4b2d6..7647edf 100644 --- a/gold/reloc.cc +++ b/gold/reloc.cc @@ -187,9 +187,9 @@ Sized_relobj::do_read_relocs(Read_relocs_data* rd) unsigned int shndx = shdr.get_sh_info(); if (shndx >= shnum) { - fprintf(stderr, _("%s: %s: relocation section %u has bad info %u\n"), - program_name, this->name().c_str(), i, shndx); - gold_exit(false); + this->error(_("relocation section %u has bad info %u"), + i, shndx); + continue; } if (!this->is_section_included(shndx)) @@ -205,11 +205,10 @@ Sized_relobj::do_read_relocs(Read_relocs_data* rd) if (shdr.get_sh_link() != this->symtab_shndx_) { - fprintf(stderr, - _("%s: %s: relocation section %u uses unexpected " - "symbol table %u\n"), - program_name, this->name().c_str(), i, shdr.get_sh_link()); - gold_exit(false); + this->error(_("relocation section %u uses unexpected " + "symbol table %u"), + i, shdr.get_sh_link()); + continue; } off_t sh_size = shdr.get_sh_size(); @@ -221,22 +220,18 @@ Sized_relobj::do_read_relocs(Read_relocs_data* rd) reloc_size = elfcpp::Elf_sizes::rela_size; if (reloc_size != shdr.get_sh_entsize()) { - fprintf(stderr, - _("%s: %s: unexpected entsize for reloc section %u: " - "%lu != %u"), - program_name, this->name().c_str(), i, - static_cast(shdr.get_sh_entsize()), - reloc_size); - gold_exit(false); + this->error(_("unexpected entsize for reloc section %u: %lu != %u"), + i, static_cast(shdr.get_sh_entsize()), + reloc_size); + continue; } size_t reloc_count = sh_size / reloc_size; if (static_cast(reloc_count * reloc_size) != sh_size) { - fprintf(stderr, _("%s: %s: reloc section %u size %lu uneven"), - program_name, this->name().c_str(), i, - static_cast(sh_size)); - gold_exit(false); + this->error(_("reloc section %u size %lu uneven"), + i, static_cast(sh_size)); + continue; } rd->relocs.push_back(Section_relocs()); @@ -433,9 +428,9 @@ Sized_relobj::relocate_sections( unsigned int index = shdr.get_sh_info(); if (index >= this->shnum()) { - fprintf(stderr, _("%s: %s: relocation section %u has bad info %u\n"), - program_name, this->name().c_str(), i, index); - gold_exit(false); + this->error(_("relocation section %u has bad info %u"), + i, index); + continue; } if (!this->is_section_included(index)) @@ -449,11 +444,10 @@ Sized_relobj::relocate_sections( if (shdr.get_sh_link() != this->symtab_shndx_) { - fprintf(stderr, - _("%s: %s: relocation section %u uses unexpected " - "symbol table %u\n"), - program_name, this->name().c_str(), i, shdr.get_sh_link()); - gold_exit(false); + gold_error(_("relocation section %u uses unexpected " + "symbol table %u"), + i, shdr.get_sh_link()); + continue; } off_t sh_size = shdr.get_sh_size(); @@ -468,22 +462,18 @@ Sized_relobj::relocate_sections( if (reloc_size != shdr.get_sh_entsize()) { - fprintf(stderr, - _("%s: %s: unexpected entsize for reloc section %u: " - "%lu != %u"), - program_name, this->name().c_str(), i, - static_cast(shdr.get_sh_entsize()), + gold_error(_("unexpected entsize for reloc section %u: %lu != %u"), + i, static_cast(shdr.get_sh_entsize()), reloc_size); - gold_exit(false); + continue; } size_t reloc_count = sh_size / reloc_size; if (static_cast(reloc_count * reloc_size) != sh_size) { - fprintf(stderr, _("%s: %s: reloc section %u size %lu uneven"), - program_name, this->name().c_str(), i, - static_cast(sh_size)); - gold_exit(false); + gold_error(_("reloc section %u size %lu uneven"), + i, static_cast(sh_size)); + continue; } relinfo.reloc_shndx = i; -- cgit v1.1