1# REQUIRES: x86,ppc 2 3# RUN: echo ".globl foo; .data; .dc.a foo" > %te.s 4# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %te.s -o %te-i386.o 5# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %s -o %t-i386.o 6# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t-x86_64.o 7# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t-ppc64le.o 8# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t-ppc64.o 9 10# RUN: echo ".global zed; zed:" > %t2.s 11# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %t2.s -o %t2-i386.o 12# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %t2.s -o %t2-x86_64.o 13# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %t2.s -o %t2-ppc64le.o 14# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %t2.s -o %t2-ppc64.o 15 16# RUN: rm -f %t2-i386.a %t2-x86_64.a %t2-ppc64.a %t2-ppc64le.a 17# RUN: llvm-ar rc %t2-i386.a %t2-i386.o 18# RUN: llvm-ar rc %t2-x86_64.a %t2-x86_64.o 19# RUN: llvm-ar rc %t2-ppc64le.a %t2-ppc64le.o 20# RUN: llvm-ar rc %t2-ppc64.a %t2-ppc64.o 21 22# RUN: echo ".global xyz; xyz:" > %t3.s 23# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %t3.s -o %t3-i386.o 24# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %t3.s -o %t3-x86_64.o 25# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %t3.s -o %t3-ppc64le.o 26# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %t3.s -o %t3-ppc64.o 27 28# RUN: ld.lld -shared %t3-i386.o -o %t3-i386.so 29# RUN: ld.lld -shared %t3-x86_64.o -o %t3-x86_64.so 30# RUN: ld.lld -shared %t3-ppc64le.o -o %t3-ppc64le.so 31# RUN: ld.lld -shared %t3-ppc64.o -o %t3-ppc64.so 32 33# RUN: ld.lld -shared --hash-style=gnu -o %te-i386.so %te-i386.o 34# RUN: ld.lld -shared -hash-style=gnu -o %t-i386.so %t-i386.o %t2-i386.a %t3-i386.so 35# RUN: ld.lld -shared -hash-style=gnu -o %t-x86_64.so %t-x86_64.o %t2-x86_64.a %t3-x86_64.so 36# RUN: ld.lld -shared --hash-style both -o %t-ppc64le.so %t-ppc64le.o %t2-ppc64le.a %t3-ppc64le.so 37# RUN: ld.lld -shared --hash-style both -o %t-ppc64.so %t-ppc64.o %t2-ppc64.a %t3-ppc64.so 38 39# RUN: llvm-readobj --dyn-syms --gnu-hash-table %te-i386.so \ 40# RUN: | FileCheck %s -check-prefix=EMPTY 41# RUN: llvm-readobj --sections --dyn-syms --gnu-hash-table %t-i386.so \ 42# RUN: | FileCheck %s -check-prefix=I386 43# RUN: llvm-readobj --sections --dyn-syms --gnu-hash-table %t-x86_64.so \ 44# RUN: | FileCheck %s -check-prefix=X86_64 45# RUN: llvm-readobj --sections --dyn-syms --gnu-hash-table %t-ppc64le.so \ 46# RUN: | FileCheck %s -check-prefix=PPC64 47# RUN: llvm-readobj --sections --dyn-syms --gnu-hash-table %t-ppc64.so \ 48# RUN: | FileCheck %s -check-prefix=PPC64 49 50# EMPTY: DynamicSymbols [ 51# EMPTY: Symbol { 52# EMPTY: Name: foo 53# EMPTY-NEXT: Value: 0x0 54# EMPTY-NEXT: Size: 0 55# EMPTY-NEXT: Binding: Global 56# EMPTY-NEXT: Type: None 57# EMPTY-NEXT: Other: 0 58# EMPTY-NEXT: Section: Undefined 59# EMPTY-NEXT: } 60# EMPTY-NEXT: ] 61# EMPTY: GnuHashTable { 62# EMPTY-NEXT: Num Buckets: 1 63# EMPTY-NEXT: First Hashed Symbol Index: 2 64# EMPTY-NEXT: Num Mask Words: 1 65# EMPTY-NEXT: Shift Count: 26 66# EMPTY-NEXT: Bloom Filter: [0x0] 67# EMPTY-NEXT: Buckets: [0] 68# EMPTY-NEXT: Values: [] 69# EMPTY-NEXT: } 70 71# I386: Format: elf32-i386 72# I386: Arch: i386 73# I386: AddressSize: 32bit 74# I386: Sections [ 75# I386: Name: .gnu.hash 76# I386-NEXT: Type: SHT_GNU_HASH 77# I386-NEXT: Flags [ 78# I386-NEXT: SHF_ALLOC 79# I386-NEXT: ] 80# I386-NEXT: Address: 81# I386-NEXT: Offset: 82# I386-NEXT: Size: 32 83# I386-NEXT: Link: 84# I386-NEXT: Info: 0 85# I386-NEXT: AddressAlignment: 4 86# I386-NEXT: EntrySize: 0 87# I386: ] 88# I386: DynamicSymbols [ 89# I386: Symbol { 90# I386: Name: 91# I386: Binding: Local 92# I386: Section: Undefined 93# I386: } 94# I386: Symbol { 95# I386: Name: baz 96# I386: Binding: Global 97# I386: Section: Undefined 98# I386: } 99# I386: Symbol { 100# I386: Name: xyz 101# I386: Binding: Global 102# I386: Section: Undefined 103# I386: } 104# I386: Symbol { 105# I386: Name: zed 106# I386: Binding: Weak 107# I386: Section: Undefined 108# I386: } 109# I386: Symbol { 110# I386: Name: bar 111# I386: Binding: Global 112# I386: Section: .text 113# I386: } 114# I386: Symbol { 115# I386: Name: foo 116# I386: Binding: Global 117# I386: Section: .text 118# I386: } 119# I386: ] 120# I386: GnuHashTable { 121# I386-NEXT: Num Buckets: 1 122# I386-NEXT: First Hashed Symbol Index: 4 123# I386-NEXT: Num Mask Words: 1 124# I386-NEXT: Shift Count: 26 125# I386-NEXT: Bloom Filter: [0x4000204] 126# I386-NEXT: Buckets: [4] 127# I386-NEXT: Values: [0xB8860BA, 0xB887389] 128# I386-NEXT: } 129 130# X86_64: Format: elf64-x86-64 131# X86_64: Arch: x86_64 132# X86_64: AddressSize: 64bit 133# X86_64: Sections [ 134# X86_64: Name: .gnu.hash 135# X86_64-NEXT: Type: SHT_GNU_HASH 136# X86_64-NEXT: Flags [ 137# X86_64-NEXT: SHF_ALLOC 138# X86_64-NEXT: ] 139# X86_64-NEXT: Address: 140# X86_64-NEXT: Offset: 141# X86_64-NEXT: Size: 36 142# X86_64-NEXT: Link: 143# X86_64-NEXT: Info: 0 144# X86_64-NEXT: AddressAlignment: 8 145# X86_64-NEXT: EntrySize: 0 146# X86_64-NEXT: } 147# X86_64: ] 148# X86_64: DynamicSymbols [ 149# X86_64: Symbol { 150# X86_64: Name: 151# X86_64: Binding: Local 152# X86_64: Section: Undefined 153# X86_64: } 154# X86_64: Symbol { 155# X86_64: Name: baz 156# X86_64: Binding: Global 157# X86_64: Section: Undefined 158# X86_64: } 159# X86_64: Symbol { 160# X86_64: Name: xyz 161# X86_64: Binding: Global 162# X86_64: Section: Undefined 163# X86_64: } 164# X86_64: Symbol { 165# X86_64: Name: zed 166# X86_64: Binding: Weak 167# X86_64: Section: Undefined 168# X86_64: } 169# X86_64: Symbol { 170# X86_64: Name: bar 171# X86_64: Binding: Global 172# X86_64: Section: .text 173# X86_64: } 174# X86_64: Symbol { 175# X86_64: Name: foo 176# X86_64: Binding: Global 177# X86_64: Section: .text 178# X86_64: } 179# X86_64: ] 180# X86_64: GnuHashTable { 181# X86_64-NEXT: Num Buckets: 1 182# X86_64-NEXT: First Hashed Symbol Index: 4 183# X86_64-NEXT: Num Mask Words: 1 184# X86_64-NEXT: Shift Count: 26 185# X86_64-NEXT: Bloom Filter: [0x400000000000204] 186# X86_64-NEXT: Buckets: [4] 187# X86_64-NEXT: Values: [0xB8860BA, 0xB887389] 188# X86_64-NEXT: } 189 190# PPC64: Format: elf64-powerpc 191# PPC64: Arch: powerpc64 192# PPC64: AddressSize: 64bit 193# PPC64: Sections [ 194# PPC64: Name: .gnu.hash 195# PPC64-NEXT: Type: SHT_GNU_HASH 196# PPC64-NEXT: Flags [ 197# PPC64-NEXT: SHF_ALLOC 198# PPC64-NEXT: ] 199# PPC64-NEXT: Address: 200# PPC64-NEXT: Offset: 201# PPC64-NEXT: Size: 36 202# PPC64-NEXT: Link: 203# PPC64-NEXT: Info: 0 204# PPC64-NEXT: AddressAlignment: 8 205# PPC64-NEXT: EntrySize: 0 206# PPC64-NEXT: } 207# PPC64: ] 208# PPC64: DynamicSymbols [ 209# PPC64: Symbol { 210# PPC64: Name: 211# PPC64: Binding: Local 212# PPC64: Section: Undefined 213# PPC64: } 214# PPC64: Symbol { 215# PPC64: Name: baz 216# PPC64: Binding: Global 217# PPC64: Section: Undefined 218# PPC64: } 219# PPC64: Symbol { 220# PPC64: Name: xyz 221# PPC64: Binding: Global 222# PPC64: Section: Undefined 223# PPC64: } 224# PPC64: Symbol { 225# PPC64: Name: zed 226# PPC64: Binding: Weak 227# PPC64: Section: Undefined 228# PPC64: } 229# PPC64: Symbol { 230# PPC64: Name: bar 231# PPC64: Binding: Global 232# PPC64: Section: .text 233# PPC64: } 234# PPC64: Symbol { 235# PPC64: Name: foo 236# PPC64: Binding: Global 237# PPC64: Section: .text 238# PPC64: } 239# PPC64: ] 240# PPC64: GnuHashTable { 241# PPC64-NEXT: Num Buckets: 1 242# PPC64-NEXT: First Hashed Symbol Index: 4 243# PPC64-NEXT: Num Mask Words: 1 244# PPC64-NEXT: Shift Count: 26 245# PPC64-NEXT: Bloom Filter: [0x400000000000204] 246# PPC64-NEXT: Buckets: [4] 247# PPC64-NEXT: Values: [0xB8860BA, 0xB887389] 248# PPC64-NEXT: } 249 250.globl foo,bar,baz 251foo: 252bar: 253.weak zed 254.global xyz 255.data 256 .dc.a baz 257