[PATCH] D128020: [lld-macho] Fix parsing of $ld$ symbols with $ in them
Keith Smiley via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 16 18:08:47 PDT 2022
keith created this revision.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
keith requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Swift symbols have dollar signs in them, so splitting on this
incorrectly resulted in a bunch of symbols just with the name `_` being
considered, and extra info ignored. Currently we don't do anything with
these symbol names besides check that they're non-empty, so this doesn't
impact that, but I believe we need to start handling these:
https://github.com/llvm/llvm-project/issues/56074
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D128020
Files:
lld/MachO/InputFiles.cpp
Index: lld/MachO/InputFiles.cpp
===================================================================
--- lld/MachO/InputFiles.cpp
+++ lld/MachO/InputFiles.cpp
@@ -72,6 +72,7 @@
#include "llvm/TextAPI/Architecture.h"
#include "llvm/TextAPI/InterfaceFile.h"
+#include <cassert>
#include <type_traits>
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128020.437763.patch
Type: text/x-patch
Size: 791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220617/08ce80e8/attachment.bin>
More information about the llvm-commits
mailing list