[PowerPC, Mach-O] PPCMachObjectWriter.cpp, at long last
David Fang
fang at csl.cornell.edu
Thu Jul 25 14:43:10 PDT 2013
Don,
The test doesn't actually *run* the executable, it only produces
the object file and compares the output, doesn't even link to an
executable. The cpu/triple needs to be specified so !powerpc-darwin users
see the same result, just cross-compiled.
Fang
> Question: Should the mcpu and mtriple flags somehow be detected?
>
> I ask because if I run this on my G5, would it not fail?
>
> Don
>
> On 7/25/13 11:27 AM, David Fang wrote:
>> Rafael,
>>
>> Testing .s->.o via llvm-mc would be ideal, but the PPCAsmParser doesn't
>> support darwin syntax yet.
>> I've revised the test commands and added a comment:
>>
>> [hello-reloc.ll]
>> ...
>> ; RUN: llc -filetype=asm -relocation-model=pic -mcpu=g4
>> -mtriple=powerpc-apple-darwin8 %s -o - | tee %t1 | FileCheck
>> -check-prefix=DARWIN-G4-ASM %s
>> ; RUN: llc -filetype=obj -relocation-model=pic -mcpu=g4
>> -mtriple=powerpc-apple-darwin8 %s -o - | tee %t2 | macho-dump | tee %t3
>> FileCheck -check-prefix=DARWIN-G4-DUMP %s
>>
>> ; FIXME: validating .s->.o requires darwin asm syntax support in
>> PPCAsmParser
>> ; RUN-XFAIL: llvm-mc -relocation-model=pic -mcpu=g4
>> -triple=powerpc-apple-darwin8 %t1 -o - | tee %t4 | macho-dump | tee %t5 |
>> FileCheck -check-prefix=DARWIN-G4-DUMP %s
>> ; RUN-XFAIL: diff -u %t2 %t4 || diff -u %t3 %t5
>>
>> The RUN-XFAIL doesn't actually run, it's just a comment.
>> The diff first compares object files, and if that fails, the second diff
>> will also fail and show the differences from macho-dump.
>>
>> Would this be acceptable for now?
>>
>> Fang
>>
>> > OK, now that I see that this is adding the entire PPCMachObjectWriter
>> > I think it should be tested with llvm-mc. Even a hack like using a .s
>> > file with "linux" syntax would be better than depending on llc
>> > -filetype=obj.
>> >
>> > In the past uses llc -filetype=obj stayed around longer than intended
>> > and were fairly brittle.
>> >
>> > On 25 July 2013 00:05, David Fang <fang at csl.cornell.edu> wrote:
>> > > Hi,
>> > > Attached is a patch from my powerpc-darwin8 branch
>> > > [https://github.com/fangism/llvm/tree/powerpc-darwin8] that I've been
>> > > maintaining and merging from trunk for months. This contains the
>> > > first cut
>> > > of the relocation entry implementation for mach-o/PPC, which is
>> > > missing on
>> > > trunk.
>> > >
>> > > The patch addresses the feature requested here:
>> > > http://llvm.org/bugs/show_bug.cgi?id=14636
>> > >
>> > > 1. This patch was extracted piecewise from my powerpc-darwin8 branch.
>> > > I can
>> > > only compile the branch and not master/trunk because of other
>> > > compiler-workarounds that are needed, but excluded from this patch.
>> > > It's *possible* I may have made a cut/paste/merge error.
>> > > I could use a volunteer or two to actually test-compile and run this
>> > > on
>> > > svn-trunk. Running the new test CodeGen/PowerPC/hello-reloc.ll with
>> > > llvm-lit would be great feedback, and shouldn't require a Darwin
>> > > machine,
>> > > just have Targets=PPC.
>> > >
>> > > 2. I've tested PIC objects on small hello-world sized programs such as
>> > > the
>> > > test that is included. The executables run correctly.
>> > >
>> > > 3. I have compared the object files and their dumps against
>> > > system-assembled
>> > > (GNU as) object files. (See bug report above for details.)
>> > >
>> > > 4. Style comments are welcome, though effort to conform on this was
>> > > minimal.
>> > > I plan to follow through on feedback.
>> > >
>> > > I understand this may take many iterations, but the ball has to get
>> > > rolling
>> > > some time.
>> > >
>> > > Let the comments begin.
>> > >
>> > > Fang
>> > >
>> > > --
>> > > David Fang
>> > > http://www.csl.cornell.edu/~fang/
>> > >
>>>> _______________________________________________
>> > > llvm-commits mailing list
>> > > llvm-commits at cs.uiuc.edu
>> > > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>> > >
>> >
>>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
--
David Fang
http://www.csl.cornell.edu/~fang/
More information about the llvm-commits
mailing list