Skip to content

Commit

Permalink
[Mach-O] Demangle symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
rui314 committed May 21, 2022
1 parent 0b6fa20 commit 192efa1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions macho/mold.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -956,7 +956,10 @@ inline Symbol<E> *get_symbol(Context<E> &ctx, std::string_view name) {

template <typename E>
inline std::ostream &operator<<(std::ostream &out, const Symbol<E> &sym) {
out << sym.name;
if (opt_demangle && sym.name.starts_with("__Z"))
out << demangle(sym.name.substr(1));
else
out << sym.name;
return out;
}

Expand Down

0 comments on commit 192efa1

Please sign in to comment.