[lld] r281608 - Check the return of getInteger.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 15 06:36:45 PDT 2016
Author: rafael
Date: Thu Sep 15 08:36:44 2016
New Revision: 281608
URL: http://llvm.org/viewvc/llvm-project?rev=281608&view=rev
Log:
Check the return of getInteger.
Modified:
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/test/ELF/linkerscript/segment-start.s
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=281608&r1=281607&r2=281608&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Thu Sep 15 08:36:44 2016
@@ -1307,7 +1307,8 @@ Expr ScriptParser::readPrimary() {
next();
expect(",");
uint64_t Val;
- next().getAsInteger(0, Val);
+ if (next().getAsInteger(0, Val))
+ setError("integer expected");
expect(")");
return [=](uint64_t Dot) { return Val; };
}
Modified: lld/trunk/test/ELF/linkerscript/segment-start.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/segment-start.s?rev=281608&r1=281607&r2=281608&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/segment-start.s (original)
+++ lld/trunk/test/ELF/linkerscript/segment-start.s Thu Sep 15 08:36:44 2016
@@ -20,3 +20,8 @@
.quad foobar2
.quad foobar3
.quad foobar4
+
+// RUN: echo "SECTIONS { . = SEGMENT_START(\"foobar\", foo); }" > %t.script
+// RUN: not ld.lld %t.o %t.script -shared -o %t2.so 2>&1 \
+// RUN: | FileCheck --check-prefix=ERR %s
+// ERR: integer expected
More information about the llvm-commits
mailing list