[llvm-dev] [LLD] Question of handling a special relocation in COFF

Yi-Hong Lyu via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 14 12:08:47 PST 2016


Hello all,

I am handling a special architecture's relocation in COFF. Such relocation
(IMAGE_REL_RELSEC) is used specifically in static linked executables:

$ llvm-objdump -d -r foo1.obj:

Disassembly of section .text:

00:  mov 04, r2
            00000002:  IMAGE_REL_RELSEC   .text
04: ...

$ llvm-objdump -d -r foo2.obj:

Disassembly of section .text:

00:  mov 04, r2
            00000002:  IMAGE_REL_RELSEC   .text
04: ...

And the expected output will be:
$ lld-link /out:foo.exe foo1.obj foo2.obj

$ llvm-objdump -d foo.exe:

40000000: mov 40000004, r2
40000004: ...
40000008: mov 4000000c, r2
4000000c: ...

PS. 40000004 = Addend (4) + Image Base (40000000) + Instruction RVA (0)
       4000000c = Addend (4) + Image Base (40000000) + Instruction RVA (8)

In Summary, such relocation stores addend that relative to .text section.
Linker is expected to fix the relocation of the instruction by image base
and the instruction RVA. I am wondering whether there is other relocation
like IMAGE_REL_RELSEC therefore I can take a look of it.

Thanks for you reply
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160115/4e145e14/attachment.html>


More information about the llvm-dev mailing list