[PowerPC, Mach-O] PPCMachObjectWriter.cpp, at long last

Rafael EspĂ­ndola rafael.espindola at gmail.com
Fri Jul 26 05:24:48 PDT 2013


On 25 July 2013 17:20, David Fang <fang at csl.cornell.edu> wrote:
> I tried the following sed-transformation to turn darwin-asm to linux-asm:
>
> "darwin-to-linux-asm.sed":
> #!/sw/bin/sed -f
> s|\<r\([0-9]\+\)\>|\1|g
> s|\<ha16\>\(([^(]*)\)|\1 at ha|g
> s|\<lo16\>\(([^(]*)\)|\1 at l|g
> s|\<L[A-Za-z0-9.$_]\+\>|.&|g
>
> 1) strip 'r' from register names
> 2,3) transform ha16/lo16 operators
> 4) prepend . to local symbols
>
> % darwin-to-linux-asm.sed hello-puts.s > hello-puts-linux.s
>
> % llvm-mc -triple=powerpc-apple-darwin8 -mcpu=g4 -relocation-model=pic
> -filetype=obj hello-puts-linux.s -o hello-puts-linux.o
>
> llvm-mc was able to compile this version of the assembly, but produced an
> object file that differs from the one produced by llc -filetype=obj.
>
> diffs:
> http://paste.lisp.org/display/138202#1
>
> I'm not partcularly comfortable going down this path with hacks.
> I'd need to be advised on all the syntactic transformations needed.
> Can't we just keep the llc -filetype=obj test for now until proper
> darwin-asm syntax is supported?

Please don't. If you, the author, finds it hard to figure out what is
difference, imagine someone doing refactoring and hitting problems
with llc -filetype=obj. Tests like that are a maintenance nightmare.

You should figure out where the difference is from. The first
difference seems to be that we get an extra

0x14 1 2 0 PPC_RELOC_BR24 0 -

btw, are the symbols that we are printing correct? Do they match what
otool prints?

Having said that, the idea of having a .s test is *not* for it to be
just the output of llc. The idea is to have human written minimal
tests for a given feature.

> Fang
>

Cheers,
Rafael



More information about the llvm-commits mailing list