diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp --- a/lld/MachO/InputFiles.cpp +++ b/lld/MachO/InputFiles.cpp @@ -72,6 +72,7 @@ #include "llvm/TextAPI/Architecture.h" #include "llvm/TextAPI/InterfaceFile.h" +#include #include using namespace llvm; @@ -1750,7 +1751,8 @@ std::tie(platformStr, name) = name.split('$'); std::tie(startVersion, name) = name.split('$'); std::tie(endVersion, name) = name.split('$'); - std::tie(symbolName, rest) = name.split('$'); + std::tie(symbolName, rest) = name.rsplit('$'); + assert(rest.empty() && "$ld$ previous symbol has unexpected extra content"); // TODO: ld64 contains some logic for non-empty symbolName as well. if (!symbolName.empty()) return;