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

Unified Diff: lib/Transforms/NaCl/ConvertToPSO.cpp

Issue 1829793002: PNaCl Dynamic Linking: Storing dependencies from command line in PLL. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Added convert-to-pso.ll test, responded to code review Created 4 years, 9 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 | « no previous file | test/Transforms/NaCl/convert-to-pso.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Transforms/NaCl/ConvertToPSO.cpp
diff --git a/lib/Transforms/NaCl/ConvertToPSO.cpp b/lib/Transforms/NaCl/ConvertToPSO.cpp
index a9663087341d548e4f4e9c81e14a00b291d17d5a..fdf011c474a69c616bd6f9665a93509256daf209 100644
--- a/lib/Transforms/NaCl/ConvertToPSO.cpp
+++ b/lib/Transforms/NaCl/ConvertToPSO.cpp
@@ -62,6 +62,13 @@ namespace {
// increment TOOLCHAIN_FEATURE_VERSION instead.
const int PSOFormatVersion = 2;
+ // Command line arguments consist of a list of PLL dependencies.
+ static cl::list<std::string>
+ LibraryDependencies("convert-to-pso-deps",
+ cl::CommaSeparated,
+ cl::desc("The dependencies of the PLL being built"),
+ cl::value_desc("PLL to list as dependency"));
+
// This is a ModulePass because it inherently operates on a whole module.
class ConvertToPSO : public ModulePass {
public:
@@ -651,6 +658,18 @@ bool ConvertToPSO::runOnModule(Module &M) {
M, StringTableArray->getType(), true, GlobalValue::InternalLinkage,
StringTableArray, "string_table");
+ // Set up string of PLL dependencies.
+ SmallString<1024> DependenciesList;
+ for (auto dependency : LibraryDependencies) {
+ DependenciesList.append(dependency);
+ DependenciesList.push_back(0);
+ }
+ Constant *DependenciesListArray = ConstantDataArray::getString(
+ C, StringRef(DependenciesList.data(), DependenciesList.size()), false);
+ Constant *DependenciesListVar = new GlobalVariable(
+ M, DependenciesListArray->getType(), true, GlobalValue::InternalLinkage,
+ DependenciesListArray, "dependencies_list");
+
SmallVector<Constant *, 32> PsoRoot = {
ConstantInt::get(IntPtrType, PSOFormatVersion),
@@ -679,6 +698,11 @@ bool ConvertToPSO::runOnModule(Module &M) {
};
for (auto FieldVal : PsoRootTlsFields)
PsoRoot.push_back(FieldVal);
+
+ // Dependencies List
+ PsoRoot.push_back(ConstantInt::get(IntPtrType, LibraryDependencies.size()));
+ PsoRoot.push_back(DependenciesListVar);
+
Constant *PsoRootConst = ConstantStruct::getAnon(PsoRoot);
new GlobalVariable(
M, PsoRootConst->getType(), true, GlobalValue::ExternalLinkage,
« no previous file with comments | « no previous file | test/Transforms/NaCl/convert-to-pso.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698