Skip to content

Commit

Permalink
[gh-198] Internalise variables when using LTO.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhrr committed Oct 6, 2018
1 parent 59f9d6e commit 2837f54
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/dale/Generator/Generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,14 @@ int Generator::run(std::vector<const char *> *file_paths,
b->setLinkage(ctx->toLLVMLinkage(Linkage::Intern));
}
}
for (llvm::Module::global_iterator b = mod->global_begin(),
e = mod->global_end();
b != e;
++b) {
if (b->hasInitializer()) {
b->setLinkage(ctx->toLLVMLinkage(Linkage::Intern));
}
}
llvm::Function *main = mod->getFunction("main");
main->setLinkage(ctx->toLLVMLinkage(Linkage::Extern_C));
}
Expand Down

0 comments on commit 2837f54

Please sign in to comment.