diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 310392c3c18a..e81c6854bdea 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -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; }; } diff --git a/lld/test/ELF/linkerscript/segment-start.s b/lld/test/ELF/linkerscript/segment-start.s index 2f3245fc21a8..fb00ef13a2ce 100644 --- a/lld/test/ELF/linkerscript/segment-start.s +++ b/lld/test/ELF/linkerscript/segment-start.s @@ -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