diff options
Diffstat (limited to 'lld/COFF/ModuleDef.cpp')
| -rw-r--r-- | lld/COFF/ModuleDef.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lld/COFF/ModuleDef.cpp b/lld/COFF/ModuleDef.cpp index fab3e4a1852..1ccca01b899 100644 --- a/lld/COFF/ModuleDef.cpp +++ b/lld/COFF/ModuleDef.cpp @@ -54,6 +54,10 @@ struct Token { StringRef Value; }; +static bool isDecorated(StringRef Sym) { + return Sym.startswith("_") || Sym.startswith("@") || Sym.startswith("?"); +} + class Lexer { public: explicit Lexer(StringRef S) : Buf(S) {} @@ -191,8 +195,12 @@ private: unget(); } - if (Config->Machine == I386 && !E.Name.startswith("_@?")) - E.Name = Alloc->save("_" + E.Name); + if (Config->Machine == I386) { + if (!isDecorated(E.Name)) + E.Name = Alloc->save("_" + E.Name); + if (!E.ExtName.empty() && !isDecorated(E.ExtName)) + E.ExtName = Alloc->save("_" + E.ExtName); + } for (;;) { read(); |

