Previously printing R_386_RELATIVE relocations would trigger
error: can't read an entry at 0x40: it goes past the end of the section (0x40)
I found this while writing a test case for LLD (D100490)
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/tools/llvm-objdump/X86/elf-dynamic-relocs-rel.test | ||
---|---|---|
1 | This looks verbose. If you just keep things as in test/tools/llvm-readelf/ELF/reloc-types-elf-i386.test, does it work? | |
135 | foo is not needed. |
llvm/test/tools/llvm-objdump/X86/elf-dynamic-relocs-rel.test | ||
---|---|---|
1 | Yes, I should have reduced this test input further, right now it's just and obj2yaml of an lld test with a few obvious lines removed. Will remove everything that's not needed for the relative relocation tomorrow. |
Hopefully the new test is better?
llvm/test/tools/llvm-objdump/X86/elf-dynamic-relocs-rel.test | ||
---|---|---|
1 | I could add a RELATIVE reloc to a .o file as in test/tools/llvm-readelf/ELF/reloc-types-elf-i386.test, but I thought using a dynamic relocation like llvm/test/tools/llvm-readobj/ELF/dynamic-reloc.test makes more sense. |
llvm/test/tools/llvm-objdump/X86/elf-dynamic-relocs-rel.test | ||
---|---|---|
135 | I've kept foo to make this test closer to llvm/test/tools/llvm-objdump/X86/elf-dynamic-relocs.test and test both relocations with and without a symbol. |
The patch title tags llvm-readobj, but this is an llvm-objdump change.
llvm/test/tools/llvm-objdump/X86/elf-dynamic-relocs-rel.test | ||
---|---|---|
2–4 | I don't think you need the "Previously ..." sentence at all. What you probably do want to say is that this test shows that Elf_Rel relocations can be dumped for both cases with and without a corresponding symbol, something like the inline edit. | |
10 | I don't think this line is useful? | |
12–13 | Nit suggestion to make things line up nicely. | |
62–64 | I think you can omit the static symbol? |
llvm/test/tools/llvm-objdump/X86/elf-dynamic-relocs-rel.test | ||
---|---|---|
10 | I agree. I simply copied it from llvm/test/tools/llvm-objdump/X86/elf-dynamic-relocs.test. Should I drop it there too? | |
62–64 | Unfortunately that gives me a yaml2obj error when using Symbol: foo inside Relocations:. |
llvm/test/tools/llvm-objdump/X86/elf-dynamic-relocs-rel.test | ||
---|---|---|
10 | It probably wouldn't hurt (just make sure that somewhere there is a lit test that shows that the file format line is printed, so that we don't lose coverage!) | |
32 | You probably should have Link: .dynsym here, since these are dynamic relocations (by default, it'll use the static symbol table). | |
62–64 | Ah okay, thanks. Try the Link: suggestion above. If that doesn't work, I think adding a FIXME/TODO comment of some kind here would be a good idea. @grimar, any thoughts? |
Address review feedback from @jhenderson
llvm/test/tools/llvm-objdump/X86/elf-dynamic-relocs-rel.test | ||
---|---|---|
10 | Looks like it's tested by llvm/test/tools/llvm-objdump/ELF/file-headers.test, so I have dropped it in this version. | |
62–64 | Thanks, adding Link: allows me to drop Symbols:. |
Thanks. LGTM, but please give @MaskRay a chance to confirm he's happy. Also, probably worth updating the description to mention the tidying/fixing up of elf-dynamic-relcos.test too. Alternatively, make that change in a different commit.
This looks verbose.
If you just keep things as in test/tools/llvm-readelf/ELF/reloc-types-elf-i386.test, does it work?
llvm-readobj generally has better support for ELF dumping and you may take inspiration from its tests.