[test][lld-macho] Improve LC_FUNCTION_STARTS test coverage
authorKeith Smiley <keithbsmiley@gmail.com>
Sat, 29 Jan 2022 01:03:02 +0000 (17:03 -0800)
committerKeith Smiley <keithbsmiley@gmail.com>
Sun, 30 Jan 2022 17:46:36 +0000 (09:46 -0800)
Previously functions that aren't included in the symtab were also
excluded from the function starts. Symbols missing from function starts
degrades the debugger experience in the case you don't have debug info
for them.

Differential Revision: https://reviews.llvm.org/D114275

lld/test/MachO/function-starts.s

index d3e3f7c..ae97b19 100644 (file)
 # RUN: llvm-objdump --macho --function-starts %t/basic >> %t/objdump
 # RUN: FileCheck %s --check-prefix=BASIC < %t/objdump
 
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/local.s -o %t/local.o
+# RUN: %lld -lSystem %t/local.o -o %t/local
+# RUN: llvm-objdump --syms %t/local > %t/objdump
+# RUN: llvm-objdump --macho --function-starts %t/local >> %t/objdump
+# RUN: FileCheck %s --check-prefix=LOCAL < %t/objdump
+
+# LOCAL-LABEL: SYMBOL TABLE:
+# LOCAL-NEXT:  [[#%x,F1:]] l F __TEXT,__text +[Foo bar]
+# LOCAL-NEXT:  [[#%x,F2:]] l F __TEXT,__text _foo
+# LOCAL:       [[#%x,F3:]] g F __TEXT,__text _main
+# LOCAL-LABEL: local:
+# LOCAL:       [[#F1]]
+# LOCAL:       [[#F2]]
+# LOCAL:       [[#F3]]
+
 #--- basic.s
 .section  __TEXT,__text,regular,pure_instructions
 .globl  _f1
@@ -62,3 +77,15 @@ _f1:
   retq
 _main:
   retq
+
+#--- local.s
+.section __TEXT,__text
+"+[Foo bar]":
+  retq
+
+_foo:
+  retq
+
+.globl _main
+_main:
+  retq