I'm working on Position-independent code for 32-bit PowerPC, but running into a problem. At the beginning of each function, there's a pre-word that's the difference between the PICBase (.L1$pb) and the GOT. This works fine when generating assembly output, but it fails when generating ELF output, with the error "Cannot represent a difference across sections" (line 847, lib/MC/ELFObjectWriter.cpp). Roman Divacky suggested I try something with 'let EncoderMethod = ...' similar to how the TOC entries are done for ppc64. However, I'm not sure if that would work, given that the TOC on ppc64 is handled differently from the GOT on ppc32, and I'm not sure how to represent that if it could work. Any ideas on how a cross-section diff and relocation could be represented for this? Thanks, Justin
Rafael Avila de Espindola
2014-Jun-26 20:26 UTC
[LLVMdev] cross-section differences in MC generation
Sent from my iPhone> On Jun 26, 2014, at 12:33, Justin Hibbits <jrh29 at alumni.cwru.edu> wrote: > > I'm working on Position-independent code for 32-bit PowerPC, but > running into a problem. At the beginning of each function, there's a > pre-word that's the difference between the PICBase (.L1$pb) and the > GOT. This works fine when generating assembly output, but it fails > when generating ELF output, with the error "Cannot represent a > difference across sections" (line 847, lib/MC/ELFObjectWriter.cpp). > > Roman Divacky suggested I try something with 'let EncoderMethod = ...' > similar to how the TOC entries are done for ppc64. However, I'm not > sure if that would work, given that the TOC on ppc64 is handled > differently from the GOT on ppc32, and I'm not sure how to represent > that if it could work. > > Any ideas on how a cross-section diff and relocation could be > represented for this? >Can you post the generated assembly that works with gas but fails with llvm-mc?> Thanks, > Justin > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Attached. You can also find it at http://people.freebsd.org/~jhibbits/hello_llvm.s . - Justin On Thu, Jun 26, 2014 at 1:26 PM, Rafael Avila de Espindola <rafael.espindola at gmail.com> wrote:> > > Sent from my iPhone > >> On Jun 26, 2014, at 12:33, Justin Hibbits <jrh29 at alumni.cwru.edu> wrote: >> >> I'm working on Position-independent code for 32-bit PowerPC, but >> running into a problem. At the beginning of each function, there's a >> pre-word that's the difference between the PICBase (.L1$pb) and the >> GOT. This works fine when generating assembly output, but it fails >> when generating ELF output, with the error "Cannot represent a >> difference across sections" (line 847, lib/MC/ELFObjectWriter.cpp). >> >> Roman Divacky suggested I try something with 'let EncoderMethod = ...' >> similar to how the TOC entries are done for ppc64. However, I'm not >> sure if that would work, given that the TOC on ppc64 is handled >> differently from the GOT on ppc32, and I'm not sure how to represent >> that if it could work. >> >> Any ideas on how a cross-section diff and relocation could be >> represented for this? >> > > > Can you post the generated assembly that works with gas but fails with llvm-mc? > >> Thanks, >> Justin >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- A non-text attachment was scrubbed... Name: hello_llvm.s Type: application/octet-stream Size: 1618 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140626/5e90ac54/attachment.obj>