Expand Up
@@ -5,9 +5,11 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/c-string-literal.s -o %t/c-string-literal.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/baz.s -o %t/baz.o
# RUN: llvm-ar --format=darwin crs %t/libfoo.a %t/foo.o
# RUN: %lld -dylib %t/baz.o -o %t/libbaz.dylib
# RUN: %lld -demangle -map %t/map %t/test.o %t/foo.o %t/c-string-literal.o \
# RUN: %t/libbaz.dylib --time-trace -o %t/test --no-deduplicate-strings
# RUN: %lld -demangle -map %t/map %t/test.o -force_load %t/libfoo.a \
# RUN: %t/c-string-literal.o %t/libbaz.dylib --time-trace -o %t/test \
# RUN: --no-deduplicate-strings
# RUN: llvm-objdump --syms --section-headers %t/test > %t/objdump
## Check that symbols in cstring sections aren't emitted
## Also check that we don't have redundant EH_Frame symbols (regression test)
Expand All
@@ -17,7 +19,7 @@
# CHECK: Sections:
# CHECK-NEXT: Idx Name Size VMA Type
# CHECK-NEXT: 0 __text 0000001b [[#%x,TEXT:]] TEXT
# CHECK-NEXT: 0 __text 0000001c [[#%x,TEXT:]] TEXT
# CHECK-NEXT: 1 __stubs 0000000c [[#%x,STUBS:]] TEXT
# CHECK-NEXT: 2 __stub_helper 0000001a [[#%x,HELPER:]] TEXT
# CHECK-NEXT: 3 __cstring 0000002b [[#%x,CSTR:]] DATA
Expand All
@@ -42,11 +44,11 @@
# CHECK-NEXT: # Arch: x86_64
# CHECK-NEXT: # Object files:
# CHECK-NEXT: [ 0] linker synthesized
# CHECK-NEXT: [ 1] {{.*}}{{/|\\}}usr/lib{{/|\\}}libSystem.tbd
# CHECK-NEXT: [ 2] {{.*}}{{/|\\}}map-file.s.tmp/test.o
# CHECK-NEXT: [ 3] {{.*}}{{/|\\}}map-file.s.tmp/foo.o
# CHECK-NEXT: [ 4] {{.*}}{{/|\\}}map-file.s.tmp/c-string-literal.o
# CHECK-NEXT: [ 5] {{.*}}{{/|\\}}map-file.s.tmp/libbaz.dylib
# CHECK-NEXT: [ 1] {{.*}}{{/|\\}}usr/lib{{/|\\}}libSystem.tbd{{$}}
# CHECK-NEXT: [ 2] {{.*}}{{/|\\}}map-file.s.tmp/test.o{{$}}
# CHECK-NEXT: [ 3] {{.*}}{{/|\\}}map-file.s.tmp/libfoo.a( foo.o){{$}}
# CHECK-NEXT: [ 4] {{.*}}{{/|\\}}map-file.s.tmp/c-string-literal.o{{$}}
# CHECK-NEXT: [ 5] {{.*}}{{/|\\}}map-file.s.tmp/libbaz.dylib{{$}}
# CHECK-NEXT: # Sections:
# CHECK-NEXT: # Address Size Segment Section
Expand All
@@ -67,6 +69,7 @@
# CHECK-NEXT: 0x[[#%X,MAIN]] 0x00000019 [ 2] _main
# CHECK-NEXT: 0x[[#%X,BAR]] 0x00000001 [ 2] _bar
# CHECK-NEXT: 0x[[#%X,FOO]] 0x00000001 [ 3] __ZTIN3foo3bar4MethE
# CHECK-NEXT: 0x[[#%X,FOO+1]] 0x00000001 [ 3] ltmp1
# CHECK-NEXT: 0x[[#%X,STUBS]] 0x00000006 [ 5] _baz
# CHECK-NEXT: 0x[[#%X,STUBS+6]] 0x00000006 [ 2] _bar
# CHECK-NEXT: 0x[[#%X,HELPER]] 0x0000001A [ 0] helper helper
Expand All
@@ -84,11 +87,12 @@
# CHECK-NEXT: 0x[[#%X,DYLD]] 0x00000000 [ 0] __dyld_private
# CHECK-NEXT: 0x[[#%X,TLVP]] 0x00000008 [ 0] non-lazy-pointer-to-local: _baz_tlv
# CHECK-NEXT: 0x[[#%X,BSS]] 0x00000001 [ 2] _number
# CHECK-EMPTY:
# MAPFILE: "name":"Total Write map file"
# RUN: %lld -demangle -dead_strip -map %t/stripped-map %t/test.o %t/foo.o \
# RUN: %t/c-string-literal.o %t/libbaz.dylib -o %t/stripped
# RUN: %lld -demangle -dead_strip -map %t/stripped-map %t/test.o -force_load \
# RUN: %t/libfoo.a %t/ c-string-literal.o %t/libbaz.dylib -o %t/stripped
# RUN: FileCheck --check-prefix=STRIPPED %s < %t/stripped-map
# STRIPPED-LABEL: Dead Stripped Symbols:
Expand All
@@ -98,8 +102,8 @@
# STRIPPED-DAG: <<dead>> 0x0000000F [ 4] literal string: Hello, it's me
# STRIPPED-DAG: <<dead>> 0x0000000E [ 4] literal string: Hello world!\n
# RUN: %lld --icf=all -map %t/icf-map %t/test.o %t/foo.o %t/c-string-literal.o \
# RUN: %t/libbaz.dylib -o /dev/null
# RUN: %lld --icf=all -map %t/icf-map %t/test.o -force_load %t/libfoo.a \
# RUN: %t/c-string-literal.o %t/ libbaz.dylib -o /dev/null
# RUN: FileCheck --check-prefix=ICF %s < %t/icf-map
## Verify that folded symbols and cstrings have size zero. Note that ld64 prints
Expand All
@@ -113,11 +117,19 @@
#--- foo.s
.globl __ZTIN3foo3bar4MethE
## This should not appear in the map file since it is a zero-size private label
## symbol.
ltmp0:
## This C++ symbol makes it clear that we do not print the demangled name in
## the map file, even if `-demangle` is passed.
__ZTIN3foo3bar4MethE:
nop
## This private label symbol will appear in the map file since it has nonzero
## size.
ltmp1:
nop
.subsections_via_symbols
#--- test.s
Expand Down