1 ; This tests for the basic implementation of PPCMachObjectWriter.cpp, 2 ; which is responsible for writing mach-o relocation entries for (PIC) 3 ; PowerPC objects. 4 5 ; 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 6 7 .machine ppc7400 8 .section __TEXT,__textcoal_nt,coalesced,pure_instructions 9 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 10 .section __TEXT,__text,regular,pure_instructions 11 .globl _main 12 .align 4 13 _main: ; @main 14 ; BB#0: ; %entry 15 mflr r0 16 stw r31, -4(r1) 17 stw r0, 8(r1) 18 stwu r1, -80(r1) 19 bl L0$pb 20 L0$pb: 21 mr r31, r1 22 li r5, 0 23 mflr 2 24 stw r3, 68(r31) 25 stw r5, 72(r31) 26 stw r4, 64(r31) 27 addis r2, r2, ha16(L_.str-L0$pb) 28 la r3, lo16(L_.str-L0$pb)(r2) 29 bl L_puts$stub 30 li r3, 0 31 addi r1, r1, 80 32 lwz r0, 8(r1) 33 lwz r31, -4(r1) 34 mtlr r0 35 blr 36 37 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 38 .align 4 39 L_puts$stub: 40 .indirect_symbol _puts 41 mflr r0 42 bcl 20, 31, L_puts$stub$tmp 43 L_puts$stub$tmp: 44 mflr r11 45 addis r11, r11, ha16(L_puts$lazy_ptr-L_puts$stub$tmp) 46 mtlr r0 47 lwzu r12, lo16(L_puts$lazy_ptr-L_puts$stub$tmp)(r11) 48 mtctr r12 49 bctr 50 .section __DATA,__la_symbol_ptr,lazy_symbol_pointers 51 L_puts$lazy_ptr: 52 .indirect_symbol _puts 53 .long dyld_stub_binding_helper 54 55 .subsections_via_symbols 56 .section __TEXT,__cstring,cstring_literals 57 L_.str: ; @.str 58 .asciz "Hello, world!" 59 60 ; DARWIN-G4-DUMP:Format: Mach-O 32-bit ppc 61 ; DARWIN-G4-DUMP:Arch: powerpc 62 ; DARWIN-G4-DUMP:AddressSize: 32bit 63 ; DARWIN-G4-DUMP:Relocations [ 64 ; DARWIN-G4-DUMP: Section __text { 65 ; DARWIN-G4-DUMP: 0x34 1 2 0 PPC_RELOC_BR24 0 0x3 66 ; DARWIN-G4-DUMP: 0x30 0 2 n/a PPC_RELOC_LO16_SECTDIFF 1 0x74 67 ; DARWIN-G4-DUMP: 0x0 0 2 n/a PPC_RELOC_PAIR 1 0x14 68 ; DARWIN-G4-DUMP: 0x2C 0 2 n/a PPC_RELOC_HA16_SECTDIFF 1 0x74 69 ; DARWIN-G4-DUMP: 0x60 0 2 n/a PPC_RELOC_PAIR 1 0x14 70 ; DARWIN-G4-DUMP: } 71 ; DARWIN-G4-DUMP: Section __picsymbolstub1 { 72 ; DARWIN-G4-DUMP: 0x14 0 2 n/a PPC_RELOC_LO16_SECTDIFF 1 0x70 73 ; DARWIN-G4-DUMP: 0x0 0 2 n/a PPC_RELOC_PAIR 1 0x58 74 ; DARWIN-G4-DUMP: 0xC 0 2 n/a PPC_RELOC_HA16_SECTDIFF 1 0x70 75 ; DARWIN-G4-DUMP: 0x18 0 2 n/a PPC_RELOC_PAIR 1 0x58 76 ; DARWIN-G4-DUMP: } 77 ; DARWIN-G4-DUMP: Section __la_symbol_ptr { 78 ; DARWIN-G4-DUMP: 0x0 0 2 1 PPC_RELOC_VANILLA 0 dyld_stub_binding_helper 79 ; DARWIN-G4-DUMP: } 80 ; DARWIN-G4-DUMP:] 81