[ELF2] - Linker script EXTERN command implemented.
The reason of collecting all undefines in vector is that during reading files we already need to have Symtab created. Or like was done in that patch - to put undefines from scripts somewhere to delay Symtab.addUndefinedOpt() call.
Differential Revision: http://reviews.llvm.org/D13870
llvm-svn: 250711
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 2a63be4..1607247 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -43,6 +43,7 @@
void readAsNeeded();
void readEntry();
+ void readExtern();
void readGroup();
void readInclude();
void readOutput();
@@ -63,6 +64,8 @@
continue;
if (Tok == "ENTRY") {
readEntry();
+ } else if (Tok == "EXTERN") {
+ readExtern();
} else if (Tok == "GROUP" || Tok == "INPUT") {
readGroup();
} else if (Tok == "INCLUDE") {
@@ -181,6 +184,16 @@
expect(")");
}
+void LinkerScript::readExtern() {
+ expect("(");
+ for (;;) {
+ StringRef Tok = next();
+ if (Tok == ")")
+ return;
+ Config->Undefined.push_back(Tok);
+ }
+}
+
void LinkerScript::readGroup() {
expect("(");
for (;;) {