Skip to content

Commit 2c7e2af

Browse files
committed
Fix logic in rare case current_path fails to expand
1 parent a60fdf7 commit 2c7e2af

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lld/MachO/Driver.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,14 +1640,12 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
16401640
// path. Hence we've picked a reasonably large number here.
16411641
SmallString<1024> expanded;
16421642
// Expand "." into the current working directory.
1643-
if (config->osoPrefix == ".") {
1644-
if (!fs::current_path(expanded)) {
1645-
// Note: LD64 expands "." to be `<current_dir>/
1646-
// (ie., it has a slash suffix) whereas current_path() doesn't.
1647-
// So we have to append '/' to be consistent because this is
1648-
// meaningful for our text based stripping.
1649-
expanded += sys::path::get_separator();
1650-
}
1643+
if (config->osoPrefix == "." && !fs::current_path(expanded)) {
1644+
// Note: LD64 expands "." to be `<current_dir>/
1645+
// (ie., it has a slash suffix) whereas current_path() doesn't.
1646+
// So we have to append '/' to be consistent because this is
1647+
// meaningful for our text based stripping.
1648+
expanded += sys::path::get_separator();
16511649
} else {
16521650
expanded = config->osoPrefix;
16531651
}

0 commit comments

Comments
 (0)