]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Replace over-zealous assert with a warning
authorPetr Machata <pmachata@redhat.com>
Mon, 14 Mar 2011 13:19:59 +0000 (14:19 +0100)
committerPetr Machata <pmachata@redhat.com>
Mon, 14 Mar 2011 13:19:59 +0000 (14:19 +0100)
dwarflint/reloc.cc
dwarflint/tests/garbage-10.bz2 [new file with mode: 0644]
dwarflint/tests/run-bad.sh

index da389d930f04c61adfc53609190616c04844688c..d51818eb03175b82944afa0b36713a3bd9a7cf99 100644 (file)
@@ -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 (file)
index 0000000..2afab22
Binary files /dev/null and b/dwarflint/tests/garbage-10.bz2 differ
index 919e098edb6ee533b61923e57b26101809249adf..bb2b92e09cf81ae492251b3519930a54d952be4d 100755 (executable)
@@ -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 <<EOF
 error: .debug_info: DIE 0x83: abbrev section at 0x0 doesn't contain code 83.
@@ -99,3 +99,8 @@ error: .debug_info: DIE 0x84 (abbr. attribute 0x5f): invalid reference outside t
 error: .debug_info: DIE 0x6c: is the last sibling in chain, but has a DW_AT_sibling attribute.
 error: .debug_info: DIE 0xab (abbreviation 113): DIE chain not terminated with null entry.
 EOF
+
+testrun_compare ./dwarflint garbage-10 <<EOF
+warning: .rela.debug_info: offset 0xc: relocation formed using STT_SECTION symbol with non-zero value.
+error: .rela.debug_info: offset 0x11: couldn't obtain symbol #7208969: invalid section index.
+EOF