Skip to content

Commit 5900014

Browse files
authored
[dsymutil] Improve missing symbol warning message (llvm#75378)
The current warning emitted by dsymutil when it can't find a symbol in an object file is worded rather poorly: ``` could not find object file symbol for symbol _foo ``` It's also lacking information that makes the warning actionable, such as the object file it's looking at. This patch rewords the warning and adds the object file path to the warning: ``` could not find symbol '_foo' in object file 'test.o' ``` rdar://119621065
1 parent fcce843 commit 5900014

File tree

8 files changed

+11
-7
lines changed

8 files changed

+11
-7
lines changed

llvm/test/tools/dsymutil/ARM/extern-alias.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/extern/ext
4141
RUN: dsymutil --linker llvm -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/private_extern/private_extern.out -o %t.dSYM --verbose | FileCheck %s
4242
RUN: dsymutil --linker llvm -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/extern/extern.out -o %t.dSYM --verbose | FileCheck %s
4343

44-
CHECK-NOT: could not find object file symbol for symbol _baz
44+
CHECK-NOT: could not find symbol '_baz'
4545
CHECK: { sym: _baz, objAddr: 0x0, binAddr: 0x100007F58, size: 0x0 }
4646
CHECK: { sym: _foo, objAddr: 0x0, binAddr: 0x100007F58, size: 0x20 }
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
RUN: dsymutil -oso-prepend-path %p/../Inputs --dump-debug-map %p/../Inputs/private/tmp/warning/test.out 2>&1 | FileCheck %s
2+
# CHECK: could not find symbol '_foo' in object file '{{.*}}test.o'
3+
# CHECK: { sym: _main, objAddr: 0x0, binAddr: 0x100003F84, size: 0x1C }

llvm/test/tools/dsymutil/ARM/static-archive-collision.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ $ clang main.o foo.a -o main.out
2222

2323
RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/collision/main.out --dump-debug-map 2>&1 | FileCheck %s
2424
CHECK: skipping debug map object with duplicate name and timestamp: {{.*}} /private/tmp/collision/foo.a(foo.o)
25-
CHECK-NOT: could not find object file symbol for symbol _g
26-
CHECK-NOT: could not find object file symbol for symbol _f
25+
CHECK-NOT: could not find symbol '_g'
26+
CHECK-NOT: could not find symbol '_f'
Binary file not shown.
Binary file not shown.

llvm/test/tools/dsymutil/X86/alias.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# RUN: dsymutil --linker llvm -f -oso-prepend-path=%p/../Inputs/alias \
55
# RUN: %p/../Inputs/alias/foobar -o - | llvm-dwarfdump - 2>&1 | FileCheck %s
66

7-
# CHECK-NOT: could not find object file symbol for symbol
7+
# CHECK-NOT: could not find symbol
88
# CHECK: DW_AT_name ("foo.c")
99
# CHECK: DW_AT_name ("bar.c")
1010

llvm/test/tools/dsymutil/X86/thinlto.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/thinlto/fo
2323

2424
RUN: dsymutil --linker llvm -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/thinlto/foobar.dylib -o %t.dSYM 2>&1 | FileCheck %s --allow-empty
2525

26-
CHECK-NOT: could not find object file symbol for symbol __ZZ9function2vE12magic_static
27-
CHECK-NOT: could not find object file symbol for symbol __ZGVZ9function2vE12magic_static
26+
CHECK-NOT: could not find symbol '__ZZ9function2vE12magic_static'
27+
CHECK-NOT: could not find symbol 'symbol __ZGVZ9function2vE12magic_static'

llvm/tools/dsymutil/MachODebugMapParser.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,8 @@ void MachODebugMapParser::handleStabSymbolTableEntry(
729729
}
730730

731731
if (ObjectSymIt == CurrentObjectAddresses.end()) {
732-
Warning("could not find object file symbol for symbol " + Twine(Name));
732+
Warning("could not find symbol '" + Twine(Name) + "' in object file '" +
733+
CurrentDebugMapObject->getObjectFilename() + "'");
733734
return;
734735
}
735736

0 commit comments

Comments
 (0)