llvm-project
35 строк · 1.2 Кб
1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
3
4# RUN: %lld %t.o -lSystem -o %t.out
5# RUN: llvm-readobj --syms %t.out | FileCheck %s
6
7## ld64 has a "TEMP work around until <rdar://problem/7702923> goes in"
8## that promotes PrivateExtern ReferencedDynamically symbols in dylibs to
9## normal Externs. lld does not do this.
10# RUN: %lld -dylib %t.o -o %t.dylib
11# RUN: llvm-readobj --syms %t.dylib | FileCheck %s
12
13# CHECK: Name: ___crashreporter_info__
14# CHECK-NEXT: PrivateExtern
15# CHECK-NEXT: Type: Section (0xE)
16# CHECK-NEXT: Section: __common
17# CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
18# CHECK-NEXT: Flags [ (0x10)
19# CHECK-NEXT: ReferencedDynamically (0x10)
20# CHECK-NEXT: ]
21
22## Reduced from lib/Support/PrettyStackTrace.cpp
23.section __TEXT,__text,regular,pure_instructions
24
25.globl _main
26_main:
27ret
28
29## .private_extern matches what PrettyStackTrace.cpp does, but it makes
30## the ReferencedDynamically pointless: https://reviews.llvm.org/D27683#2763729
31.private_extern ___crashreporter_info__
32.globl ___crashreporter_info__
33.desc ___crashreporter_info__,16
34.zerofill __DATA,__common,___crashreporter_info__,8,3
35.subsections_via_symbols
36