From: Petr Machata Date: Mon, 14 Mar 2011 13:19:59 +0000 (+0100) Subject: dwarflint: Replace over-zealous assert with a warning X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=65e9aa860d06507c9332ec2fdf55d3ca4f2acdc3;p=thirdparty%2Felfutils.git dwarflint: Replace over-zealous assert with a warning --- diff --git a/dwarflint/reloc.cc b/dwarflint/reloc.cc index da389d930..d51818eb0 100644 --- a/dwarflint/reloc.cc +++ b/dwarflint/reloc.cc @@ -179,7 +179,11 @@ do_one_relocation (elf_file const *file, if (file->ehdr.e_type == ET_REL && ELF64_ST_TYPE (symbol->st_info) == STT_SECTION) { - assert (sym_value == 0); + if (sym_value != 0) + wr_warning (reloc_where) + << "relocation formed using STT_SECTION symbol with non-zero value." + << std::endl; + require_valid_section_index; sym_value = file->sec[section_index].shdr.sh_addr; } @@ -200,7 +204,7 @@ do_one_relocation (elf_file const *file, { if (offset_into != rel_address && section_index == SHN_UNDEF) wr_error (&reloc_where, - ": relocation of an address is formed against SHN_UNDEF symbol" + ": relocation of an address is formed using SHN_UNDEF symbol" " (symtab index %d).\n", rel->symndx); else { diff --git a/dwarflint/tests/garbage-10.bz2 b/dwarflint/tests/garbage-10.bz2 new file mode 100644 index 000000000..2afab22f8 Binary files /dev/null and b/dwarflint/tests/garbage-10.bz2 differ diff --git a/dwarflint/tests/run-bad.sh b/dwarflint/tests/run-bad.sh index 919e098ed..bb2b92e09 100755 --- a/dwarflint/tests/run-bad.sh +++ b/dwarflint/tests/run-bad.sh @@ -30,7 +30,7 @@ srcdir=$srcdir/tests testfiles hello.bad-1 hello.bad-3 empty-1 \ garbage-1 garbage-2 garbage-3 garbage-4 \ garbage-5 garbage-6 garbage-7 garbage-8 \ - garbage-9 + garbage-9 garbage-10 testrun_compare ./dwarflint hello.bad-1 <