1# REQUIRES: asserts
2# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj -o %t %s
3# RUN: llvm-jitlink -debug-only=jitlink -noexec -entry hook %t 2>&1 | \
4# RUN:   FileCheck %s
5#
6# Verify that we split C string literals on null-terminators, rather than on
7# symbol boundaries. We expect four dead-stripped symbols: l_str.0, l_str.2,
8# L_str.3, l_str.4, and the auto-generated symbol for the start of the "defghi"
9# string. We also verify that there are only two dead-stripped blocks, since
10# l_str.3 should not have split the block started at "def"... (since this is a
11# C string section we should be splitting on null characters instead of
12# symbols).
13#
14# CHECK:      Dead-stripping defined symbols:
15# CHECK-NEXT: linkage: strong, scope: local, dead
16# CHECK-NEXT: linkage: strong, scope: local, dead
17# CHECK-NEXT: linkage: strong, scope: local, dead
18# CHECK-NEXT: linkage: strong, scope: local, dead
19# CHECK-NEXT: Dead-stripping blocks:
20# CHECK-NEXT: content, align = 1, align-ofs = 0, section = __TEXT,__cstring
21# CHECK-NEXT: content, align = 1, align-ofs = 0, section = __TEXT,__cstring
22# CHECK-NEXT: Removing unused external symbols
23
24        .section        __DATA,__data
25        .globl  hook
26        .p2align        2
27hook:
28        .quad   l_str.1
29
30        .section        __TEXT,__cstring,cstring_literals
31l_str.0:
32l_str.1:
33        .asciz  "abc"
34l_str.2:
35        .asciz  ""
36# anonymous start for "defghi", split in the middle by l_str.3. We expect this
37# to be dead-stripped as a single block.
38        .byte   'd'
39        .byte   'e'
40        .byte   'f'
41l_str.3:
42        .asciz  "ghi"
43
44.subsections_via_symbols
45