aboutsummaryrefslogtreecommitdiff
path: root/test/ELF/linkerscript/early-assign-symbol.s
diff options
context:
space:
mode:
Diffstat (limited to 'test/ELF/linkerscript/early-assign-symbol.s')
-rw-r--r--test/ELF/linkerscript/early-assign-symbol.s24
1 files changed, 19 insertions, 5 deletions
diff --git a/test/ELF/linkerscript/early-assign-symbol.s b/test/ELF/linkerscript/early-assign-symbol.s
index 0626e66e6fb6..5f6117863666 100644
--- a/test/ELF/linkerscript/early-assign-symbol.s
+++ b/test/ELF/linkerscript/early-assign-symbol.s
@@ -1,14 +1,28 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
-# RUN: echo "SECTIONS { aaa = 1 + ABSOLUTE(foo - 1); .text : { *(.text*) } }" > %t1.script
-# RUN: not ld.lld -o %t --script %t1.script %t.o 2>&1 | FileCheck %s
-
-# RUN: echo "SECTIONS { aaa = ABSOLUTE(foo - 1) + 1; .text : { *(.text*) } }" > %t2.script
-# RUN: not ld.lld -o %t --script %t2.script %t.o 2>&1 | FileCheck %s
+# RUN: echo "SECTIONS { aaa = foo | 1; .text : { *(.text*) } }" > %t3.script
+# RUN: not ld.lld -o %t --script %t3.script %t.o 2>&1 | FileCheck %s
# CHECK: error: {{.*}}.script:1: unable to evaluate expression: input section .text has no output section assigned
+# Simple cases that we can handle.
+
+# RUN: echo "SECTIONS { aaa = ABSOLUTE(foo - 1) + 1; .text : { *(.text*) } }" > %t.script
+# RUN: ld.lld -o %t --script %t.script %t.o
+# RUN: llvm-objdump -t %t | FileCheck --check-prefix=VAL %s
+
+# RUN: echo "SECTIONS { aaa = 1 + ABSOLUTE(foo - 1); .text : { *(.text*) } }" > %t.script
+# RUN: ld.lld -o %t --script %t.script %t.o
+# RUN: llvm-objdump -t %t | FileCheck --check-prefix=VAL %s
+
+# RUN: echo "SECTIONS { aaa = ABSOLUTE(foo); .text : { *(.text*) } }" > %t4.script
+# RUN: ld.lld -o %t --script %t4.script %t.o
+# RUN: llvm-objdump -t %t | FileCheck --check-prefix=VAL %s
+
+# VAL: 0000000000000000 .text 00000000 foo
+# VAL: 0000000000000000 *ABS* 00000000 aaa
+
.section .text
.globl foo
foo: