[llvm-bugs] [Bug 40801] New: Improve handling of invalid symbol indexes in relocations

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Feb 21 06:01:58 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40801

            Bug ID: 40801
           Summary: Improve handling of invalid symbol indexes in
                    relocations
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: llvm-readobj
          Assignee: unassignedbugs at nondot.org
          Reporter: jh7370.2008 at my.bristol.ac.uk
                CC: jh7370.2008 at my.bristol.ac.uk, llvm-bugs at lists.llvm.org

Currently, llvm-readobj emits an error if it encounters a relocation which
references a symbol index for a symbol that doesn't exist:

c:\Work>llvm-readobj --relocations bad.o
Relocation section '.rela.text' at offset 0x1d0 contains 2 entries:
    Offset             Info             Type               Symbol's Value 
Symbol's Name + Addend
0000000000000000  0000000100000002 R_X86_64_PC32          0000000000000000 foo
+ 0

Error reading file: invalid section offset
.

This error message is not particularly helpful. In particular, the fact that it
is talking about a section offset is confusing. Also, the trailing full stop is
not in the right location. We could improve things in two ways: 1) Changing the
error message to give more information (e.g. something like "invalid symbol
index '0x42' referenced by relocation 3 in .rela.text"), 2) Don't emit an error
at all, and in llvm-readobj print the symbol index without trying to decode it
(perhaps with an associated warning message).

For refernece, GNU output does the latter (the relocations have been reordered
to show that output continues):

c:\Work>llvm-readobj --relocations bad.o
Relocation section '.rela.text' at offset 0x1d0 contains 2 entries:
  Offset          Info           Type           Sym. Value    Sym. Name +
Addend
000000000000  004200000002 R_X86_64_PC32    readelf: Error:  bad symbol index:
00000042 in reloc
000000000000  000100000002 R_X86_64_PC32     0000000000000000 foo + 0

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190221/285a8612/attachment.html>


More information about the llvm-bugs mailing list