[lld] 3142fc3 - [lld-macho] Have toString() emit full path to archive files
Jez Ng via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 13 07:44:18 PDT 2021
Author: Jez Ng
Date: 2021-04-13T10:43:28-04:00
New Revision: 3142fc3b5bba78663b7579a401683b0cda90243f
URL: https://github.com/llvm/llvm-project/commit/3142fc3b5bba78663b7579a401683b0cda90243f
DIFF: https://github.com/llvm/llvm-project/commit/3142fc3b5bba78663b7579a401683b0cda90243f.diff
LOG: [lld-macho] Have toString() emit full path to archive files
It doesn't make sense to take just the base filename for archives when we emit
the full path for object files. (LLD-ELF emits the full path too.)
This will also make it easier to write a proper test for {D100147}.
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D100357
Added:
Modified:
lld/MachO/InputFiles.cpp
lld/test/MachO/invalid/undefined-symbol.s
lld/test/MachO/u.s
lld/test/MachO/why-load.s
Removed:
################################################################################
diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index 8e554637f9510..e2eb3379dfe01 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -88,9 +88,7 @@ std::string lld::toString(const InputFile *f) {
if (f->archiveName.empty())
return std::string(f->getName());
- return (path::filename(f->archiveName) + "(" + path::filename(f->getName()) +
- ")")
- .str();
+ return (f->archiveName + "(" + path::filename(f->getName()) + ")").str();
}
SetVector<InputFile *> macho::inputFiles;
diff --git a/lld/test/MachO/invalid/undefined-symbol.s b/lld/test/MachO/invalid/undefined-symbol.s
index 7dffe47f68e3a..cb89da052d769 100644
--- a/lld/test/MachO/invalid/undefined-symbol.s
+++ b/lld/test/MachO/invalid/undefined-symbol.s
@@ -7,9 +7,9 @@
# RUN: not %lld -o /dev/null %t/main.o 2>&1 | \
# RUN: FileCheck %s -DSYM=_foo -DFILENAME=%t/main.o
# RUN: not %lld -o /dev/null %t/main.o %t/foo.a 2>&1 | \
-# RUN: FileCheck %s -DSYM=_bar -DFILENAME='foo.a(foo.o)'
+# RUN: FileCheck %s -DSYM=_bar -DFILENAME='%t/foo.a(foo.o)'
# RUN: not %lld -o /dev/null %t/main.o -force_load %t/foo.a 2>&1 | \
-# RUN: FileCheck %s -DSYM=_bar -DFILENAME='foo.a(foo.o)'
+# RUN: FileCheck %s -DSYM=_bar -DFILENAME='%t/foo.a(foo.o)'
# CHECK: error: undefined symbol: [[SYM]]
# CHECK-NEXT: >>> referenced by [[FILENAME]]
diff --git a/lld/test/MachO/u.s b/lld/test/MachO/u.s
index f85a6ddd38f4c..c6fdf3e9f2987 100644
--- a/lld/test/MachO/u.s
+++ b/lld/test/MachO/u.s
@@ -16,8 +16,8 @@
# RUN: not %lld %t/main.o %t/lib.a -u _asdf -o /dev/null 2>&1 | \
# RUN: FileCheck %s --check-prefix=UNDEF
-# NOFOO-NOT: _foo forced load of lib.a(foo.o)
-# FOO: _foo forced load of lib.a(foo.o)
+# NOFOO-NOT: _foo forced load of {{.+}}lib.a(foo.o)
+# FOO: _foo forced load of {{.+}}lib.a(foo.o)
# UNDEF: error: undefined symbol: _asdf
#--- foo.s
diff --git a/lld/test/MachO/why-load.s b/lld/test/MachO/why-load.s
index 34de4fb2f8d41..3dfec24b4b008 100644
--- a/lld/test/MachO/why-load.s
+++ b/lld/test/MachO/why-load.s
@@ -28,37 +28,37 @@
# RUN: %lld %t/main.o -force_load %t/lib.a -o /dev/null -ObjC -all_load -why_load | \
# RUN: FileCheck %s --check-prefix=WHYOBJCALLFORCE
-# WHY-DAG: _bar forced load of lib.a(bar.o)
-# WHY-DAG: __Z3foo forced load of lib.a(foo.o)
-# WHY-NOT: {{.*}} forced load of lib.a(objc.o)
+# WHY-DAG: _bar forced load of {{.+}}lib.a(bar.o)
+# WHY-DAG: __Z3foo forced load of {{.+}}lib.a(foo.o)
+# WHY-NOT: {{.+}} forced load of {{.+}}lib.a(objc.o)
-# WHYFORCE-DAG: -force_load forced load of lib.a(bar.o)
-# WHYFORCE-DAG: -force_load forced load of lib.a(foo.o)
-# WHYFORCE-DAG: -force_load forced load of lib.a(objc.o)
+# WHYFORCE-DAG: -force_load forced load of {{.+}}lib.a(bar.o)
+# WHYFORCE-DAG: -force_load forced load of {{.+}}lib.a(foo.o)
+# WHYFORCE-DAG: -force_load forced load of {{.+}}lib.a(objc.o)
-# WHYALL-DAG: -all_load forced load of lib.a(bar.o)
-# WHYALL-DAG: -all_load forced load of lib.a(foo.o)
-# WHYALL-DAG: -all_load forced load of lib.a(objc.o)
+# WHYALL-DAG: -all_load forced load of {{.+}}lib.a(bar.o)
+# WHYALL-DAG: -all_load forced load of {{.+}}lib.a(foo.o)
+# WHYALL-DAG: -all_load forced load of {{.+}}lib.a(objc.o)
-# WHYALLFORCE-DAG: -force_load forced load of lib.a(bar.o)
-# WHYALLFORCE-DAG: -force_load forced load of lib.a(foo.o)
-# WHYALLFORCE-DAG: -force_load forced load of lib.a(objc.o)
+# WHYALLFORCE-DAG: -force_load forced load of {{.+}}lib.a(bar.o)
+# WHYALLFORCE-DAG: -force_load forced load of {{.+}}lib.a(foo.o)
+# WHYALLFORCE-DAG: -force_load forced load of {{.+}}lib.a(objc.o)
-# WHYOBJC-DAG: _bar forced load of lib.a(bar.o)
-# WHYOBJC-DAG: __Z3foo forced load of lib.a(foo.o)
-# WHYOBJC-DAG: -ObjC forced load of lib.a(objc.o)
+# WHYOBJC-DAG: _bar forced load of {{.+}}lib.a(bar.o)
+# WHYOBJC-DAG: __Z3foo forced load of {{.+}}lib.a(foo.o)
+# WHYOBJC-DAG: -ObjC forced load of {{.+}}lib.a(objc.o)
-# WHYOBJCFORCE-DAG: -force_load forced load of lib.a(bar.o)
-# WHYOBJCFORCE-DAG: -force_load forced load of lib.a(foo.o)
-# WHYOBJCFORCE-DAG: -force_load forced load of lib.a(objc.o)
+# WHYOBJCFORCE-DAG: -force_load forced load of {{.+}}lib.a(bar.o)
+# WHYOBJCFORCE-DAG: -force_load forced load of {{.+}}lib.a(foo.o)
+# WHYOBJCFORCE-DAG: -force_load forced load of {{.+}}lib.a(objc.o)
-# WHYOBJCALL-DAG: -all_load forced load of lib.a(bar.o)
-# WHYOBJCALL-DAG: -all_load forced load of lib.a(foo.o)
-# WHYOBJCALL-DAG: -all_load forced load of lib.a(objc.o)
+# WHYOBJCALL-DAG: -all_load forced load of {{.+}}lib.a(bar.o)
+# WHYOBJCALL-DAG: -all_load forced load of {{.+}}lib.a(foo.o)
+# WHYOBJCALL-DAG: -all_load forced load of {{.+}}lib.a(objc.o)
-# WHYOBJCALLFORCE-DAG: -force_load forced load of lib.a(bar.o)
-# WHYOBJCALLFORCE-DAG: -force_load forced load of lib.a(foo.o)
-# WHYOBJCALLFORCE-DAG: -force_load forced load of lib.a(objc.o)
+# WHYOBJCALLFORCE-DAG: -force_load forced load of {{.+}}lib.a(bar.o)
+# WHYOBJCALLFORCE-DAG: -force_load forced load of {{.+}}lib.a(foo.o)
+# WHYOBJCALLFORCE-DAG: -force_load forced load of {{.+}}lib.a(objc.o)
#--- objc.s
.section __DATA,__objc_catlist
More information about the llvm-commits
mailing list