aboutsummaryrefslogtreecommitdiff
path: root/test/old-elf/linkerscript/symbol-definition-so.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/old-elf/linkerscript/symbol-definition-so.test')
-rw-r--r--test/old-elf/linkerscript/symbol-definition-so.test32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/old-elf/linkerscript/symbol-definition-so.test b/test/old-elf/linkerscript/symbol-definition-so.test
new file mode 100644
index 000000000000..15b22f6f581f
--- /dev/null
+++ b/test/old-elf/linkerscript/symbol-definition-so.test
@@ -0,0 +1,32 @@
+/*
+We test whether we can define symbols in a linker script and have them exported
+to the output file symbol table. This test is the same as symbol-definition.test
+but make checking in case of shared library linking.
+
+We use the following linker script for this test:
+*/
+
+SECTIONS
+{
+ .text : { *(.text) }
+ MYSTRING = .;
+ .data : { *(.data) }
+}
+
+/*
+RUN: yaml2obj -format=elf %p/Inputs/simple-pic.o.yaml -o=%t.o
+
+RUN: lld -flavor old-gnu -target x86_64 -shared -T %s %t.o -o %t.so
+RUN: llvm-readobj -s -symbols %t.so | FileCheck -check-prefix CHECKSYMS %s
+
+CHECKSYMS: Name: .data
+CHECKSYMS-NEXT: Type: SHT_PROGBITS
+CHECKSYMS-NEXT: Flags [
+CHECKSYMS-NEXT: SHF_ALLOC
+CHECKSYMS-NEXT: SHF_WRITE
+CHECKSYMS-NEXT: ]
+CHECKSYMS-NEXT: Address: 0x401060
+
+CHECKSYMS: Name: MYSTRING
+CHECKSYMS-NEXT: Value: 0x401060
+*/