[llvm] 5900014 - [dsymutil] Improve missing symbol warning message (#75378)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 13 15:47:58 PST 2023
Author: Jonas Devlieghere
Date: 2023-12-13T15:47:54-08:00
New Revision: 590001431b44ec4f3209db5a4d50cc8ebc959a93
URL: https://github.com/llvm/llvm-project/commit/590001431b44ec4f3209db5a4d50cc8ebc959a93
DIFF: https://github.com/llvm/llvm-project/commit/590001431b44ec4f3209db5a4d50cc8ebc959a93.diff
LOG: [dsymutil] Improve missing symbol warning message (#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
Added:
llvm/test/tools/dsymutil/ARM/missing-symbol-warning.test
llvm/test/tools/dsymutil/Inputs/private/tmp/warning/test.o
llvm/test/tools/dsymutil/Inputs/private/tmp/warning/test.out
Modified:
llvm/test/tools/dsymutil/ARM/extern-alias.test
llvm/test/tools/dsymutil/ARM/static-archive-collision.test
llvm/test/tools/dsymutil/X86/alias.test
llvm/test/tools/dsymutil/X86/thinlto.test
llvm/tools/dsymutil/MachODebugMapParser.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/dsymutil/ARM/extern-alias.test b/llvm/test/tools/dsymutil/ARM/extern-alias.test
index f8b59584d2b465..58a1c6a738257f 100644
--- a/llvm/test/tools/dsymutil/ARM/extern-alias.test
+++ b/llvm/test/tools/dsymutil/ARM/extern-alias.test
@@ -41,6 +41,6 @@ RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/extern/ext
RUN: dsymutil --linker llvm -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/private_extern/private_extern.out -o %t.dSYM --verbose | FileCheck %s
RUN: dsymutil --linker llvm -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/extern/extern.out -o %t.dSYM --verbose | FileCheck %s
-CHECK-NOT: could not find object file symbol for symbol _baz
+CHECK-NOT: could not find symbol '_baz'
CHECK: { sym: _baz, objAddr: 0x0, binAddr: 0x100007F58, size: 0x0 }
CHECK: { sym: _foo, objAddr: 0x0, binAddr: 0x100007F58, size: 0x20 }
diff --git a/llvm/test/tools/dsymutil/ARM/missing-symbol-warning.test b/llvm/test/tools/dsymutil/ARM/missing-symbol-warning.test
new file mode 100644
index 00000000000000..1de805d3219537
--- /dev/null
+++ b/llvm/test/tools/dsymutil/ARM/missing-symbol-warning.test
@@ -0,0 +1,3 @@
+RUN: dsymutil -oso-prepend-path %p/../Inputs --dump-debug-map %p/../Inputs/private/tmp/warning/test.out 2>&1 | FileCheck %s
+# CHECK: could not find symbol '_foo' in object file '{{.*}}test.o'
+# CHECK: { sym: _main, objAddr: 0x0, binAddr: 0x100003F84, size: 0x1C }
diff --git a/llvm/test/tools/dsymutil/ARM/static-archive-collision.test b/llvm/test/tools/dsymutil/ARM/static-archive-collision.test
index 7182f0917d897f..55fd5e6b621e76 100644
--- a/llvm/test/tools/dsymutil/ARM/static-archive-collision.test
+++ b/llvm/test/tools/dsymutil/ARM/static-archive-collision.test
@@ -22,5 +22,5 @@ $ clang main.o foo.a -o main.out
RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/collision/main.out --dump-debug-map 2>&1 | FileCheck %s
CHECK: skipping debug map object with duplicate name and timestamp: {{.*}} /private/tmp/collision/foo.a(foo.o)
-CHECK-NOT: could not find object file symbol for symbol _g
-CHECK-NOT: could not find object file symbol for symbol _f
+CHECK-NOT: could not find symbol '_g'
+CHECK-NOT: could not find symbol '_f'
diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/warning/test.o b/llvm/test/tools/dsymutil/Inputs/private/tmp/warning/test.o
new file mode 100644
index 00000000000000..53647992d70c97
Binary files /dev/null and b/llvm/test/tools/dsymutil/Inputs/private/tmp/warning/test.o
diff er
diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/warning/test.out b/llvm/test/tools/dsymutil/Inputs/private/tmp/warning/test.out
new file mode 100755
index 00000000000000..bfd5c74f4a1ddc
Binary files /dev/null and b/llvm/test/tools/dsymutil/Inputs/private/tmp/warning/test.out
diff er
diff --git a/llvm/test/tools/dsymutil/X86/alias.test b/llvm/test/tools/dsymutil/X86/alias.test
index 4c1e8168706098..65e9bf22640a8a 100644
--- a/llvm/test/tools/dsymutil/X86/alias.test
+++ b/llvm/test/tools/dsymutil/X86/alias.test
@@ -4,7 +4,7 @@
# RUN: dsymutil --linker llvm -f -oso-prepend-path=%p/../Inputs/alias \
# RUN: %p/../Inputs/alias/foobar -o - | llvm-dwarfdump - 2>&1 | FileCheck %s
-# CHECK-NOT: could not find object file symbol for symbol
+# CHECK-NOT: could not find symbol
# CHECK: DW_AT_name ("foo.c")
# CHECK: DW_AT_name ("bar.c")
diff --git a/llvm/test/tools/dsymutil/X86/thinlto.test b/llvm/test/tools/dsymutil/X86/thinlto.test
index 2d2195805f3aab..d76bfb17e7d527 100644
--- a/llvm/test/tools/dsymutil/X86/thinlto.test
+++ b/llvm/test/tools/dsymutil/X86/thinlto.test
@@ -23,5 +23,5 @@ RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/thinlto/fo
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
-CHECK-NOT: could not find object file symbol for symbol __ZZ9function2vE12magic_static
-CHECK-NOT: could not find object file symbol for symbol __ZGVZ9function2vE12magic_static
+CHECK-NOT: could not find symbol '__ZZ9function2vE12magic_static'
+CHECK-NOT: could not find symbol 'symbol __ZGVZ9function2vE12magic_static'
diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp b/llvm/tools/dsymutil/MachODebugMapParser.cpp
index 7a32eacee14c1b..524a6795c360e9 100644
--- a/llvm/tools/dsymutil/MachODebugMapParser.cpp
+++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp
@@ -729,7 +729,8 @@ void MachODebugMapParser::handleStabSymbolTableEntry(
}
if (ObjectSymIt == CurrentObjectAddresses.end()) {
- Warning("could not find object file symbol for symbol " + Twine(Name));
+ Warning("could not find symbol '" + Twine(Name) + "' in object file '" +
+ CurrentDebugMapObject->getObjectFilename() + "'");
return;
}
More information about the llvm-commits
mailing list