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 -mcpu=g4 -triple=powerpc-apple-darwin8 %s -o - | llvm-readobj -r --expand-relocs | 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 20L0$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 39L_puts$stub: 40 .indirect_symbol _puts 41 mflr r0 42 bcl 20, 31, L_puts$stub$tmp 43L_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 51L_puts$lazy_ptr: 52 .indirect_symbol _puts 53 .long dyld_stub_binding_helper 54 55.subsections_via_symbols 56 .section __TEXT,__cstring,cstring_literals 57L_.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: Relocation { 66; DARWIN-G4-DUMP: Offset: 0x34 67; DARWIN-G4-DUMP: PCRel: 1 68; DARWIN-G4-DUMP: Length: 2 69; DARWIN-G4-DUMP: Type: PPC_RELOC_BR24 (3) 70; DARWIN-G4-DUMP: Section: __picsymbolstub1 71; DARWIN-G4-DUMP: } 72; DARWIN-G4-DUMP: Relocation { 73; DARWIN-G4-DUMP: Offset: 0x30 74; DARWIN-G4-DUMP: PCRel: 0 75; DARWIN-G4-DUMP: Length: 2 76; DARWIN-G4-DUMP: Type: PPC_RELOC_LO16_SECTDIFF (11) 77; DARWIN-G4-DUMP: Value: 0x74 78; DARWIN-G4-DUMP: } 79; DARWIN-G4-DUMP: Relocation { 80; DARWIN-G4-DUMP: Offset: 0x0 81; DARWIN-G4-DUMP: PCRel: 0 82; DARWIN-G4-DUMP: Length: 2 83; DARWIN-G4-DUMP: Type: PPC_RELOC_PAIR (1) 84; DARWIN-G4-DUMP: Value: 0x14 85; DARWIN-G4-DUMP: } 86; DARWIN-G4-DUMP: Relocation { 87; DARWIN-G4-DUMP: Offset: 0x2C 88; DARWIN-G4-DUMP: PCRel: 0 89; DARWIN-G4-DUMP: Length: 2 90; DARWIN-G4-DUMP: Type: PPC_RELOC_HA16_SECTDIFF (12) 91; DARWIN-G4-DUMP: Value: 0x74 92; DARWIN-G4-DUMP: } 93; DARWIN-G4-DUMP: Relocation { 94; DARWIN-G4-DUMP: Offset: 0x60 95; DARWIN-G4-DUMP: PCRel: 0 96; DARWIN-G4-DUMP: Length: 2 97; DARWIN-G4-DUMP: Type: PPC_RELOC_PAIR (1) 98; DARWIN-G4-DUMP: Value: 0x14 99; DARWIN-G4-DUMP: } 100; DARWIN-G4-DUMP: } 101; DARWIN-G4-DUMP: Section __picsymbolstub1 { 102; DARWIN-G4-DUMP: Relocation { 103; DARWIN-G4-DUMP: Offset: 0x14 104; DARWIN-G4-DUMP: PCRel: 0 105; DARWIN-G4-DUMP: Length: 2 106; DARWIN-G4-DUMP: Type: PPC_RELOC_LO16_SECTDIFF (11) 107; DARWIN-G4-DUMP: Value: 0x70 108; DARWIN-G4-DUMP: } 109; DARWIN-G4-DUMP: Relocation { 110; DARWIN-G4-DUMP: Offset: 0x0 111; DARWIN-G4-DUMP: PCRel: 0 112; DARWIN-G4-DUMP: Length: 2 113; DARWIN-G4-DUMP: Type: PPC_RELOC_PAIR (1) 114; DARWIN-G4-DUMP: Value: 0x58 115; DARWIN-G4-DUMP: } 116; DARWIN-G4-DUMP: Relocation { 117; DARWIN-G4-DUMP: Offset: 0xC 118; DARWIN-G4-DUMP: PCRel: 0 119; DARWIN-G4-DUMP: Length: 2 120; DARWIN-G4-DUMP: Type: PPC_RELOC_HA16_SECTDIFF (12) 121; DARWIN-G4-DUMP: Value: 0x70 122; DARWIN-G4-DUMP: } 123; DARWIN-G4-DUMP: Relocation { 124; DARWIN-G4-DUMP: Offset: 0x18 125; DARWIN-G4-DUMP: PCRel: 0 126; DARWIN-G4-DUMP: Length: 2 127; DARWIN-G4-DUMP: Type: PPC_RELOC_PAIR (1) 128; DARWIN-G4-DUMP: Value: 0x58 129; DARWIN-G4-DUMP: } 130; DARWIN-G4-DUMP: } 131; DARWIN-G4-DUMP: Section __la_symbol_ptr { 132; DARWIN-G4-DUMP: Relocation { 133; DARWIN-G4-DUMP: Offset: 0x0 134; DARWIN-G4-DUMP: PCRel: 0 135; DARWIN-G4-DUMP: Length: 2 136; DARWIN-G4-DUMP: Type: PPC_RELOC_VANILLA (0) 137; DARWIN-G4-DUMP: Symbol: dyld_stub_binding_helper 138; DARWIN-G4-DUMP: } 139; DARWIN-G4-DUMP: } 140; DARWIN-G4-DUMP:] 141