[ELF] - Linker script: add tests for checking malformed numbers parsing.
authorGeorge Rimar <grimar@accesssoftek.com>
Fri, 29 Jun 2018 14:29:44 +0000 (14:29 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Fri, 29 Jun 2018 14:29:44 +0000 (14:29 +0000)
Previoulsy we had no test that covered malfolmed numbers
with 'H', 'K' and 'M' suffixes, so the following lines
were uncovered:

https://github.com/llvm-mirror/lld/blob/master/ELF/ScriptParser.cpp#L996
https://github.com/llvm-mirror/lld/blob/master/ELF/ScriptParser.cpp#L1003
https://github.com/llvm-mirror/lld/blob/master/ELF/ScriptParser.cpp#L1008

Patch fixes that.

llvm-svn: 335979

lld/test/ELF/linkerscript/numbers.s

index d4fd13f..54a189a 100644 (file)
 # RUN:  FileCheck --check-prefix=ERR3 %s
 # ERR3: malformed number: 0x11m
 
+# RUN: echo "SECTIONS { . = 1zh; }" > %t5.script
+# RUN: not ld.lld %t --script %t5.script -o %t5 2>&1 | \
+# RUN:  FileCheck --check-prefix=ERR4 %s
+# ERR4: malformed number: 1zh
+
+# RUN: echo "SECTIONS { . = 1zk; }" > %t6.script
+# RUN: not ld.lld %t --script %t6.script -o %t6 2>&1 | \
+# RUN:  FileCheck --check-prefix=ERR5 %s
+# ERR5: malformed number: 1zk
+
+# RUN: echo "SECTIONS { . = 1zm; }" > %t7.script
+# RUN: not ld.lld %t --script %t7.script -o %t7 2>&1 | \
+# RUN:  FileCheck --check-prefix=ERR6 %s
+# ERR6: malformed number: 1zm
+
 ## Make sure that numbers can be followed by a ":" with and without a space,
 ## e.g. "0x100 :" or "0x100:"
 # RUN: echo "SECTIONS { \
 # RUN:  .hex1 0x400 : { *(.hex.1) } \
 # RUN:  .hex2 0x500:{ *(.hex.2) } \
-# RUN: }" > %t5.script
-# RUN: ld.lld %t --script %t5.script -o %t6
+# RUN: }" > %t8.script
+# RUN: ld.lld %t --script %t8.script -o %t6
 # RUN: llvm-objdump -section-headers %t6 | FileCheck -check-prefix=SECADDR %s
 # SECADDR:     Sections:
 # SECADDR-NEXT: Idx Name          Size      Address