2 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
4 # RUN: %lld -lSystem --icf=all %t.o -o %t
5 # RUN: dsymutil -s %t | FileCheck %s -DDIR=%t -DSRC_PATH=%t.o
7 # RUN: %lld -lSystem --icf=all %t.o -o %t_icf_stabs --keep-icf-stabs
8 # RUN: dsymutil -s %t_icf_stabs | FileCheck %s -DDIR=%t_icf_stabs -DSRC_PATH=%t.o --check-prefixes=ICF_STABS
10 ## This should include no N_FUN entry for _baz (which is ICF'd into _bar),
11 ## but it does include a SECT EXT entry.
12 ## NOTE: We do not omit the N_FUN entry for _bar even though it is of size zero.
13 ## Only folded symbols get omitted.
14 ## NOTE: Unlike ld64, we also omit the N_FUN entry for _baz2.
15 # CHECK: (N_SO ) 00 0000 0000000000000000 '/tmp{{[/\\]}}test.cpp'
16 # CHECK-NEXT: (N_OSO ) 03 0001 {{.*}} '[[SRC_PATH]]'
17 # CHECK-NEXT: (N_FUN ) 01 0000 [[#%.16x,MAIN:]] '_main'
18 # CHECK-NEXT: (N_FUN ) 00 0000 000000000000000b{{$}}
19 # CHECK-NEXT: (N_FUN ) 01 0000 [[#%.16x,BAR:]] '_bar'
20 # CHECK-NEXT: (N_FUN ) 00 0000 0000000000000000{{$}}
21 # CHECK-NEXT: (N_FUN ) 01 0000 [[#BAR]] '_bar2'
22 # CHECK-NEXT: (N_FUN ) 00 0000 0000000000000001{{$}}
23 # CHECK-NEXT: (N_SO ) 01 0000 0000000000000000{{$}}
24 # CHECK-DAG: ( SECT EXT) 01 0000 [[#MAIN]] '_main'
25 # CHECK-DAG: ( SECT EXT) 01 0000 [[#BAR]] '_bar'
26 # CHECK-DAG: ( SECT EXT) 01 0000 [[#BAR]] '_bar2'
27 # CHECK-DAG: ( SECT EXT) 01 0000 [[#BAR]] '_baz'
28 # CHECK-DAG: ( SECT EXT) 01 0000 [[#BAR]] '_baz2'
29 # CHECK-DAG: ( {{.*}}) {{[0-9]+}} 0010 {{[0-9a-f]+}} '__mh_execute_header'
30 # CHECK-DAG: ( {{.*}}) {{[0-9]+}} 0100 0000000000000000 'dyld_stub_binder'
34 # ICF_STABS: (N_SO ) 00 0000 0000000000000000 '/tmp{{[/\\]}}test.cpp'
35 # ICF_STABS-NEXT: (N_OSO ) 03 0001 {{.*}} '[[SRC_PATH]]'
36 # ICF_STABS-NEXT: (N_FUN ) 01 0000 [[#%.16x,MAIN:]] '_main'
37 # ICF_STABS-NEXT: (N_FUN ) 00 0000 000000000000000b{{$}}
38 # ICF_STABS-NEXT: (N_FUN ) 01 0000 [[#%.16x,BAR:]] '_bar'
39 # ICF_STABS-NEXT: (N_FUN ) 00 0000 0000000000000000{{$}}
40 # ICF_STABS-NEXT: (N_FUN ) 01 0000 [[#BAR]] '_bar2'
41 # ICF_STABS-NEXT: (N_FUN ) 00 0000 0000000000000001{{$}}
42 # ICF_STABS-NEXT: (N_FUN ) 01 0000 [[#BAR]] '_baz'
43 # ICF_STABS-NEXT: (N_FUN ) 00 0000 0000000000000000{{$}}
44 # ICF_STABS-NEXT: (N_FUN ) 01 0000 [[#BAR]] '_baz2'
45 # ICF_STABS-NEXT: (N_FUN ) 00 0000 0000000000000001{{$}}
46 # ICF_STABS-NEXT: (N_SO ) 01 0000 0000000000000000{{$}}
47 # ICF_STABS-DAG: ( SECT EXT) 01 0000 [[#MAIN]] '_main'
48 # ICF_STABS-DAG: ( SECT EXT) 01 0000 [[#BAR]] '_bar'
49 # ICF_STABS-DAG: ( SECT EXT) 01 0000 [[#BAR]] '_bar2'
50 # ICF_STABS-DAG: ( SECT EXT) 01 0000 [[#BAR]] '_baz'
51 # ICF_STABS-DAG: ( SECT EXT) 01 0000 [[#BAR]] '_baz2'
52 # ICF_STABS-DAG: ( {{.*}}) {{[0-9]+}} 0010 {{[0-9a-f]+}} '__mh_execute_header'
53 # ICF_STABS-DAG: ( {{.*}}) {{[0-9]+}} 0100 0000000000000000 'dyld_stub_binder'
58 .globl _bar, _bar2, _baz, _baz2, _main
60 .subsections_via_symbols
77 .section __DWARF,__debug_str,regular,debug
78 .asciz "test.cpp" ## string offset=0
79 .asciz "/tmp" ## string offset=9
80 .section __DWARF,__debug_abbrev,regular,debug
82 .byte 1 ## Abbreviation Code
83 .byte 17 ## DW_TAG_compile_unit
84 .byte 1 ## DW_CHILDREN_yes
86 .byte 14 ## DW_FORM_strp
87 .byte 27 ## DW_AT_comp_dir
88 .byte 14 ## DW_FORM_strp
89 .byte 17 ## DW_AT_low_pc
90 .byte 1 ## DW_FORM_addr
91 .byte 18 ## DW_AT_high_pc
92 .byte 6 ## DW_FORM_data4
96 .section __DWARF,__debug_info,regular,debug
97 .set Lset0, Ldebug_info_end0-Ldebug_info_start0 ## Length of Unit
100 .short 4 ## DWARF version number
101 .set Lset1, Lsection_abbrev-Lsection_abbrev ## Offset Into Abbrev. Section
103 .byte 8 ## Address Size (in bytes)
104 .byte 1 ## Abbrev [1] 0xb:0x48 DW_TAG_compile_unit
105 .long 0 ## DW_AT_name
106 .long 9 ## DW_AT_comp_dir
107 .quad Lfunc_begin0 ## DW_AT_low_pc
108 .set Lset3, Lfunc_end0-Lfunc_begin0 ## DW_AT_high_pc
110 .byte 0 ## End Of Children Mark