Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: src/IceGlobalInits.cpp

Issue 667763002: Fix handling of relocation names, so that prefix mangling works. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceGlobalInits.h ('k') | src/IceOperand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceGlobalInits.cpp
diff --git a/src/IceGlobalInits.cpp b/src/IceGlobalInits.cpp
index d9cea260636be785e48cdaacd706e5e6d5d37257..aaebddf1ba5be0ad8ce5fdbe90572d4a52a2eab8 100644
--- a/src/IceGlobalInits.cpp
+++ b/src/IceGlobalInits.cpp
@@ -68,12 +68,13 @@ void FunctionDeclaration::dumpType(Ostream &Stream) const {
Stream << Signature;
}
-void FunctionDeclaration::dump(Ostream &Stream) const {
+void FunctionDeclaration::dump(GlobalContext *Ctx, Ostream &Stream) const {
if (IsProto)
Stream << "declare ";
::dumpLinkage(Stream, Linkage);
::dumpCallingConv(Stream, CallingConv);
- Stream << Signature.getReturnType() << " @" << Name << "(";
+ Stream << Signature.getReturnType() << " @"
+ << (Ctx ? Ctx->mangleName(Name) : Name) << "(";
bool IsFirst = true;
for (Type ArgTy : Signature.getArgList()) {
if (IsFirst)
@@ -111,9 +112,11 @@ void VariableDeclaration::dumpType(Ostream &Stream) const {
}
}
-void VariableDeclaration::dump(Ostream &Stream) const {
- Stream << "@" << Name << " = internal "
- << (IsConstant ? "constant" : "global") << " ";
+void VariableDeclaration::dump(GlobalContext *Ctx, Ostream &Stream) const {
+ Stream << "@" << ((Ctx && !getSuppressMangling())
+ ? Ctx->mangleName(Name) : Name) << " = ";
+ ::dumpLinkage(Stream, Linkage);
+ Stream << " " << (IsConstant ? "constant" : "global") << " ";
// Add initializer.
if (Initializers.size() == 1) {
@@ -128,7 +131,7 @@ void VariableDeclaration::dump(Ostream &Stream) const {
} else {
Stream << ", ";
}
- Init->dump(Stream);
+ Init->dump(Ctx, Stream);
}
Stream << " }>";
}
@@ -143,7 +146,8 @@ void VariableDeclaration::Initializer::dumpType(Ostream &Stream) const {
Stream << "[" << getNumBytes() << " x " << Ice::IceType_i8 << "]";
}
-void VariableDeclaration::DataInitializer::dump(Ostream &Stream) const {
+void VariableDeclaration::DataInitializer::dump(
+ GlobalContext *, Ostream &Stream) const {
dumpType(Stream);
Stream << " c\"";
// Code taken from PrintEscapedString() in AsmWriter.cpp. Keep
@@ -158,7 +162,8 @@ void VariableDeclaration::DataInitializer::dump(Ostream &Stream) const {
Stream << "\"";
}
-void VariableDeclaration::ZeroInitializer::dump(Ostream &Stream) const {
+void VariableDeclaration::ZeroInitializer::dump(
+ GlobalContext *, Ostream &Stream) const {
dumpType(Stream);
Stream << " zeroinitializer";
}
@@ -167,7 +172,8 @@ void VariableDeclaration::RelocInitializer::dumpType(Ostream &Stream) const {
Stream << Ice::IceType_i32;
}
-void VariableDeclaration::RelocInitializer::dump(Ostream &Stream) const {
+void VariableDeclaration::RelocInitializer::dump(
+ GlobalContext *Ctx, Ostream &Stream) const {
if (Offset != 0) {
dumpType(Stream);
Stream << " add (";
@@ -175,7 +181,12 @@ void VariableDeclaration::RelocInitializer::dump(Ostream &Stream) const {
dumpType(Stream);
Stream << " ptrtoint (";
Declaration->dumpType(Stream);
- Stream << "* @" << Declaration->getName() << " to ";
+ Stream << "* @";
+ if (Ctx)
+ Stream << Ctx->mangleName(Declaration->getName());
+ else
+ Stream << Declaration->getName();
+ Stream << " to ";
dumpType(Stream);
Stream << ")";
if (Offset != 0) {
« no previous file with comments | « src/IceGlobalInits.h ('k') | src/IceOperand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698