1 ; This tests for the basic implementation of PPCMachObjectWriter.cpp,
2 ; which is responsible for writing mach-o relocation entries for (PIC)
4 ; NOTE: Darwin PPC asm syntax is not yet supported by PPCAsmParser,
5 ; so this test case uses ELF PPC asm syntax to produce a mach-o object.
6 ; Once PPCAsmParser supports darwin asm syntax, this test case should
7 ; be updated accordingly.
9 ; RUN: llvm-mc -filetype=obj -relocation-model=pic -mcpu=g4 -triple=powerpc-apple-darwin8 %s -o - | llvm-readobj -relocations | FileCheck -check-prefix=DARWIN-G4-DUMP %s
12 .section __TEXT,__textcoal_nt,coalesced,pure_instructions
13 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
14 .section __TEXT,__text,regular,pure_instructions
31 addis 2, 2, (L_.str-L0$pb)@ha
32 la 3, (L_.str-L0$pb)@l(2)
41 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
44 .indirect_symbol _puts
46 bcl 20, 31, L_puts$stub$tmp
49 addis 11, 11, (L_puts$lazy_ptr-L_puts$stub$tmp)@ha
51 lwzu 12, (L_puts$lazy_ptr-L_puts$stub$tmp)@l(11)
54 .section __DATA,__la_symbol_ptr,lazy_symbol_pointers
56 .indirect_symbol _puts
57 .long dyld_stub_binding_helper
59 .subsections_via_symbols
60 .section __TEXT,__cstring,cstring_literals
62 .asciz "Hello, world!"
64 ; DARWIN-G4-DUMP:Format: Mach-O 32-bit ppc
65 ; DARWIN-G4-DUMP:Arch: powerpc
66 ; DARWIN-G4-DUMP:AddressSize: 32bit
67 ; DARWIN-G4-DUMP:Relocations [
68 ; DARWIN-G4-DUMP: Section __text {
69 ; DARWIN-G4-DUMP: 0x34 1 2 0 PPC_RELOC_BR24 0 -
70 ; DARWIN-G4-DUMP: 0x30 0 2 n/a PPC_RELOC_LO16_SECTDIFF 1 _main
71 ; DARWIN-G4-DUMP: 0x0 0 2 n/a PPC_RELOC_PAIR 1 _main
72 ; DARWIN-G4-DUMP: 0x2C 0 2 n/a PPC_RELOC_HA16_SECTDIFF 1 _main
73 ; DARWIN-G4-DUMP: 0x60 0 2 n/a PPC_RELOC_PAIR 1 _main
75 ; DARWIN-G4-DUMP: Section __picsymbolstub1 {
76 ; DARWIN-G4-DUMP: 0x14 0 2 n/a PPC_RELOC_LO16_SECTDIFF 1 _main
77 ; DARWIN-G4-DUMP: 0x0 0 2 n/a PPC_RELOC_PAIR 1 _main
78 ; DARWIN-G4-DUMP: 0xC 0 2 n/a PPC_RELOC_HA16_SECTDIFF 1 _main
79 ; DARWIN-G4-DUMP: 0x18 0 2 n/a PPC_RELOC_PAIR 1 _main
81 ; DARWIN-G4-DUMP: Section __la_symbol_ptr {
82 ; DARWIN-G4-DUMP: 0x0 0 2 1 PPC_RELOC_VANILLA 0 dyld_stub_binding_helper