aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-csky/csky.exp15
-rw-r--r--ld/testsuite/ld-csky/data.d18
-rw-r--r--ld/testsuite/ld-csky/data.s10
-rw-r--r--ld/testsuite/ld-csky/data_section.s7
-rw-r--r--ld/testsuite/ld-csky/emit-relocs-1.d37
-rw-r--r--ld/testsuite/ld-csky/emit-relocs-1.ld20
-rw-r--r--ld/testsuite/ld-csky/emit-relocs-1a.s24
-rw-r--r--ld/testsuite/ld-csky/emit-relocs-1b.s18
-rw-r--r--ld/testsuite/ld-csky/got.d29
-rw-r--r--ld/testsuite/ld-csky/got.s19
-rw-r--r--ld/testsuite/ld-csky/hilo16.d14
-rw-r--r--ld/testsuite/ld-csky/hilo16.s7
-rw-r--r--ld/testsuite/ld-csky/hilo16_symbol.s2
-rw-r--r--ld/testsuite/ld-csky/tls-gd-v1.d30
-rw-r--r--ld/testsuite/ld-csky/tls-gd-v1.s26
-rw-r--r--ld/testsuite/ld-csky/tls-gd.d29
-rw-r--r--ld/testsuite/ld-csky/tls-gd.s20
-rw-r--r--ld/testsuite/ld-csky/tls-ie-v1.d25
-rw-r--r--ld/testsuite/ld-csky/tls-ie-v1.s29
-rw-r--r--ld/testsuite/ld-csky/tls-ie.d24
-rw-r--r--ld/testsuite/ld-csky/tls-ie.s27
-rw-r--r--ld/testsuite/ld-csky/tls-ld-v1.d29
-rw-r--r--ld/testsuite/ld-csky/tls-ld-v1.s34
-rw-r--r--ld/testsuite/ld-csky/tls-ld.d28
-rw-r--r--ld/testsuite/ld-csky/tls-ld.s28
-rw-r--r--ld/testsuite/ld-csky/tls-le-v1.d14
-rw-r--r--ld/testsuite/ld-csky/tls-le-v1.s29
-rw-r--r--ld/testsuite/ld-csky/tls-le.d13
-rw-r--r--ld/testsuite/ld-csky/tls-le.s23
-rw-r--r--ld/testsuite/ld-elf/merge.d2
-rw-r--r--ld/testsuite/ld-elf/pr16496b.od2
-rw-r--r--ld/testsuite/ld-elf/pr21884.d2
-rw-r--r--ld/testsuite/ld-srec/srec.exp4
-rw-r--r--ld/testsuite/ld-unique/pr21529.d2
34 files changed, 636 insertions, 4 deletions
diff --git a/ld/testsuite/ld-csky/csky.exp b/ld/testsuite/ld-csky/csky.exp
new file mode 100644
index 0000000..94a769f
--- /dev/null
+++ b/ld/testsuite/ld-csky/csky.exp
@@ -0,0 +1,15 @@
+if { ! [istarget csky-*-*] } {
+ return
+}
+
+set linux_gnu [expr [istarget csky*-*-linux*]]
+
+foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.d]] {
+
+ if { ! $linux_gnu && ([string match "$srcdir/$subdir/tls-*.d" $test]
+ || [string match "$srcdir/$subdir/got*.d" $test]) } {
+ continue
+ }
+
+ run_dump_test [file rootname $test]
+}
diff --git a/ld/testsuite/ld-csky/data.d b/ld/testsuite/ld-csky/data.d
new file mode 100644
index 0000000..21b2f27
--- /dev/null
+++ b/ld/testsuite/ld-csky/data.d
@@ -0,0 +1,18 @@
+#name: GB(r28) relative .data section references
+#source: data.s
+#source: data_section.s
+#ld: -e __start
+#objdump: -dr
+
+.*: file format .*
+
+
+Disassembly of section .text:
+
+[0-9a-f]+ <__start>:
+ [0-9a-f]+: cd400004 lrs.b r10, \[0x4\] // the offset is based on .data
+ [0-9a-f]+: cd440002 lrs.h r10, \[0x2\] // the offset is based on .data
+ [0-9a-f]+: cd480001 lrs.w r10, \[0x1\] // the offset is based on .data
+ [0-9a-f]+: cd700004 srs.b r11, \[0x4\] // the offset is based on .data
+ [0-9a-f]+: cd740002 srs.h r11, \[0x2\] // the offset is based on .data
+ [0-9a-f]+: cd780001 srs.w r11, \[0x1\] // the offset is based on .data
diff --git a/ld/testsuite/ld-csky/data.s b/ld/testsuite/ld-csky/data.s
new file mode 100644
index 0000000..b5af989
--- /dev/null
+++ b/ld/testsuite/ld-csky/data.s
@@ -0,0 +1,10 @@
+ .text
+ .global __start
+__start:
+ lrs.b r10, [word1]
+ lrs.h r10, [word1]
+ lrs.w r10, [word1]
+
+ srs.b r11, [word1]
+ srs.h r11, [word1]
+ srs.w r11, [word1]
diff --git a/ld/testsuite/ld-csky/data_section.s b/ld/testsuite/ld-csky/data_section.s
new file mode 100644
index 0000000..886561c
--- /dev/null
+++ b/ld/testsuite/ld-csky/data_section.s
@@ -0,0 +1,7 @@
+ .global word0, word1
+ .data
+ .align 4
+word0:
+ .word 0xabcd1234
+word1:
+ .word 0xdeadbeef
diff --git a/ld/testsuite/ld-csky/emit-relocs-1.d b/ld/testsuite/ld-csky/emit-relocs-1.d
new file mode 100644
index 0000000..3cc05ac
--- /dev/null
+++ b/ld/testsuite/ld-csky/emit-relocs-1.d
@@ -0,0 +1,37 @@
+#name: Emit relocs 1
+#source: emit-relocs-1a.s
+#source: emit-relocs-1b.s
+#ld: -q -T emit-relocs-1.ld
+#objdump: -sr
+
+.*: file format .*
+
+RELOCATION RECORDS FOR \[\.data\]:
+OFFSET TYPE VALUE *
+00000000 R_CKCORE_ADDR32 \.data
+00000004 R_CKCORE_ADDR32 \.data\+0x00001000
+00000008 R_CKCORE_ADDR32 \.merge1\+0x00000002
+0000000c R_CKCORE_ADDR32 \.merge2
+00000010 R_CKCORE_ADDR32 \.merge3
+00000014 R_CKCORE_ADDR32 \.merge3\+0x00000004
+00000020 R_CKCORE_ADDR32 \.data\+0x00000020
+00000024 R_CKCORE_ADDR32 \.data\+0x00001020
+00000028 R_CKCORE_ADDR32 \.merge1
+0000002c R_CKCORE_ADDR32 \.merge2\+0x00000002
+00000030 R_CKCORE_ADDR32 \.merge3\+0x00000008
+00000034 R_CKCORE_ADDR32 \.merge3\+0x00000004
+
+
+Contents of section \.text:
+ 80000 036c .*
+Contents of section \.merge1:
+ 80400 666c7574 74657200 flutter.*
+Contents of section \.merge2:
+ 80800 74617374 696e6700 tasting.*
+Contents of section \.merge3:
+ 80c00 00010000 00020000 00030000 .*
+Contents of section \.data:
+ 81000 00100800 00200800 02040800 00080800 .*
+ 81010 000c0800 040c0800 00000000 00000000 .*
+ 81020 20100800 20200800 00040800 02080800 .*
+ 81030 080c0800 040c0800 .*
diff --git a/ld/testsuite/ld-csky/emit-relocs-1.ld b/ld/testsuite/ld-csky/emit-relocs-1.ld
new file mode 100644
index 0000000..574030b
--- /dev/null
+++ b/ld/testsuite/ld-csky/emit-relocs-1.ld
@@ -0,0 +1,20 @@
+ENTRY(__start)
+SECTIONS
+{
+ . = 0x80000;
+ .text : { *(.text) }
+
+ . = ALIGN (0x400);
+ .merge1 : { *(.merge1) }
+
+ . = ALIGN (0x400);
+ .merge2 : { *(.merge2) }
+
+ . = ALIGN (0x400);
+ .merge3 : { *(.merge3) }
+
+ . = ALIGN (0x400);
+ .data : { *(.data) }
+
+ /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-csky/emit-relocs-1a.s b/ld/testsuite/ld-csky/emit-relocs-1a.s
new file mode 100644
index 0000000..89bbf99
--- /dev/null
+++ b/ld/testsuite/ld-csky/emit-relocs-1a.s
@@ -0,0 +1,24 @@
+ .text
+ .align 4
+ .globl __start
+__start:
+ nop
+
+ .section .merge1,"aMS",@progbits,1
+A: .string "utter"
+
+ .section .merge2,"aMS",@progbits,1
+B: .string "tasting"
+
+ .section .merge3,"aM",@progbits,4
+C: .4byte 0x100
+D: .4byte 0x200
+
+ .data
+ .align 4
+E: .4byte E
+ .4byte E + 0x1000
+ .4byte A
+ .4byte B
+ .4byte C
+ .4byte D
diff --git a/ld/testsuite/ld-csky/emit-relocs-1b.s b/ld/testsuite/ld-csky/emit-relocs-1b.s
new file mode 100644
index 0000000..82229c1
--- /dev/null
+++ b/ld/testsuite/ld-csky/emit-relocs-1b.s
@@ -0,0 +1,18 @@
+ .section .merge1,"aMS",@progbits,1
+A: .string "flutter"
+
+ .section .merge2,"aMS",@progbits,1
+B: .string "sting"
+
+ .section .merge3,"aM",@progbits,4
+C: .4byte 0x300
+D: .4byte 0x200
+
+ .data
+ .align 4
+E: .4byte E
+ .4byte E + 0x1000
+ .4byte A
+ .4byte B
+ .4byte C
+ .4byte D
diff --git a/ld/testsuite/ld-csky/got.d b/ld/testsuite/ld-csky/got.d
new file mode 100644
index 0000000..ac997c4
--- /dev/null
+++ b/ld/testsuite/ld-csky/got.d
@@ -0,0 +1,29 @@
+#name: GOT/PLT Link test
+#source: got.s
+#ld: -shared --hash-style=sysv
+#readelf: -d -r
+
+Dynamic section at offset 0x[0-9a-f]+ contains 13 entries:
+ Tag Type Name/Value
+ 0x00000004 \(HASH\) .*
+ 0x00000005 \(STRTAB\) .*
+ 0x00000006 \(SYMTAB\) .*
+ 0x0000000a \(STRSZ\) .* \(bytes\)
+ 0x0000000b \(SYMENT\) .* \(bytes\)
+ 0x00000003 \(PLTGOT\) 0x[0-9a-f]+
+ 0x00000002 \(PLTRELSZ\) 12 \(bytes\)
+ 0x00000014 \(PLTREL\) RELA
+ 0x00000017 \(JMPREL\) 0x[0-9a-f]+
+ 0x00000007 \(RELA\) 0x[0-9a-f]+
+ 0x00000008 \(RELASZ\) 24 \(bytes\)
+ 0x00000009 \(RELAENT\) 12 \(bytes\)
+ 0x00000000 \(NULL\) 0x0
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
+ Offset Info Type Sym.Value Sym. Name \+ Addend
+[0-9a-f]+ [0-9a-f]+ R_CKCORE_GLOB_DAT 00000000 var1 \+ 0
+[0-9a-f]+ [0-9a-f]+ R_CKCORE_GLOB_DAT 00000000 var2 \+ 0
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entry:
+ Offset Info Type Sym.Value Sym. Name \+ Addend
+[0-9a-f]+ [0-9a-f]+ R_CKCORE_JUMP_SLO 00000000 bar \+ .*
diff --git a/ld/testsuite/ld-csky/got.s b/ld/testsuite/ld-csky/got.s
new file mode 100644
index 0000000..d5f3b72
--- /dev/null
+++ b/ld/testsuite/ld-csky/got.s
@@ -0,0 +1,19 @@
+ .text
+ .align 2
+ .global foo
+ .type foo, @function
+foo:
+ push l0, lr, gb
+ lrw t1, .L2@GOTPC
+ grs gb, .L2
+.L2:
+ addu gb, gb, t1
+ lrs.w a3, [var1@GOT]
+ ld.w l0, (a3, 0)
+ lrs.w a3, [var2@GOT]
+ ld.w a3, (a3, 0)
+ lrs.w a0, [bar@PLT]
+ addu l0, l0, a3
+ jsr a0
+ addu a0, l0, a0
+ pop l0, lr, gb
diff --git a/ld/testsuite/ld-csky/hilo16.d b/ld/testsuite/ld-csky/hilo16.d
new file mode 100644
index 0000000..f2435c0
--- /dev/null
+++ b/ld/testsuite/ld-csky/hilo16.d
@@ -0,0 +1,14 @@
+#name: address hi16/lo16 relocations
+#source: hilo16.s
+#source: hilo16_symbol.s
+#ld: -e __start
+#objdump: -dr
+
+.*: file format .*
+
+
+Disassembly of section .text:
+
+[0-9a-f]+ <__start>:
+ [0-9a-f]+: ea21dead movih r1, 57005
+ [0-9a-f]+: ec21beef ori r1, r1, 48879
diff --git a/ld/testsuite/ld-csky/hilo16.s b/ld/testsuite/ld-csky/hilo16.s
new file mode 100644
index 0000000..601fbc6
--- /dev/null
+++ b/ld/testsuite/ld-csky/hilo16.s
@@ -0,0 +1,7 @@
+# Test the hi16/lo16 relocations
+
+.text
+.global __start
+__start:
+ movih r1, (long_symbol) >> 16
+ ori r1, r1, (long_symbol) & 0xffff
diff --git a/ld/testsuite/ld-csky/hilo16_symbol.s b/ld/testsuite/ld-csky/hilo16_symbol.s
new file mode 100644
index 0000000..e8fad0f
--- /dev/null
+++ b/ld/testsuite/ld-csky/hilo16_symbol.s
@@ -0,0 +1,2 @@
+.global long_symbol
+.set long_symbol, 0xDEADBEEF
diff --git a/ld/testsuite/ld-csky/tls-gd-v1.d b/ld/testsuite/ld-csky/tls-gd-v1.d
new file mode 100644
index 0000000..c2c8766
--- /dev/null
+++ b/ld/testsuite/ld-csky/tls-gd-v1.d
@@ -0,0 +1,30 @@
+#name: TLS Global Dynamic link test (C-SKY V1)
+#source: tls-gd-v1.s
+#as: -mcpu=ck610
+#ld: -shared --hash-style=sysv
+#readelf: -d -r
+
+Dynamic section at offset 0x[0-9a-f]+ contains 13 entries:
+ Tag Type Name/Value
+ 0x00000004 \(HASH\) .*
+ 0x00000005 \(STRTAB\) .*
+ 0x00000006 \(SYMTAB\) .*
+ 0x0000000a \(STRSZ\) .* \(bytes\)
+ 0x0000000b \(SYMENT\) .* \(bytes\)
+ 0x00000003 \(PLTGOT\) 0x[0-9a-f]+
+ 0x00000002 \(PLTRELSZ\) 12 \(bytes\)
+ 0x00000014 \(PLTREL\) RELA
+ 0x00000017 \(JMPREL\) 0x[0-9a-f]+
+ 0x00000007 \(RELA\) 0x[0-9a-f]+
+ 0x00000008 \(RELASZ\) 24 \(bytes\)
+ 0x00000009 \(RELAENT\) 12 \(bytes\)
+ 0x00000000 \(NULL\) 0x0
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
+ Offset Info Type Sym.Value Sym. Name \+ Addend
+[0-9a-f]+ [0-9a-f]+ R_CKCORE_TLS_DTPM 00000000 var \+ 0
+[0-9a-f]+ [0-9a-f]+ R_CKCORE_TLS_DTPO 00000000 var \+ 0
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entry:
+ Offset Info Type Sym.Value Sym. Name \+ Addend
+[0-9a-f]+ 0000040c R_CKCORE_JUMP_SLO 00000000 __tls_get_addr \+ .*
diff --git a/ld/testsuite/ld-csky/tls-gd-v1.s b/ld/testsuite/ld-csky/tls-gd-v1.s
new file mode 100644
index 0000000..617aac0
--- /dev/null
+++ b/ld/testsuite/ld-csky/tls-gd-v1.s
@@ -0,0 +1,26 @@
+ .global __tls_get_addr
+ .text
+ .align 2
+ .global foo
+ .type foo, @function
+foo:
+ subi sp, sp, 8
+ st.w gb, (sp)
+ st.w r15, (sp, 4)
+ bsr .L2
+.L2:
+ lrw gb, .L2@GOTPC
+ addu gb, gb, r15
+ lrw r7, __tls_get_addr@PLT
+ addu r7, r7, gb
+ ld.w r7, (r7)
+ bsr .LTLS0
+.LTLS0:
+ lrw r2, var@TLSGD32
+ addu r2, r15
+ jsr r7
+ ld.w r2, (r2)
+ ld.w r15, (sp, 4)
+ ld.w gb, (sp)
+ addi sp, sp, 8
+ jmp r15
diff --git a/ld/testsuite/ld-csky/tls-gd.d b/ld/testsuite/ld-csky/tls-gd.d
new file mode 100644
index 0000000..2d5e1fc
--- /dev/null
+++ b/ld/testsuite/ld-csky/tls-gd.d
@@ -0,0 +1,29 @@
+#name: TLS Global Dynamic link test
+#source: tls-gd.s
+#ld: -shared --hash-style=sysv
+#readelf: -d -r
+
+Dynamic section at offset 0x[0-9a-f]+ contains 13 entries:
+ Tag Type Name/Value
+ 0x00000004 \(HASH\) .*
+ 0x00000005 \(STRTAB\) .*
+ 0x00000006 \(SYMTAB\) .*
+ 0x0000000a \(STRSZ\) .* \(bytes\)
+ 0x0000000b \(SYMENT\) .* \(bytes\)
+ 0x00000003 \(PLTGOT\) 0x[0-9a-f]+
+ 0x00000002 \(PLTRELSZ\) 12 \(bytes\)
+ 0x00000014 \(PLTREL\) RELA
+ 0x00000017 \(JMPREL\) 0x[0-9a-f]+
+ 0x00000007 \(RELA\) 0x[0-9a-f]+
+ 0x00000008 \(RELASZ\) 24 \(bytes\)
+ 0x00000009 \(RELAENT\) 12 \(bytes\)
+ 0x00000000 \(NULL\) 0x0
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
+ Offset Info Type Sym.Value Sym. Name \+ Addend
+[0-9a-f]+ [0-9a-f]+ R_CKCORE_TLS_DTPM 00000000 var \+ 0
+[0-9a-f]+ [0-9a-f]+ R_CKCORE_TLS_DTPO 00000000 var \+ 0
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entry:
+ Offset Info Type Sym.Value Sym. Name \+ Addend
+[0-9a-f]+ 0000040c R_CKCORE_JUMP_SLO 00000000 __tls_get_addr \+ .*
diff --git a/ld/testsuite/ld-csky/tls-gd.s b/ld/testsuite/ld-csky/tls-gd.s
new file mode 100644
index 0000000..8fe0e37
--- /dev/null
+++ b/ld/testsuite/ld-csky/tls-gd.s
@@ -0,0 +1,20 @@
+ .text
+ .global __tls_get_addr
+ .align 2
+ .global foo
+ .type foo, @function
+foo:
+ push lr, gb
+ lrw t1, .L2@GOTPC
+ grs gb, .L2
+.L2:
+ addu gb, gb, t1
+ grs a2, .LTLS0
+ lrw a3, __tls_get_addr@PLT
+.LTLS0:
+ lrw a0, var@TLSGD32
+ ldr.w a3, (gb, a3 << 0)
+ addu a0, a0, a2
+ jsr a3
+ ld.w a0, (a0, 0)
+ pop lr, gb
diff --git a/ld/testsuite/ld-csky/tls-ie-v1.d b/ld/testsuite/ld-csky/tls-ie-v1.d
new file mode 100644
index 0000000..1f5f446
--- /dev/null
+++ b/ld/testsuite/ld-csky/tls-ie-v1.d
@@ -0,0 +1,25 @@
+#name: TLS Initial Exec link test (C-SKY v1)
+#source: tls-ie-v1.s
+#as: -mcpu=ck610
+#ld: -shared --hash-style=sysv
+#readelf: -d -r
+
+Dynamic section at offset 0x[0-9a-f]+ contains 13 entries:
+ Tag Type Name/Value
+ 0x00000004 \(HASH\) .*
+ 0x00000005 \(STRTAB\) .*
+ 0x00000006 \(SYMTAB\) .*
+ 0x0000000a \(STRSZ\) .* \(bytes\)
+ 0x0000000b \(SYMENT\) .* \(bytes\)
+ 0x00000003 \(PLTGOT\) 0x[0-9a-f]+
+ 0x00000002 \(PLTRELSZ\) 0 \(bytes\)
+ 0x00000014 \(PLTREL\) RELA
+ 0x00000017 \(JMPREL\) 0x[0-9a-f]+
+ 0x00000007 \(RELA\) 0x[0-9a-f]+
+ 0x00000008 \(RELASZ\) 12 \(bytes\)
+ 0x00000009 \(RELAENT\) 12 \(bytes\)
+ 0x00000000 \(NULL\) 0x0
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
+ Offset Info Type Sym.Value Sym. Name \+ Addend
+[0-9a-f]+ 0000003a R_CKCORE_TLS_TPOF 0
diff --git a/ld/testsuite/ld-csky/tls-ie-v1.s b/ld/testsuite/ld-csky/tls-ie-v1.s
new file mode 100644
index 0000000..7c72362
--- /dev/null
+++ b/ld/testsuite/ld-csky/tls-ie-v1.s
@@ -0,0 +1,29 @@
+ .text
+ .section .tbss,"awT",@nobits
+ .align 2
+ .type var, @object
+ .size var, 4
+var:
+ .word 0
+
+ .text
+ .align 2
+ .global _start
+ .type _start, @function
+_start:
+ subi sp, sp, 8
+ st.w r15, (sp)
+ bsr .LTLS0
+.LTLS0:
+ lrw r7, var@GOTTPOFF
+ addu r7, r15
+ ld.w r7, (r7)
+ bsr __read_tp
+ addu r7, r7, r2
+ ld.w r2, (r7)
+ ld.w r15, (sp)
+ addi sp, sp, 8
+ jmp r15
+__read_tp:
+ movi r2, 0
+ jmp r15
diff --git a/ld/testsuite/ld-csky/tls-ie.d b/ld/testsuite/ld-csky/tls-ie.d
new file mode 100644
index 0000000..45a8a11
--- /dev/null
+++ b/ld/testsuite/ld-csky/tls-ie.d
@@ -0,0 +1,24 @@
+#name: TLS Initial Exec link test
+#source: tls-ie.s
+#ld: -shared --hash-style=sysv
+#readelf: -d -r
+
+Dynamic section at offset 0x[0-9a-f]+ contains 13 entries:
+ Tag Type Name/Value
+ 0x00000004 \(HASH\) .*
+ 0x00000005 \(STRTAB\) .*
+ 0x00000006 \(SYMTAB\) .*
+ 0x0000000a \(STRSZ\) .* \(bytes\)
+ 0x0000000b \(SYMENT\) .* \(bytes\)
+ 0x00000003 \(PLTGOT\) 0x[0-9a-f]+
+ 0x00000002 \(PLTRELSZ\) 0 \(bytes\)
+ 0x00000014 \(PLTREL\) RELA
+ 0x00000017 \(JMPREL\) 0x[0-9a-f]+
+ 0x00000007 \(RELA\) 0x[0-9a-f]+
+ 0x00000008 \(RELASZ\) 12 \(bytes\)
+ 0x00000009 \(RELAENT\) 12 \(bytes\)
+ 0x00000000 \(NULL\) 0x0
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
+ Offset Info Type Sym.Value Sym. Name \+ Addend
+[0-9a-f]+ 0000003a R_CKCORE_TLS_TPOF 0
diff --git a/ld/testsuite/ld-csky/tls-ie.s b/ld/testsuite/ld-csky/tls-ie.s
new file mode 100644
index 0000000..36def90
--- /dev/null
+++ b/ld/testsuite/ld-csky/tls-ie.s
@@ -0,0 +1,27 @@
+ .text
+ .section .tbss,"awT",@nobits
+ .align 2
+ .type var, @object
+ .size var, 4
+var:
+ .word 0
+
+ .text
+ .align 2
+ .global _start
+ .type _start, @function
+_start:
+ subi sp, sp, 4
+ st.w l4, (sp, 0)
+ mov l4, sp
+.LTLS0:
+ lrw a3, var@GOTTPOFF
+ grs a2, .LTLS0
+ addu a3, a3, a2
+ ld.w a3, (a3, 0)
+ ldr.w a3, (r31, a3 << 0)
+ mov a0, a3
+ mov sp, l4
+ ld.w l4, (sp, 0)
+ addi sp, sp, 4
+ rts
diff --git a/ld/testsuite/ld-csky/tls-ld-v1.d b/ld/testsuite/ld-csky/tls-ld-v1.d
new file mode 100644
index 0000000..3aaa351
--- /dev/null
+++ b/ld/testsuite/ld-csky/tls-ld-v1.d
@@ -0,0 +1,29 @@
+#name: TLS Local Dynamic link test (C-SKY v1)
+#source: tls-ld-v1.s
+#as: -mcpu=ck610
+#ld: -shared --hash-style=sysv
+#readelf: -d -r
+
+Dynamic section at offset 0x[0-9a-f]+ contains 13 entries:
+ Tag Type Name/Value
+ 0x00000004 \(HASH\) .*
+ 0x00000005 \(STRTAB\) .*
+ 0x00000006 \(SYMTAB\) .*
+ 0x0000000a \(STRSZ\) .* \(bytes\)
+ 0x0000000b \(SYMENT\) .* \(bytes\)
+ 0x00000003 \(PLTGOT\) 0x[0-9a-f]+
+ 0x00000002 \(PLTRELSZ\) 12 \(bytes\)
+ 0x00000014 \(PLTREL\) RELA
+ 0x00000017 \(JMPREL\) 0x[0-9a-f]+
+ 0x00000007 \(RELA\) 0x[0-9a-f]+
+ 0x00000008 \(RELASZ\) 12 \(bytes\)
+ 0x00000009 \(RELAENT\) 12 \(bytes\)
+ 0x00000000 \(NULL\) 0x0
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
+ Offset Info Type Sym.Value Sym. Name \+ Addend
+[0-9a-f]+ 00000038 R_CKCORE_TLS_DTPM 0
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entry:
+ Offset Info Type Sym.Value Sym. Name \+ Addend
+[0-9a-f]+ 0000050c R_CKCORE_JUMP_SLO 00000000 __tls_get_addr \+ .*
diff --git a/ld/testsuite/ld-csky/tls-ld-v1.s b/ld/testsuite/ld-csky/tls-ld-v1.s
new file mode 100644
index 0000000..e0a8e76
--- /dev/null
+++ b/ld/testsuite/ld-csky/tls-ld-v1.s
@@ -0,0 +1,34 @@
+ .global __tls_get_addr
+ .text
+ .align 2
+ .global foo
+ .type foo, @function
+foo:
+ subi sp, sp, 8
+ st.w gb, (sp)
+ st.w r15, (sp, 4)
+ bsr .L2
+.L2:
+ lrw gb, .L2@GOTPC
+ addu gb, gb, r15
+ lrw r7, __tls_get_addr@PLT
+ addu r7, r7, gb
+ ld.w r7, (r7)
+ bsr .LTLS0
+.LTLS0:
+ lrw r2, var@TLSLDM32
+ addu r2, r15
+ jsr r7
+ lrw r7, var@TLSLDO32
+ addu r2, r2, r7
+ ld.w r15, (sp, 4)
+ ld.w gb, (sp)
+ addi sp, sp, 8
+ jmp r15
+ .size foo, .-foo
+ .section .tbss,"awT",@nobits
+ .align 2
+ .type var, @object
+ .size var, 4
+var:
+ .fill 4, 1
diff --git a/ld/testsuite/ld-csky/tls-ld.d b/ld/testsuite/ld-csky/tls-ld.d
new file mode 100644
index 0000000..3922152
--- /dev/null
+++ b/ld/testsuite/ld-csky/tls-ld.d
@@ -0,0 +1,28 @@
+#name: TLS Local Dynamic link test
+#source: tls-ld.s
+#ld: -shared --hash-style=sysv
+#readelf: -d -r
+
+Dynamic section at offset 0x[0-9a-f]+ contains 13 entries:
+ Tag Type Name/Value
+ 0x00000004 \(HASH\) .*
+ 0x00000005 \(STRTAB\) .*
+ 0x00000006 \(SYMTAB\) .*
+ 0x0000000a \(STRSZ\) .* \(bytes\)
+ 0x0000000b \(SYMENT\) .* \(bytes\)
+ 0x00000003 \(PLTGOT\) 0x[0-9a-f]+
+ 0x00000002 \(PLTRELSZ\) 12 \(bytes\)
+ 0x00000014 \(PLTREL\) RELA
+ 0x00000017 \(JMPREL\) 0x[0-9a-f]+
+ 0x00000007 \(RELA\) 0x[0-9a-f]+
+ 0x00000008 \(RELASZ\) 12 \(bytes\)
+ 0x00000009 \(RELAENT\) 12 \(bytes\)
+ 0x00000000 \(NULL\) 0x0
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
+ Offset Info Type Sym.Value Sym. Name \+ Addend
+[0-9a-f]+ 00000038 R_CKCORE_TLS_DTPM 0
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entry:
+ Offset Info Type Sym.Value Sym. Name \+ Addend
+[0-9a-f]+ 0000050c R_CKCORE_JUMP_SLO 00000000 __tls_get_addr \+ .*
diff --git a/ld/testsuite/ld-csky/tls-ld.s b/ld/testsuite/ld-csky/tls-ld.s
new file mode 100644
index 0000000..3ad06ce
--- /dev/null
+++ b/ld/testsuite/ld-csky/tls-ld.s
@@ -0,0 +1,28 @@
+ .text
+ .global __tls_get_addr
+ .align 2
+ .global foo
+ .type foo, @function
+foo:
+ push lr, gb
+ lrw t1, .L2@GOTPC
+ grs gb, .L2
+.L2:
+ addu gb, gb, t1
+ grs a3, .LTLS0
+.LTLS0:
+ lrw a0, .LANCHOR0@TLSLDM32
+ addu a0, a0, a3
+ lrs.w a3, [__tls_get_addr@PLT]
+ jsr a3
+ lrw a3, .LANCHOR0@TLSLDO32
+ addu a0, a0, a3
+ pop lr, gb
+ .size foo, .-foo
+ .section .tbss,"awT",@nobits
+ .align 2
+ .set .LANCHOR0,. + 0
+ .type var, @object
+ .size var, 4
+var:
+ .fill 4, 1
diff --git a/ld/testsuite/ld-csky/tls-le-v1.d b/ld/testsuite/ld-csky/tls-le-v1.d
new file mode 100644
index 0000000..034d5d9
--- /dev/null
+++ b/ld/testsuite/ld-csky/tls-le-v1.d
@@ -0,0 +1,14 @@
+#name: TLS Local Exec link test (C-SKY v1)
+#source: tls-le-v1.s
+#as: -mcpu=ck610
+#ld:
+#objdump: -h
+
+.*: file format .*
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 .text .*
+ .*
+ 1 .tbss .*
+ .*
diff --git a/ld/testsuite/ld-csky/tls-le-v1.s b/ld/testsuite/ld-csky/tls-le-v1.s
new file mode 100644
index 0000000..b93521e
--- /dev/null
+++ b/ld/testsuite/ld-csky/tls-le-v1.s
@@ -0,0 +1,29 @@
+ .section .tbss,"awT",@nobits
+ .align 2
+ .type var, @object
+ .size var, 4
+var:
+ .fill 4, 1
+ .text
+ .align 2
+ .global _start
+ .type _start, @function
+_start:
+ subi sp, sp, 8
+ st.w r15, (sp)
+ st.w r8, (sp, 4)
+ mov r8, sp
+ bsr __read_tp
+ mov r6, r2
+ lrw r7, var@TPOFF
+ addu r7, r7, r6
+ ld.w r7, (r7)
+ mov r2, r7
+ mov sp, r8
+ ld.w r15, (sp)
+ ld.w r8, (sp, 4)
+ addi sp, sp, 8
+ jmp r15
+__read_tp:
+ movi r2, 0
+ jmp r15
diff --git a/ld/testsuite/ld-csky/tls-le.d b/ld/testsuite/ld-csky/tls-le.d
new file mode 100644
index 0000000..8a0d90f
--- /dev/null
+++ b/ld/testsuite/ld-csky/tls-le.d
@@ -0,0 +1,13 @@
+#name: TLS Local Exec link test
+#source: tls-le.s
+#ld:
+#objdump: -h
+
+.*: file format .*
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 .text .*
+ .*
+ 1 .tbss .*
+ .*
diff --git a/ld/testsuite/ld-csky/tls-le.s b/ld/testsuite/ld-csky/tls-le.s
new file mode 100644
index 0000000..240a59d
--- /dev/null
+++ b/ld/testsuite/ld-csky/tls-le.s
@@ -0,0 +1,23 @@
+ .text
+ .section .tbss,"awT",@nobits
+ .align 2
+ .type var, @object
+ .size var, 4
+var:
+ .word 0
+
+ .text
+ .align 2
+ .global _start
+ .type _start, @function
+_start:
+ subi sp, sp, 4
+ st.w l4, (sp, 0)
+ mov l4, sp
+ lrw a3, var@TPOFF
+ ldr.w a3, (r31, a3 << 0)
+ mov a0, a3
+ mov sp, l4
+ ld.w l4, (sp, 0)
+ addi sp, sp, 4
+ rts
diff --git a/ld/testsuite/ld-elf/merge.d b/ld/testsuite/ld-elf/merge.d
index 3e3bcba..c0a8511 100644
--- a/ld/testsuite/ld-elf/merge.d
+++ b/ld/testsuite/ld-elf/merge.d
@@ -1,7 +1,7 @@
#source: merge.s
#ld: -T merge.ld
#objdump: -s
-#xfail: bfin-*-* cr16-*-* cris*-*-* crx-*-* d10v-*-* d30v-*-* dlx-*-*
+#xfail: bfin-*-* cr16-*-* cris*-*-* crx-*-* csky-*-* d10v-*-* d30v-*-* dlx-*-*
#xfail: fr30-*-* frv-*-* ft32-*-* h8300-*-* hppa*64*-*-* ip2k-*-* iq2000-*-*
#xfail: lm32-*-* m68hc11-*-* mcore-*-* mep-*-* metag-*-* mn102*-*-* ms1-*-*
#xfail: nios2-*-* or32-*-* pj-*-* pru-*-* s12z-*-* score-*-* tic6x-*-*
diff --git a/ld/testsuite/ld-elf/pr16496b.od b/ld/testsuite/ld-elf/pr16496b.od
index 6fb54c1..f348ca2 100644
--- a/ld/testsuite/ld-elf/pr16496b.od
+++ b/ld/testsuite/ld-elf/pr16496b.od
@@ -1,3 +1,3 @@
#...
-.* sd_get_seats@LIBSYSTEMD_209
+.* sd_get_seats@LIBSYSTEMD_209(\+0x.*)?
#pass
diff --git a/ld/testsuite/ld-elf/pr21884.d b/ld/testsuite/ld-elf/pr21884.d
index 3d44ccf..c230924 100644
--- a/ld/testsuite/ld-elf/pr21884.d
+++ b/ld/testsuite/ld-elf/pr21884.d
@@ -3,7 +3,7 @@
#ld: -T pr21884.t
#objdump: -b binary -s
#xfail: aarch64*-*-* arm*-*-* avr-*-* ia64-*-* m68hc1*-*-* nds32*-*-*
-#xfail: riscv*-*-* score-*-* v850-*-*
+#xfail: riscv*-*-* score-*-* v850-*-* csky-*-*
# Skip targets which can't change output format to binary.
.*: file format binary
diff --git a/ld/testsuite/ld-srec/srec.exp b/ld/testsuite/ld-srec/srec.exp
index 7604e53..d155c18 100644
--- a/ld/testsuite/ld-srec/srec.exp
+++ b/ld/testsuite/ld-srec/srec.exp
@@ -418,6 +418,9 @@ setup_xfail "bfin-*-linux-uclibc"
# generate the format if need be).
setup_xfail "tile*-*-*"
+# The S-record linker is not supported for C-SKY.
+setup_xfail "csky*-*-*"
+
run_srec_test $test1 "tmpdir/sr1.o tmpdir/sr2.o"
# Now try linking a C++ program with global constructors and
@@ -453,6 +456,7 @@ setup_xfail "*-*-cygwin*" "*-*-mingw*" "*-*-pe*" "*-*-winnt*"
setup_xfail "score-*-*"
setup_xfail "bfin-*-linux-uclibc"
setup_xfail "tile*-*-*"
+setup_xfail "csky*-*-*"
run_srec_test $test2 "tmpdir/sr3.o"
diff --git a/ld/testsuite/ld-unique/pr21529.d b/ld/testsuite/ld-unique/pr21529.d
index fb63794..0e6332e 100644
--- a/ld/testsuite/ld-unique/pr21529.d
+++ b/ld/testsuite/ld-unique/pr21529.d
@@ -1,6 +1,6 @@
#ld: --oformat binary -T pr21529.ld -e main
#objdump: -s -b binary
-#xfail: aarch64*-*-* arm*-*-* avr-*-* ia64-*-* m68hc1*-*-* nds32*-*-* riscv*-*-* score-*-* v850-*-*
+#xfail: aarch64*-*-* arm*-*-* avr-*-* ia64-*-* m68hc1*-*-* nds32*-*-* riscv*-*-* score-*-* v850-*-* csky-*-*
# Skip targets which can't change output format to binary.
#pass