[llvm-commits] [PATCH]: sketch of PPC32 ELF writer

Evan Cheng evan.cheng at apple.com
Mon Aug 1 12:43:47 PDT 2011


On Aug 1, 2011, at 11:53 AM, Roman Divacky wrote:

> Looks fine to do what? :)

Go ahead and commit please.


> 
> One more thing, PPCLinuxMCAsmInfo() does not set PPC to be BigEndian.
> OK to commit this?
> 
> pes ~rdivacky/llvm# svn diff lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp
> Index: lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp
> ===================================================================
> --- lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp    (revision 136618)
> +++ lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp    (working copy)
> @@ -58,5 +58,6 @@
>   Data64bitsDirective = is64Bit ? "\t.quad\t" : 0;
>   HasLCOMMDirective = true;
>   AssemblerDialect = 0;           // Old-Style mnemonics.
> +  IsLittleEndian = false;
> }

Oops. PPCLinuxMCAsmInfo also forgot to set PointerSize to 8 for ppc64. I've fixed this.

Thanks,

Evan

> 
> 
> With this I am able to debug vim and floats work again (with the ELF writer
> patches).
> 
> On Mon, Aug 01, 2011 at 11:22:26AM -0700, Evan Cheng wrote:
>> Looks fine to me. Thanks.
>> 
>> Evan
>> On Aug 1, 2011, at 11:19 AM, Roman Divacky wrote:
>> 
>>> Hi,
>>> 
>>> the attached two patches sketch out PPC32 ELF writer.
>>> 
>>> 1) powerpc-mc-md.patch
>>> 
>>>       This defines some PPC relocation types and introduces
>>>       PPCELFObjectWriter and ELFPPCAsmBackend. Including ApplyFixup()
>>>       implementation.
>>> 
>>>       I think this patch is basically committable.
>>> 
>>> 2) powerpc-mc.patch
>>> 
>>>       This implements PPCELFObjectWriter class including quite wrong
>>>       GetRelocType(). There's a hack in RecordRelocation where
>>>       fixup_ppc_ha16/fixup_ppc_lo16 offset needs to be adjusted by two.
>>>       I don't know how to do this properly.
>>> 
>>>       I think this needs more work on the GetRelocType() and the fixup
>>>       hack.
>>> 
>>> With these two patches applied I am able to compile a running hello world on
>>> FreeBSD using clang -integrated-as. It can compile non-running vim. I used
>>> to be able to compile -g version of vim and it went quite far before it
>>> crashed. Debug compilation is not possibly anymore, I suspect some endian
>>> issue (gdb says: Dwarf Error: wrong version in compilation unit header (is
>>> 512, should be 2))
>>> 
>>> What should I do with these patches? The first one seems committable (and
>>> touches only PowerPC code), the second should be ok to commit without the +2
>>> hack and with the GetRelocType() just asserting.
>>> 
>>> I don't have any tests for this nor I think I'll do any more significant work.
>>> 
>>> Comments? 
>>> 
>>> roman
>>> <powerpc-mc-md.patch><powerpc-mc.patch>_______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list