[llvm] r293224 - [obj2yaml] Produce correct output for invalid relocations.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 27 11:19:20 PST 2017
On Fri, Jan 27, 2017 at 10:27 AM, Rafael Avila de Espindola
<rafael.espindola at gmail.com> wrote:
> Passing the result object back via yam2obj will produce a different
> result, no?
>
A bit. I may be wrong, but I think you can obtain an isomorphism even
without this change (as sections are laid out differently).
Both files contain the 'correct' reloc, which was the purpose of the test:
$ objdump -r array.o
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
0000000000000000 R_X86_64_NONE *ABS*
$ objdump -r reverse.o
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
0000000000000000 R_X86_64_NONE *ABS*
We now create `.shstrtab` in the inverted relocatable (which doesn't
appear in the original object).
$ readelf -S array.o
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .text PROGBITS 0000000000000000 000001c0
0000000000000005 0000000000000000 AX 0 0 4
[ 2] .rela.text RELA 0000000000000000 000001c8
0000000000000018 0000000000000018 3 1 8
[ 3] .symtab SYMTAB 0000000000000000 000001e0
0000000000000060 0000000000000018 4 2 8
[ 4] .strtab STRTAB 0000000000000000 00000240
0000000000000044 0000000000000000 0 0 1
[ 5] .shstrtab STRTAB 0000000000000000 00000284
0000000000000026 0000000000000000 0 0 1
$ readelf -S reverse.o
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .strtab STRTAB 0000000000000000 00000040
0000000000000070 0000000000000000 0 0 1
[ 2] .text PROGBITS 0000000000000000 000000b0
0000000000000005 0000000000000000 AX 0 0 4
[ 3] .rela.text RELA 0000000000000000 000000b8
0000000000000018 0000000000000018 4 2 8
[ 4] .symtab SYMTAB 0000000000000000 000000d0
0000000000000060 0000000000000018 1 2 8
Even without the `.shstrtabe` section emitted, the order of the
section header is different in the two executables, so I don't think
you were obtaining the original object back anyway.
--
Davide
More information about the llvm-commits
mailing list