Skip to content

Commit dbd65a0

Browse files
committed
[ELF] OUTPUT_ARCH: report unclosed error
1 parent 74f843d commit dbd65a0

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

lld/ELF/ScriptParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ void ScriptParser::readOutput() {
444444
void ScriptParser::readOutputArch() {
445445
// OUTPUT_ARCH is ignored for now.
446446
expect("(");
447-
while (next() != ")" && !atEOF())
447+
while (till(")"))
448448
;
449449
}
450450

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# REQUIRES: x86
2-
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd /dev/null -o %t1
3-
# RUN: ld.lld -shared -o %t2 %t1 %s
2+
# RUN: rm -rf %t && split-file %s %t && cd %t
3+
# RUN: llvm-mc -filetype=obj -triple=x86_64 /dev/null -o a.o
4+
# RUN: ld.lld -shared -T 1.lds a.o
45

6+
#--- 1.lds
57
OUTPUT_ARCH(All data written here is ignored)
8+
9+
#--- unclosed.lds
10+
OUTPUT_ARCH(All
11+
12+
# RUN: not ld.lld -shared -T unclosed.lds a.o 2>&1 | FileCheck %s --check-prefix=UNCLOSED
13+
# UNCLOSED: error: unclosed.lds:1: unexpected EOF

0 commit comments

Comments
 (0)