summaryrefslogtreecommitdiff
path: root/test/ELF/linkerscript/addr-zero.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/ELF/linkerscript/addr-zero.test')
-rw-r--r--test/ELF/linkerscript/addr-zero.test21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ELF/linkerscript/addr-zero.test b/test/ELF/linkerscript/addr-zero.test
new file mode 100644
index 0000000000000..6253f619381bb
--- /dev/null
+++ b/test/ELF/linkerscript/addr-zero.test
@@ -0,0 +1,21 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o
+# RUN: ld.lld -o %t.so --script %s %t.o -shared
+# RUN: llvm-readobj --symbols %t.so | FileCheck %s
+
+# Test that the script creates a non absolute symbol with value
+# 0 I.E., a symbol that refers to the load address.
+
+# CHECK: Symbol {
+# CHECK: Name: foo
+# CHECK-NEXT: Value: 0x70
+# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Binding: Global
+# CHECK-NEXT: Type: None
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: .text
+# CHECK-NEXT: }
+
+SECTIONS {
+ foo = ADDR(.text) - ABSOLUTE(ADDR(.text));
+};