1 ; This tests for the basic implementation of PPCMachObjectWriter.cpp,
2 ; which is responsible for writing mach-o relocation entries for (PIC)
5 ; RUN: llvm-mc -filetype=obj -relocation-model=pic -mcpu=g4 -triple=powerpc-apple-darwin8 %s -o - | llvm-readobj -r --expand-relocs | FileCheck -check-prefix=DARWIN-G4-DUMP %s
8 .section __TEXT,__textcoal_nt,coalesced,pure_instructions
9 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
10 .section __TEXT,__text,regular,pure_instructions
27 addis r2, r2, ha16(L_.str-L0$pb)
28 la r3, lo16(L_.str-L0$pb)(r2)
37 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
40 .indirect_symbol _puts
42 bcl 20, 31, L_puts$stub$tmp
45 addis r11, r11, ha16(L_puts$lazy_ptr-L_puts$stub$tmp)
47 lwzu r12, lo16(L_puts$lazy_ptr-L_puts$stub$tmp)(r11)
50 .section __DATA,__la_symbol_ptr,lazy_symbol_pointers
52 .indirect_symbol _puts
53 .long dyld_stub_binding_helper
55 .subsections_via_symbols
56 .section __TEXT,__cstring,cstring_literals
58 .asciz "Hello, world!"
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
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
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
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
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
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
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
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
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
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