[PATCH] D22795: [LinkerScript] Support EXCLUDE_FILE inside KEEP
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 26 17:29:32 PDT 2016
ruiu added inline comments.
================
Comment at: ELF/LinkerScript.cpp:670
@@ -664,4 +669,3 @@
-void ScriptParser::readKeep(OutputSectionCommand *Cmd) {
- expect("(");
+void ScriptParser::readFilePattern(OutputSectionCommand *Cmd) {
expect("*");
----------------
How about changing the return type of the function to `InputSectionDescription *` so that you don't need to pass `OutputSectionCommand *` to this function?
================
Comment at: ELF/LinkerScript.cpp:681
@@ -672,2 +680,3 @@
+ InCmd->ExcludedFiles.push_back(next());
Opt.KeptSections.push_back(peek());
InCmd->Patterns.push_back(next());
----------------
KeptSections shouldn't be updated in this function because this function should be agnostic of the context.
================
Comment at: ELF/LinkerScript.cpp:694
@@ -675,1 +693,3 @@
+ expect("(");
+ readFilePattern(Cmd);
expect(")");
----------------
If you change the return type, then you can write
InputSectionCommand *InCmd = readFilePattern();
Opt.KeptSections.insert(Opt.KeptSections.end(), InCmd.Patterns.begin(), InCmd.Patterns.end());
Cmd.emplace_back(InCmd);
https://reviews.llvm.org/D22795
More information about the llvm-commits
mailing list