brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.6 KiB · 66de0f4 Raw
147 lines · plain
1# REQUIRES: x862 3# RUN: rm -rf %t; split-file %s %t4# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos \5# RUN:     %t/basics.s -o %t/basics.o6 7## Check that .private_extern symbols are marked as local in the symbol table8## and aren't in the export trie.9# RUN: %lld -dylib %t/basics.o -o %t/basics10# RUN: llvm-objdump --syms --exports-trie %t/basics | \11# RUN:     FileCheck --check-prefix=EXPORTS %s12# RUN: llvm-nm -m %t/basics | FileCheck --check-prefix=EXPORTS-NM %s13# EXPORTS-LABEL: SYMBOL TABLE:14# EXPORTS-DAG:   [[#%x, FOO_ADDR:]] l {{.*}} _foo15# EXPORTS-DAG:   [[#%x, BAR_ADDR:]] g {{.*}} _bar16# EXPORTS-LABEL: Exports trie:17# EXPORTS-NOT:   0x{{0*}}[[#%X, FOO_ADDR]] _foo18# EXPORTS-DAG:   0x{{0*}}[[#%X, BAR_ADDR]] _bar19# EXPORTS-NOT:   0x{{0*}}[[#%X, FOO_ADDR]] _foo20# EXPORTS-NM-DAG: (__TEXT,__cstring) non-external (was a private external) _foo21# EXPORTS-NM-DAG: (__TEXT,__cstring) external _bar22 23## The tests for weak .private_extern symbols not being referenced in the24## weak bind table can be found in weak-private-extern.s25 26#--- basics.s27.section __TEXT,__cstring28 29.globl _foo, _bar30.private_extern _foo31 32_foo:33.asciz "Foo"34 35_bar:36.asciz "Bar"37 38# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos \39# RUN:     %t/strong-globl.s -o %t/strong-globl.o40# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos \41# RUN:     %t/weak-globl.s -o %t/weak-globl.o42 43# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos \44# RUN:     %t/strong-private.s -o %t/strong-private.o45# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos \46# RUN:     %t/weak-private.s -o %t/weak-private.o47 48## weak + strong symbol takes privateness from strong symbol49## - weak private extern + strong extern = strong extern (for both .o orderings)50# RUN: %lld -dylib %t/weak-private.o %t/strong-globl.o -o %t/wpsg51# RUN: llvm-nm -m %t/wpsg | FileCheck --check-prefix=EXTERNAL %s52# RUN: %lld -dylib %t/strong-globl.o %t/weak-private.o -o %t/sgwp53# RUN: llvm-nm -m %t/sgwp | FileCheck --check-prefix=EXTERNAL %s54# EXTERNAL: (__TEXT,__text) external _foo55## - weak extern + strong private extern = strong private extern56##   (for both .o orderings)57# RUN: %lld -dylib %t/weak-globl.o %t/strong-private.o -o %t/wgsp58# RUN: llvm-nm -m %t/wgsp | FileCheck --check-prefix=NONEXTERNAL %s59# RUN: %lld -dylib %t/strong-private.o %t/weak-globl.o -o %t/spwg60# RUN: llvm-nm -m %t/spwg | FileCheck --check-prefix=NONEXTERNAL %s61# NONEXTERNAL: (__TEXT,__text) non-external (was a private external) _foo62 63## weak + weak symbol take weaker privateness64## - weak extern + weak private extern = weak extern (both orders)65# RUN: %lld -dylib %t/weak-private.o %t/weak-globl.o -o %t/wpwg66# RUN: llvm-nm -m %t/wpwg | FileCheck --check-prefix=WEAK-EXTERNAL %s67# RUN: %lld -dylib %t/weak-globl.o %t/weak-private.o -o %t/wgwp68# RUN: llvm-nm -m %t/wgwp | FileCheck --check-prefix=WEAK-EXTERNAL %s69# WEAK-EXTERNAL: (__TEXT,__text) weak external _foo70## - weak private extern + weak private extern = weak private extern71# RUN: %lld -dylib %t/weak-private.o %t/weak-private.o -o %t/wpwp72# RUN: llvm-nm -m %t/wpwp | FileCheck --check-prefix=NONEXTERNAL %s73 74#--- strong-globl.s75.globl _foo76_foo:77  retq78 79#--- weak-globl.s80.globl _foo81.weak_definition _foo82_foo:83  retq84 85#--- strong-private.s86.private_extern _foo87.globl _foo88_foo:89  retq90 91#--- weak-private.s92.private_extern _foo93.globl _foo94.weak_definition _foo95_foo:96  retq97 98# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos \99# RUN:     %t/comm-small.s -o %t/comm-small.o100# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos \101# RUN:     %t/comm-large.s -o %t/comm-large.o102 103# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos \104# RUN:     %t/comm-small-private.s -o %t/comm-small-private.o105# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos \106# RUN:     %t/comm-large-private.s -o %t/comm-large-private.o107 108## For common symbols the larger one wins.109## - smaller private extern + larger extern = larger extern110# RUN: %lld -dylib %t/comm-small-private.o %t/comm-large.o -o %t/cspcl111# RUN: llvm-nm -m %t/cspcl | FileCheck --check-prefix=COMMON-EXTERNAL %s112# RUN: %lld -dylib %t/comm-large.o %t/comm-small-private.o -o %t/clcsp113# RUN: llvm-nm -m %t/clcsp | FileCheck --check-prefix=COMMON-EXTERNAL %s114# COMMON-EXTERNAL: (__DATA,__common) external _foo115## - smaller extern + larger private extern = larger private extern116# RUN: %lld -dylib %t/comm-large-private.o %t/comm-small.o -o %t/clpcs117# RUN: llvm-nm -m %t/clpcs | FileCheck --check-prefix=COMMON-NONEXTERNAL %s118# RUN: %lld -dylib %t/comm-small.o %t/comm-large-private.o -o %t/csclp119# RUN: llvm-nm -m %t/csclp | FileCheck --check-prefix=COMMON-NONEXTERNAL %s120# COMMON-NONEXTERNAL: (__DATA,__common) non-external (was a private external) _foo121 122# For common symbols with the same size, the privateness of the symbol seen123# later wins (!).124## - equal private extern + equal extern = equal extern (both orders)125# RUN: %lld -dylib %t/comm-small-private.o %t/comm-small.o -o %t/cspcs126# RUN: llvm-nm -m %t/cspcs | FileCheck --check-prefix=COMMON-EXTERNAL %s127## - equal extern + equal private extern = equal private extern (both orders)128# RUN: %lld -dylib %t/comm-small.o %t/comm-small-private.o -o %t/cscsp129# RUN: llvm-nm -m %t/cscsp | FileCheck --check-prefix=COMMON-NONEXTERNAL %s130## - equal private extern + equal private extern = equal private extern131# RUN: %lld -dylib %t/comm-small-private.o %t/comm-small-private.o -o %t/cspcsp132# RUN: llvm-nm -m %t/cspcsp | FileCheck --check-prefix=COMMON-NONEXTERNAL %s133 134#--- comm-small.s135.comm _foo,4,2136 137#--- comm-large.s138.comm _foo,8,3139 140#--- comm-small-private.s141.private_extern _foo142.comm _foo,4,2143 144#--- comm-large-private.s145.private_extern _foo146.comm _foo,8,3147