[lld] r335979 - [ELF] - Linker script: add tests for checking malformed numbers parsing.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 29 07:29:44 PDT 2018


Author: grimar
Date: Fri Jun 29 07:29:44 2018
New Revision: 335979

URL: http://llvm.org/viewvc/llvm-project?rev=335979&view=rev
Log:
[ELF] - Linker script: add tests for checking malformed numbers parsing.

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.

Modified:
    lld/trunk/test/ELF/linkerscript/numbers.s

Modified: lld/trunk/test/ELF/linkerscript/numbers.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/numbers.s?rev=335979&r1=335978&r2=335979&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/numbers.s (original)
+++ lld/trunk/test/ELF/linkerscript/numbers.s Fri Jun 29 07:29:44 2018
@@ -43,13 +43,28 @@
 # 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




More information about the llvm-commits mailing list