Address the last bit of relocation flag related divergence betweeen
authorJason W Kim <jason.w.kim.2009@gmail.com>
Wed, 11 May 2011 22:53:06 +0000 (22:53 +0000)
committerJason W Kim <jason.w.kim.2009@gmail.com>
Wed, 11 May 2011 22:53:06 +0000 (22:53 +0000)
commite964d1192a82cf8c1371a7440667de67595d6d35
treeb17df64c4de48ff3b3724346ec69c85fec0d3a7b
parentc493a1f317a3f5b260f9747f29cea556da52cf73
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.

Todo: There are probably more issues for PIC mode on ARM/MC/ELF...

Todo: Existing tests in MC/ARM/elf-reloc*.ll need to be converted over to .s
tests as well as expanded to cover the gamut.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131205 91177308-0d34-0410-b5e6-96231b3b80d8
lib/MC/ELFObjectWriter.cpp
lib/MC/ELFObjectWriter.h