mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 22:30:13 +00:00
lld-link: Only print demangled symbol names by default
This makes lld-link's output a bit more concise. Since most developers can't read mangled names, this should make the output a bit easier to understand as well. It also makes lld-link's output consistent with ld.lld's output. (link.exe prints both demangled and mangled names; lld-link used to match link.exe output but now no longer does.) For people working on toolchains, add a `/demangle:no` flag that makes lld-link print the mangled name instead of the demangled name. (If desired, people could pipe that through `demumble -b` to get the old behavior of both demangled and mangled output.) Differential Revision: https://reviews.llvm.org/D58132 llvm-svn: 355878
This commit is contained in:
parent
86af6f5088
commit
020d92cb61
@ -90,6 +90,7 @@ struct Configuration {
|
||||
bool NoEntry = false;
|
||||
std::string OutputFile;
|
||||
std::string ImportName;
|
||||
bool Demangle = true;
|
||||
bool DoGC = true;
|
||||
bool DoICF = true;
|
||||
bool TailMerge;
|
||||
|
@ -1081,6 +1081,9 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
|
||||
Config->Incremental = true;
|
||||
}
|
||||
|
||||
// Handle /demangle
|
||||
Config->Demangle = Args.hasFlag(OPT_demangle, OPT_demangle_no);
|
||||
|
||||
// Handle /debugtype
|
||||
Config->DebugTypes = parseDebugTypes(Args);
|
||||
|
||||
|
@ -154,6 +154,9 @@ def help_q : Flag<["/?", "-?"], "">, Alias<help>;
|
||||
// LLD extensions
|
||||
def exclude_all_symbols : F<"exclude-all-symbols">;
|
||||
def export_all_symbols : F<"export-all-symbols">;
|
||||
defm demangle : B<"demangle",
|
||||
"Demangle symbols in output (default)",
|
||||
"Do not demangle symbols in output">;
|
||||
def kill_at : F<"kill-at">;
|
||||
def lldmingw : F<"lldmingw">;
|
||||
def output_def : Joined<["/", "-"], "output-def:">;
|
||||
@ -178,11 +181,6 @@ def show_timing : F<"time">;
|
||||
|
||||
class QF<string name> : Joined<["/", "-", "-?"], name#":">;
|
||||
|
||||
multiclass QB<string name> {
|
||||
def "" : F<name>;
|
||||
def _no : F<name#":no">;
|
||||
}
|
||||
|
||||
def ignoreidl : F<"ignoreidl">;
|
||||
def nologo : F<"nologo">;
|
||||
def throwingnew : F<"throwingnew">;
|
||||
|
@ -18,10 +18,13 @@
|
||||
using namespace llvm;
|
||||
using namespace llvm::object;
|
||||
|
||||
using namespace lld::coff;
|
||||
|
||||
// Returns a symbol name for an error message.
|
||||
std::string lld::toString(coff::Symbol &B) {
|
||||
if (Optional<std::string> S = lld::demangleMSVC(B.getName()))
|
||||
return ("\"" + *S + "\" (" + B.getName() + ")").str();
|
||||
if (Config->Demangle)
|
||||
if (Optional<std::string> S = lld::demangleMSVC(B.getName()))
|
||||
return *S;
|
||||
return B.getName();
|
||||
}
|
||||
|
||||
|
@ -2,19 +2,19 @@
|
||||
# RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t.obj %s
|
||||
# RUN: not lld-link /out:%t.exe %t.obj 2>&1 | FileCheck %s
|
||||
|
||||
# CHECK: error: undefined symbol: "int __cdecl foo(void)" (?foo@@YAHXZ)
|
||||
# CHECK: error: undefined symbol: int __cdecl foo(void)
|
||||
# CHECK-NEXT: >>> referenced by file1.cpp:1
|
||||
# CHECK-NEXT: >>> {{.*}}.obj:(main)
|
||||
# CHECK-NEXT: >>> referenced by file1.cpp:2
|
||||
# CHECK-NEXT: >>> {{.*}}.obj:(main)
|
||||
# CHECK-EMPTY:
|
||||
# CHECK-NEXT: error: undefined symbol: "int __cdecl bar(void)" (?bar@@YAHXZ)
|
||||
# CHECK-NEXT: error: undefined symbol: int __cdecl bar(void)
|
||||
# CHECK-NEXT: >>> referenced by file2.cpp:3
|
||||
# CHECK-NEXT: >>> {{.*}}.obj:(main)
|
||||
# CHECK-NEXT: >>> referenced by file1.cpp:4
|
||||
# CHECK-NEXT: >>> {{.*}}.obj:(f1)
|
||||
# CHECK-EMPTY:
|
||||
# CHECK-NEXT: error: undefined symbol: "int __cdecl baz(void)" (?baz@@YAHXZ)
|
||||
# CHECK-NEXT: error: undefined symbol: int __cdecl baz(void)
|
||||
# CHECK-NEXT: >>> referenced by file1.cpp:5
|
||||
# CHECK-NEXT: >>> {{.*}}.obj:(f2)
|
||||
|
||||
|
@ -1,16 +1,22 @@
|
||||
# REQUIRES: x86
|
||||
# RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t.obj %s
|
||||
# RUN: not lld-link /out:%t.exe %t.obj 2>&1 | FileCheck %s
|
||||
# RUN: not lld-link /out:%t.exe /demangle %t.obj 2>&1 | FileCheck %s
|
||||
# RUN: not lld-link /out:%t.exe /demangle:no %t.obj 2>&1 | FileCheck --check-prefix=NODEMANGLE %s
|
||||
|
||||
# CHECK: error: undefined symbol: "int __cdecl foo(void)" (?foo@@YAHXZ)
|
||||
# NODEMANGLE: error: undefined symbol: ?foo@@YAHXZ
|
||||
# NODEMANGLE: error: undefined symbol: ?bar@@YAHXZ
|
||||
# NODEMANGLE: error: undefined symbol: __imp_?baz@@YAHXZ
|
||||
|
||||
# CHECK: error: undefined symbol: int __cdecl foo(void)
|
||||
# CHECK-NEXT: >>> referenced by {{.*}}.obj:(main)
|
||||
# CHECK-NEXT: >>> referenced by {{.*}}.obj:(main)
|
||||
# CHECK-EMPTY:
|
||||
# CHECK-NEXT: error: undefined symbol: "int __cdecl bar(void)" (?bar@@YAHXZ)
|
||||
# CHECK-NEXT: error: undefined symbol: int __cdecl bar(void)
|
||||
# CHECK-NEXT: >>> referenced by {{.*}}.obj:(main)
|
||||
# CHECK-NEXT: >>> referenced by {{.*}}.obj:(f1)
|
||||
# CHECK-EMPTY:
|
||||
# CHECK-NEXT: error: undefined symbol: "__declspec(dllimport) int __cdecl baz(void)" (__imp_?baz@@YAHXZ)
|
||||
# CHECK-NEXT: error: undefined symbol: __declspec(dllimport) int __cdecl baz(void)
|
||||
# CHECK-NEXT: >>> referenced by {{.*}}.obj:(f2)
|
||||
|
||||
.section .text,"xr",one_only,main
|
||||
|
Loading…
Reference in New Issue
Block a user