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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to