diff --git a/macho/mold.h b/macho/mold.h index e9328658f0..63944afe73 100644 --- a/macho/mold.h +++ b/macho/mold.h @@ -811,7 +811,7 @@ struct Context { bool dead_strip = false; bool dead_strip_dylibs = false; bool deduplicate = true; - bool demangle = false; + bool demangle = true; bool dylib = false; bool dynamic = true; bool export_dynamic = false; @@ -956,7 +956,10 @@ inline Symbol *get_symbol(Context &ctx, std::string_view name) { template inline std::ostream &operator<<(std::ostream &out, const Symbol &sym) { - out << sym.name; + if (opt_demangle && sym.name.starts_with("__Z")) + out << demangle(sym.name.substr(1)); + else + out << sym.name; return out; }