summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Machata <pmachata@redhat.com>2011-03-14 14:19:59 +0100
committerPetr Machata <pmachata@redhat.com>2011-03-14 14:19:59 +0100
commit65e9aa860d06507c9332ec2fdf55d3ca4f2acdc3 (patch)
treea76f47ea756c06984f1707e0f6e7f71a1d4deac4
parentc1dfae6e870eec0bf83aa5edc0343d2d72f0585c (diff)
downloadelfutils-65e9aa860d06507c9332ec2fdf55d3ca4f2acdc3.tar.gz
dwarflint: Replace over-zealous assert with a warning
-rw-r--r--dwarflint/reloc.cc8
-rw-r--r--dwarflint/tests/garbage-10.bz2bin0 -> 596 bytes
-rwxr-xr-xdwarflint/tests/run-bad.sh7
3 files changed, 12 insertions, 3 deletions
diff --git a/dwarflint/reloc.cc b/dwarflint/reloc.cc
index da389d93..d51818eb 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 00000000..2afab22f
--- /dev/null
+++ b/dwarflint/tests/garbage-10.bz2
Binary files differ
diff --git a/dwarflint/tests/run-bad.sh b/dwarflint/tests/run-bad.sh
index 919e098e..bb2b92e0 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 <<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