[PATCH] D64476: [LLD][ELF] - Linkerscript: Fix FILL() expressions handling.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 10 07:37:29 PDT 2019
This revision was automatically updated to reflect the committed changes.
grimar marked an inline comment as done.
Closed by commit rL365635: [LLD][ELF] - Linkerscript: fix FILL() expressions handling. (authored by grimar, committed by ).
Herald added a project: LLVM.
Changed prior to commit:
https://reviews.llvm.org/D64476?vs=208922&id=208960#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64476/new/
https://reviews.llvm.org/D64476
Files:
lld/trunk/ELF/ScriptParser.cpp
lld/trunk/test/ELF/linkerscript/fill.test
lld/trunk/test/ELF/linkerscript/sections-padding.s
Index: lld/trunk/ELF/ScriptParser.cpp
===================================================================
--- lld/trunk/ELF/ScriptParser.cpp
+++ lld/trunk/ELF/ScriptParser.cpp
@@ -828,7 +828,9 @@
// We handle the FILL command as an alias for =fillexp section attribute,
// which is different from what GNU linkers do.
// https://sourceware.org/binutils/docs/ld/Output-Section-Data.html
+ expect("(");
cmd->filler = readFill();
+ expect(")");
} else if (tok == "SORT") {
readSort();
} else if (tok == "INCLUDE") {
Index: lld/trunk/test/ELF/linkerscript/fill.test
===================================================================
--- lld/trunk/test/ELF/linkerscript/fill.test
+++ lld/trunk/test/ELF/linkerscript/fill.test
@@ -7,6 +7,7 @@
.out : {
FILL(0x11111111)
. += 2;
+ FILL(0x10101010)
*(.aaa)
. += 4;
*(.bbb)
@@ -18,3 +19,7 @@
# CHECK: Contents of section .out:
# CHECK-NEXT: 2222aa22 222222bb 22222222 22222222
+
+# RUN: echo 'SECTIONS { .out : { FILL 0x11111111 } }' > %t.script
+# RUN: not ld.lld -o /dev/null --script %t.script 2>&1 | FileCheck %s --check-prefix=ERR
+# ERR: ( expected, but got 0x11111111
Index: lld/trunk/test/ELF/linkerscript/sections-padding.s
===================================================================
--- lld/trunk/test/ELF/linkerscript/sections-padding.s
+++ lld/trunk/test/ELF/linkerscript/sections-padding.s
@@ -7,11 +7,16 @@
# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES %s
# YES: 66000011 22000011 22000011 22000011
+# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x1100+0x22 }" > %t.script
+# RUN: ld.lld -o %t.out --script %t.script %t
+# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES2 %s
+# YES2: 66000011 22000011 22000011 22000011
+
## Confirming that address was correct:
# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x99887766 }" > %t.script
# RUN: ld.lld -o %t.out --script %t.script %t
-# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES2 %s
-# YES2: 66998877 66998877 66998877 66998877
+# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES3 %s
+# YES3: 66998877 66998877 66998877 66998877
## Default padding value is 0x00:
# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } }" > %t.script
@@ -51,7 +56,7 @@
# RUN: ld.lld -o %t.out --script %t.script %t
# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES %s
-## Check we report an error if expression value is larger that 32-bits.
+## Check we report an error if expression value is larger than 32-bits.
# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =(0x11 << 32) }" > %t.script
# RUN: not ld.lld -o %t.out --script %t.script %t 2>&1 | FileCheck --check-prefix=ERR3 %s
# ERR3: filler expression result does not fit 32-bit: 0x1100000000
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64476.208960.patch
Type: text/x-patch
Size: 2804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190710/90fa290c/attachment.bin>
More information about the llvm-commits
mailing list