[llvm-commits] [llvm] r131205 - in /llvm/trunk/lib/MC: ELFObjectWriter.cpp ELFObjectWriter.h

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Thu May 12 18:13:42 PDT 2011


On 11-05-11 6:53 PM, Jason W Kim wrote:
> Author: jasonwkim
> Date: Wed May 11 17:53:06 2011
> New Revision: 131205
>
> URL: http://llvm.org/viewvc/llvm-project?rev=131205&view=rev
> Log:
> Address the last bit of relocation flag related divergence betweeen
> LLVM and binutils.
>
> With this patch, there are no functional differences between the .o
> produced directly from LLVM versus the .s to .o via GNU as, for relocation tags
> at least, for both PIC and non-PIC modes.
>
> Because some non-PIC reloc tags are used (legally) on PIC, so IsPCRel flag is
> necessary but not sufficient to determine whether the overall codegen mode is
> PIC or not. Why is this necessary? There is an incompatibility of how relocs
> are emitted in the .rodata section.  Binutils PIC likes to emit certain relocs
> as section relative offsets.  Non-PIC does not do this.
>
> So I added a hidden switch on the ELFObjectwriter "-arm-elf-force-pic" which
> forces the objectwriter to pretend that all relocs are for PIC mode.
>
>
> Todo: Activate ForceARMElfPIC to true if -relocation-model=pic is selected
> on llc.
>

Is this ARM only? On X86 at least no flag is passed to the assembler 
indicating that a given file is PIC or not. Since the MC interface is 
isomorphic with the assembler, llc should not pass any flags to mc.

Cheers,
Rafael



More information about the llvm-commits mailing list