Index: lib/Transforms/NaCl/ConvertToPSO.cpp |
diff --git a/lib/Transforms/NaCl/ConvertToPSO.cpp b/lib/Transforms/NaCl/ConvertToPSO.cpp |
index a9663087341d548e4f4e9c81e14a00b291d17d5a..1291a9988d7a45c4b21db51b3ed1008ce53aa91d 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("deps", |
Mark Seaborn
2016/03/29 15:29:39
Remember that this is an option for the 'opt' tool
Sean Klein
2016/03/29 17:58:29
Done.
|
+ 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 (unsigned i = 0; i != LibraryDependencies.size(); ++i) { |
Mark Seaborn
2016/03/29 15:29:39
You can use "for (... : LibrariesDependencies)"
Sean Klein
2016/03/29 17:58:29
Done.
|
+ DependenciesList.append(LibraryDependencies[i]); |
+ 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), |
@@ -676,6 +695,10 @@ bool ConvertToPSO::runOnModule(Module &M) { |
ConstantInt::get(IntPtrType, MaskWords - 1), |
ConstantInt::get(IntPtrType, Shift2), |
createDataArray(M, "bloom_filter", &BloomFilter), |
+ |
+ // Dependencies List |
Mark Seaborn
2016/03/29 15:40:06
When you rebase, this should go at the end, after
Sean Klein
2016/03/29 17:58:29
Do you mean that I should place these fields after
Mark Seaborn
2016/03/29 18:50:44
Yes, that would be better in the sense that it avo
|
+ ConstantInt::get(IntPtrType, LibraryDependencies.size()), |
+ DependenciesListVar, |
}; |
for (auto FieldVal : PsoRootTlsFields) |
PsoRoot.push_back(FieldVal); |