[PATCH] D22795: [LinkerScript] Support EXCLUDE_FILE inside KEEP
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 25 19:33:57 PDT 2016
ruiu added inline comments.
================
Comment at: ELF/LinkerScript.cpp:82
@@ -81,3 +81,3 @@
template <class ELFT>
-std::vector<std::pair<StringRef, ArrayRef<StringRef>>>
+std::vector<std::tuple<StringRef, ArrayRef<StringRef>, ArrayRef<StringRef>>>
LinkerScript<ELFT>::getSectionMap() {
----------------
Maybe we should return `std::vector<std::pair<StringRef, InputSectionDescription *>>` instead.
================
Comment at: ELF/LinkerScript.cpp:99-100
@@ -97,3 +98,4 @@
std::vector<InputSectionBase<ELFT> *>
-LinkerScript<ELFT>::getInputSections(ArrayRef<StringRef> Patterns) {
+LinkerScript<ELFT>::getInputSections(ArrayRef<StringRef> Patterns,
+ ArrayRef<StringRef> ExcludedFiles) {
std::vector<InputSectionBase<ELFT> *> Ret;
----------------
I'd pass `InputSectionDescription *` instead.
================
Comment at: ELF/LinkerScript.cpp:686
@@ -679,3 +685,3 @@
void ScriptParser::readKeep(OutputSectionCommand *Cmd) {
expect("(");
----------------
The grammar of KEEP is
KEEP := "KEEP" "(" FILE_PATTERN ")"
FILE_PATTERN := GLOB+ "(" "EXCLUDE_FILE" "(" GLOB+ ")" GLOB+ ")"
| GLOB+ "(" GLOB+ ")" GLOB+ ")"
where GLOB is any glob pattern. FILE_PATTERN is the same as one of the SECTIONS subcommands.
So I think you want to define readFilePattern and use it both from this function and from readOutputSectionDescription.
================
Comment at: ELF/LinkerScript.cpp:694-695
@@ +693,4 @@
+
+ if (peek() == "EXCLUDE_FILE") {
+ next();
+ expect("(");
----------------
if (skip("EXCLUDE_FILE")) {
https://reviews.llvm.org/D22795
More information about the llvm-commits
mailing list