[PATCH] D99023: [lld-macho][wip] Make stabs.s work on Windows

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 16 08:02:08 PDT 2021


int3 added a comment.

> Something weird seems to be happening with the escaping of slashes on the Windows command line

I think that's actually a red herring, it's just an artifact of how `llvm-lit` is printing out stuff. The reason the paths don't match is that lib/Object/Archive.h isn't using the host path separators, so we end up with a mixture of "/" and "\" on Windows. Didn't get around to pinpointing the exact function responsible though.



================
Comment at: lld/MachO/SyntheticSections.cpp:632
   // 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("/"))
----------------
thakis wrote:
> Hm, it assumes that the source was compiled with a mach-o triple. Clang hopefully uses slashes when targeting mach-o even on Windows -- if not, that's a bug, right? The host machine shouldn't leak into the target machine. And assuming mach-o slashiness in a mach-o linker seems sensible. So this change here looks good to me, just the FIXME doesn't.
I guess it depends if we think the main use case after for linking Mach-O on Windows is to do remote debugging or to copy all the files (source and all) to the target machine. I think remote debugging is more likely, in which case the change here is probably wrong...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99023/new/

https://reviews.llvm.org/D99023



More information about the llvm-commits mailing list