summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-06-25 21:06:00 +0000
committerRui Ueyama <ruiu@google.com>2015-06-25 21:06:00 +0000
commit5817ebb0c8bb120f4f440927af815e80ec87ffe9 (patch)
treefac8579d7e8a1313fd9f3b5f2274a30bb94c10b3
parent5b74593e1652452a39612811f15a2a4fd58185e7 (diff)
downloadbcm5719-llvm-5817ebb0c8bb120f4f440927af815e80ec87ffe9.tar.gz
bcm5719-llvm-5817ebb0c8bb120f4f440927af815e80ec87ffe9.zip
COFF: Fix lexer for the module-definition file.
Previously it would hang if there's a stray punctuation (e.g. ?). llvm-svn: 240697
-rw-r--r--lld/COFF/ModuleDef.cpp4
-rw-r--r--lld/test/COFF/defparser.test13
2 files changed, 14 insertions, 3 deletions
diff --git a/lld/COFF/ModuleDef.cpp b/lld/COFF/ModuleDef.cpp
index 8c195195fb2..c7bc2b2bf14 100644
--- a/lld/COFF/ModuleDef.cpp
+++ b/lld/COFF/ModuleDef.cpp
@@ -82,9 +82,7 @@ public:
return Token(Identifier, S);
}
default: {
- size_t End = Buf.find_first_not_of(
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789_.*~+!@#$%^&*()/");
+ size_t End = Buf.find_first_of("=,\r\n \t\v");
StringRef Word = Buf.substr(0, End);
Kind K = llvm::StringSwitch<Kind>(Word)
.Case("BASE", KwBase)
diff --git a/lld/test/COFF/defparser.test b/lld/test/COFF/defparser.test
new file mode 100644
index 00000000000..a9648392e93
--- /dev/null
+++ b/lld/test/COFF/defparser.test
@@ -0,0 +1,13 @@
+# RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj
+
+# RUN: echo -e "LIBRARY foo\nEXPORTS ? @" > %t.def
+# RUN: not lld -flavor link2 /def:%t.def %t.obj
+
+# RUN: echo -e "LIBRARY foo\nHEAP abc" > %t.def
+# RUN: not lld -flavor link2 /def:%t.def %t.obj
+
+# RUN: echo -e "LIBRARY foo\nSTACK abc" > %t.def
+# RUN: not lld -flavor link2 /def:%t.def %t.obj
+
+# RUN: echo -e "foo" > %t.def
+# RUN: not lld -flavor link2 /def:%t.def %t.obj
OpenPOWER on IntegriCloud