[PATCH] D99023: [lld-macho] Make stabs.s work on Windows
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 20 10:39:15 PDT 2021
int3 created this revision.
Herald added a project: lld-macho.
Herald added a reviewer: lld-macho.
int3 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D99023
Files:
lld/MachO/SyntheticSections.cpp
lld/test/MachO/stabs.s
Index: lld/test/MachO/stabs.s
===================================================================
--- lld/test/MachO/stabs.s
+++ lld/test/MachO/stabs.s
@@ -1,5 +1,4 @@
-# REQUIRES: x86, shell
-# UNSUPPORTED: system-windows
+# REQUIRES: x86
# RUN: rm -rf %t; split-file %s %t
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/foo.s -o %t/foo.o
@@ -10,24 +9,28 @@
# RUN: llvm-ar rcsU %t/foo.a %t/foo.o
# RUN: %lld -lSystem %t/test.o %t/foo.o %t/no-debug.o -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; llvm-nm -pa %t/test) | \
-# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o
+# RUN: llvm-objdump --section-headers %t/test > %t/out
+# RUN: llvm-nm -pa %t/test >> %t/out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o < %t/out
## Check that we emit the right modtime even when the object file is in an
## archive.
# RUN: %lld -lSystem %t/test.o %t/foo.a %t/no-debug.o -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; llvm-nm -pa %t/test) | \
-# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\)
+# RUN: llvm-objdump --section-headers %t/test > %t/out
+# RUN: llvm-nm -pa %t/test >> %t/out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) < %t/out
## Check that we emit absolute paths to the object files in our OSO entries
## even if our inputs are relative paths.
# RUN: cd %t && %lld -lSystem test.o foo.o no-debug.o -o test
-# RUN: (llvm-objdump --section-headers %t/test; llvm-nm -pa %t/test) | \
-# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o
+# RUN: llvm-objdump --section-headers %t/test > %t/out
+# RUN: llvm-nm -pa %t/test >> %t/out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o < %t/out
# RUN: cd %t && %lld -lSystem test.o foo.a no-debug.o -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; llvm-nm -pa %t/test) | \
-# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\)
+# RUN: llvm-objdump --section-headers %t/test > %t/out
+# RUN: llvm-nm -pa %t/test >> %t/out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) < %t/out
# CHECK: Sections:
# CHECK-NEXT: Idx Name
Index: lld/MachO/SyntheticSections.cpp
===================================================================
--- lld/MachO/SyntheticSections.cpp
+++ lld/MachO/SyntheticSections.cpp
@@ -627,11 +627,11 @@
void SymtabSection::emitBeginSourceStab(DWARFUnit *compileUnit) {
StabsEntry stab(N_SO);
SmallString<261> dir(compileUnit->getCompilationDir());
- StringRef sep = sys::path::get_separator();
// We don't use `path::append` here because we want an empty `dir` to result
// in an absolute path. `append` would give us a relative path for that case.
- if (!dir.endswith(sep))
- dir += sep;
+ // FIXME: This assumes that the source was compiled on a POSIX machine.
+ if (!dir.endswith("/"))
+ dir += "/";
stab.strx = stringTableSection.addString(
saver.save(dir + compileUnit->getUnitDIE().getShortName()));
stabs.emplace_back(std::move(stab));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99023.332117.patch
Type: text/x-patch
Size: 3069 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210320/00419809/attachment.bin>
More information about the llvm-commits
mailing list