1
1
mirror of https://github.com/rui314/mold.git synced 2024-11-11 05:46:58 +03:00
mold/symbols.cc

21 lines
417 B
C++
Raw Normal View History

2021-02-27 06:16:51 +03:00
#include "mold.h"
#include <cxxabi.h>
#include <stdlib.h>
std::ostream &operator<<(std::ostream &out, const Symbol &sym) {
if (config.demangle) {
int status;
char *name = abi::__cxa_demangle(std::string(sym.name).c_str(),
nullptr, 0, &status);
if (status == 0) {
out << name;
free(name);
return out;
}
}
out << sym.name;
return out;
}