Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
export named globals
Browse files Browse the repository at this point in the history
  • Loading branch information
kripken committed Apr 26, 2015
1 parent 47c3b75 commit 44e327f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/Target/JSBackend/JSBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2499,14 +2499,20 @@ void JSWriter::processConstants() {
parseConstant(I->getName().str(), I->getInitializer(), false);
}
}
/*if (Relocatable) {
if (Relocatable) {
for (Module::const_global_iterator I = TheModule->global_begin(),
E = TheModule->global_end(); I != E; ++I) {
if (I->hasInitializer() && !I->hasInternalLinkage()) {
Exports.push_back(getJSName(I));
std::string Name = I->getName().str();
if (GlobalAddresses.find(Name) != GlobalAddresses.end()) {
std::string JSName = getJSName(I).substr(1);
if (Name == JSName) { // don't export things that have weird internal names, that C can't dlsym anyhow
NamedGlobals[Name] = getGlobalAddress(Name);
}
}
}
}
}*/
}
}

void JSWriter::printFunction(const Function *F) {
Expand Down Expand Up @@ -2729,7 +2735,7 @@ void JSWriter::printModuleBody() {
} else {
Out << ", ";
}
Out << "\"_" << I->first << "\": \"" << utostr(I->second) << "\"";
Out << "\"" << I->first << "\": \"" << utostr(I->second) << "\"";
}
Out << "},";

Expand Down

0 comments on commit 44e327f

Please sign in to comment.