This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch 7/9] Nios II port, new ld tests


This patch adds new linker tests for the Nios II port.

-Sandra

2013-01-24  Sandra Loosemore  <sandra@codesourcery.com>
            Andrew Jenner <andrew@codesourcery.com>

Based on patches from Altera Corporation.

	ld/testsuite/
	* ld-nios2/emit-relocs-1a.s: New.
	* ld-nios2/emit-relocs-1b.s: New.
	* ld-nios2/emit-relocs-1.d: New.
	* ld-nios2/emit-relocs-1.ld: New.
	* ld-nios2/gprel.d: New.
	* ld-nios2/gprel.s: New.
	* ld-nios2/hilo16.d: New.
	* ld-nios2/hilo16.s: New.
	* ld-nios2/hilo16_symbol.s: New.
	* ld-nios2/imm5.d: New.
	* ld-nios2/imm5.s: New.
	* ld-nios2/imm5_symbol.s: New.
	* ld-nios2/nios2.exp: New.
	* ld-nios2/pcrel16.d: New.
	* ld-nios2/pcrel16_label.s: New.
	* ld-nios2/pcrel16.s: New.
	* ld-nios2/relax_callr.d: New.
	* ld-nios2/relax_callr.ld: New.
	* ld-nios2/relax_callr.s: New.
	* ld-nios2/relax_cjmp.d: New.
	* ld-nios2/relax_cjmp.s: New.
	* ld-nios2/relax_jmp.ld: New.
	* ld-nios2/relax_section.d: New.
	* ld-nios2/relax_section.s: New.
	* ld-nios2/relax_ujmp.d: New.
	* ld-nios2/relax_ujmp.s: New.
	* ld-nios2/reloc.d: New.
	* ld-nios2/reloc.s: New.
	* ld-nios2/reloc_symbol.s: New.
	* ld-nios2/s16.d: New.
	* ld-nios2/s16.s: New.
	* ld-nios2/s16_symbol.s: New.
	* ld-nios2/u16.d: New.
	* ld-nios2/u16.s: New.
	* ld-nios2/u16_symbol.s: New.
Index: ld/testsuite/ld-nios2/emit-relocs-1.d
===================================================================
RCS file: ld/testsuite/ld-nios2/emit-relocs-1.d
diff -N ld/testsuite/ld-nios2/emit-relocs-1.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/emit-relocs-1.d	22 Jan 2013 18:36:38 -0000
@@ -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_NIOS2_BFD_RELOC32  \.data
+00000004 R_NIOS2_BFD_RELOC32  \.data\+0x00001000
+00000008 R_NIOS2_BFD_RELOC32  \.merge1\+0x00000002
+0000000c R_NIOS2_BFD_RELOC32  \.merge2
+00000010 R_NIOS2_BFD_RELOC32  \.merge3
+00000014 R_NIOS2_BFD_RELOC32  \.merge3\+0x00000004
+00000020 R_NIOS2_BFD_RELOC32  \.data\+0x00000020
+00000024 R_NIOS2_BFD_RELOC32  \.data\+0x00001020
+00000028 R_NIOS2_BFD_RELOC32  \.merge1
+0000002c R_NIOS2_BFD_RELOC32  \.merge2\+0x00000002
+00000030 R_NIOS2_BFD_RELOC32  \.merge3\+0x00000008
+00000034 R_NIOS2_BFD_RELOC32  \.merge3\+0x00000004
+
+
+Contents of section \.text:
+ 80000 3a880100 00000000 00000000 00000000  .*
+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 .*
Index: ld/testsuite/ld-nios2/emit-relocs-1.ld
===================================================================
RCS file: ld/testsuite/ld-nios2/emit-relocs-1.ld
diff -N ld/testsuite/ld-nios2/emit-relocs-1.ld
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/emit-relocs-1.ld	22 Jan 2013 18:36:38 -0000
@@ -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/ : { *(*) }
+}
Index: ld/testsuite/ld-nios2/emit-relocs-1a.s
===================================================================
RCS file: ld/testsuite/ld-nios2/emit-relocs-1a.s
diff -N ld/testsuite/ld-nios2/emit-relocs-1a.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/emit-relocs-1a.s	22 Jan 2013 18:36:38 -0000
@@ -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
Index: ld/testsuite/ld-nios2/emit-relocs-1b.s
===================================================================
RCS file: ld/testsuite/ld-nios2/emit-relocs-1b.s
diff -N ld/testsuite/ld-nios2/emit-relocs-1b.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/emit-relocs-1b.s	22 Jan 2013 18:36:38 -0000
@@ -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
Index: ld/testsuite/ld-nios2/gprel.d
===================================================================
RCS file: ld/testsuite/ld-nios2/gprel.d
diff -N ld/testsuite/ld-nios2/gprel.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/gprel.d	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,17 @@
+#name: NIOS2 gp-relative relocations
+#source: gprel.s
+#ld:
+#objdump: -dr --prefix-addresses
+
+# Test the %gprel macro.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+[0-9a-f]+ <[^>]*> movui	gp,[0-9]+
+[0-9a-f]+ <[^>]*> ldw	at,-[0-9]+\(gp\)
+[0-9a-f]+ <[^>]*> ldw	r2,-[0-9]+\(gp\)
+[0-9a-f]+ <[^>]*> ldb	r3,-[0-9]+\(gp\)
+[0-9a-f]+ <[^>]*> ldw	at,-[0-9]+\(gp\)
+[0-9a-f]+ <[^>]*> ldw	r2,-[0-9]+\(gp\)
+[0-9a-f]+ <[^>]*> ldb	r3,-[0-9]+\(gp\)
Index: ld/testsuite/ld-nios2/gprel.s
===================================================================
RCS file: ld/testsuite/ld-nios2/gprel.s
diff -N ld/testsuite/ld-nios2/gprel.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/gprel.s	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,29 @@
+.set noat
+
+.sdata
+
+sym1:
+.long 0xdead
+sym2:
+.long 0xbeef
+sym3:
+.byte 0x7f
+
+.section .sbss, "w"
+sym4:
+.long 0
+sym5:
+.long 0
+sym6:
+.byte 0
+
+.text
+.global _start
+_start:
+	movui gp, _gp
+	ldw r1, %gprel(sym1)(gp)
+	ldw r2, %gprel(sym2)(gp)
+	ldb r3, %gprel(sym3)(gp)
+	ldw r1, %gprel(sym4)(gp)
+	ldw r2, %gprel(sym5)(gp)
+	ldb r3, %gprel(sym6)(gp)
Index: ld/testsuite/ld-nios2/hilo16.d
===================================================================
RCS file: ld/testsuite/ld-nios2/hilo16.d
diff -N ld/testsuite/ld-nios2/hilo16.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/hilo16.d	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,13 @@
+#name: NIOS2 R_NIOS2_HI16,LO16,HIADJ16
+#source: hilo16.s
+#source: hilo16_symbol.s
+#ld:
+#objdump: -dr --prefix-addresses
+
+# Test the %hi, %lo and %hiadi relocations
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+[0-9a-f]+ <[^>]*> addi	at,at,-8531
+[0-9a-f]+ <[^>]*> addi	at,at,-16657
+[0-9a-f]+ <[^>]*> addi	at,at,-8530
Index: ld/testsuite/ld-nios2/hilo16.s
===================================================================
RCS file: ld/testsuite/ld-nios2/hilo16.s
diff -N ld/testsuite/ld-nios2/hilo16.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/hilo16.s	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,10 @@
+# Test the %hi, lo and %hiadj relocations
+
+.set noat
+
+.text
+.global _start
+_start:
+	addi r1, r1, %hi(long_symbol)
+	addi r1, r1, %lo(long_symbol)
+	addi r1, r1, %hiadj(long_symbol)
Index: ld/testsuite/ld-nios2/hilo16_symbol.s
===================================================================
RCS file: ld/testsuite/ld-nios2/hilo16_symbol.s
diff -N ld/testsuite/ld-nios2/hilo16_symbol.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/hilo16_symbol.s	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,3 @@
+.global long_symbol
+.set long_symbol, 0xDEADBEEF
+
Index: ld/testsuite/ld-nios2/imm5.d
===================================================================
RCS file: ld/testsuite/ld-nios2/imm5.d
diff -N ld/testsuite/ld-nios2/imm5.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/imm5.d	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,13 @@
+#name: NIOS2 R_NIOS2_IMM5
+#source: imm5.s
+#source: imm5_symbol.s
+#ld:
+#objdump: -dr --prefix-addresses
+
+# Test the branch instructions.
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+[0-9a-f]+ <[^>]*> roli	at,at,31
+[0-9a-f]+ <.[^>]*> Address 0x[0-9a-f]+ is out of bounds.
+
Index: ld/testsuite/ld-nios2/imm5.s
===================================================================
RCS file: ld/testsuite/ld-nios2/imm5.s
diff -N ld/testsuite/ld-nios2/imm5.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/imm5.s	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,9 @@
+# Test the imm5 relocation
+
+.set noat
+.text
+.global _start
+_start:
+	roli r1, r1, imm5
+
+
Index: ld/testsuite/ld-nios2/imm5_symbol.s
===================================================================
RCS file: ld/testsuite/ld-nios2/imm5_symbol.s
diff -N ld/testsuite/ld-nios2/imm5_symbol.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/imm5_symbol.s	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,4 @@
+.global imm5
+.text
+.byte imm5
+.set imm5, 31
Index: ld/testsuite/ld-nios2/nios2.exp
===================================================================
RCS file: ld/testsuite/ld-nios2/nios2.exp
diff -N ld/testsuite/ld-nios2/nios2.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/nios2.exp	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,7 @@
+if { ! [istarget nios2-*-*] } {
+    return
+}
+
+foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.d]] {
+    run_dump_test [file rootname $test]
+}
Index: ld/testsuite/ld-nios2/pcrel16.d
===================================================================
RCS file: ld/testsuite/ld-nios2/pcrel16.d
diff -N ld/testsuite/ld-nios2/pcrel16.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/pcrel16.d	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,15 @@
+#name: NIOS2 R_NIOS2_PCREL16
+#source: pcrel16.s
+#source: pcrel16_label.s
+#ld:
+#objdump: -dr --prefix-addresses
+
+# Test the relative branch relocations.
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+
+[0-9a-f]+ <[^>]*> br	[0-9a-f]+ <ext_label>
+[0-9a-f]+ <[^>]*> br	[0-9a-f]+ <ext_label\+0x10>
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> nop
Index: ld/testsuite/ld-nios2/pcrel16.s
===================================================================
RCS file: ld/testsuite/ld-nios2/pcrel16.s
diff -N ld/testsuite/ld-nios2/pcrel16.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/pcrel16.s	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,8 @@
+# Test for pc-relative relocations
+.set norelax
+.text
+.global _start
+_start:
+	br ext_label
+	br ext_label + 16
+
Index: ld/testsuite/ld-nios2/pcrel16_label.s
===================================================================
RCS file: ld/testsuite/ld-nios2/pcrel16_label.s
diff -N ld/testsuite/ld-nios2/pcrel16_label.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/pcrel16_label.s	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,5 @@
+.text
+ext_label:
+	nop
+	nop
+.global ext_label
Index: ld/testsuite/ld-nios2/relax_callr.d
===================================================================
RCS file: ld/testsuite/ld-nios2/relax_callr.d
diff -N ld/testsuite/ld-nios2/relax_callr.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/relax_callr.d	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,24 @@
+#name: NIOS2 relax_callr
+#as: -relax-all
+#ld: --relax -Trelax_callr.ld
+#source: relax_callr.s
+#objdump: -dr --prefix-addresses 
+# Test relaxation of callr
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section text1:
+00000000 <[^>]*> movhi	at,2048
+00000004 <[^>]*> ori	at,at,0
+00000008 <[^>]*> callr	at
+0000000c <[^>]*> movhi	at,2048
+00000010 <[^>]*> ori	at,at,20
+00000014 <[^>]*> callr	at
+
+Disassembly of section text2:
+08000000 <func> nop
+08000004 <[^>]*> br	08000014 <func1>
+08000008 <[^>]*> nop
+0800000c <[^>]*> nop
+08000010 <[^>]*> nop
+08000014 <func1> nop
Index: ld/testsuite/ld-nios2/relax_callr.ld
===================================================================
RCS file: ld/testsuite/ld-nios2/relax_callr.ld
diff -N ld/testsuite/ld-nios2/relax_callr.ld
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/relax_callr.ld	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,11 @@
+/* Simple script for testing relaxation */
+
+OUTPUT_FORMAT("elf32-littlenios2", "elf32-littlenios2", "elf32-littlenios2")
+OUTPUT_ARCH(nios2)
+ENTRY(_start)
+SECTIONS
+{
+	_start = .;
+	text1 0 : { *(text1) }
+	text2 0x08000000 : { *(text2) }
+}
Index: ld/testsuite/ld-nios2/relax_callr.s
===================================================================
RCS file: ld/testsuite/ld-nios2/relax_callr.s
diff -N ld/testsuite/ld-nios2/relax_callr.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/relax_callr.s	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,17 @@
+# relaxation test for callr
+
+.globl text1
+.section text1, "ax", @progbits
+
+	call func
+	call func1
+	
+.section text2, "ax", @progbits
+func:
+	nop
+	br func1
+	nop
+	nop
+	nop
+func1:
+	nop
Index: ld/testsuite/ld-nios2/relax_cjmp.d
===================================================================
RCS file: ld/testsuite/ld-nios2/relax_cjmp.d
diff -N ld/testsuite/ld-nios2/relax_cjmp.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/relax_cjmp.d	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,38 @@
+#name: NIOS2 relax_cjmp
+#as: -relax-all
+#ld: --relax -Trelax_jmp.ld
+#source: relax_cjmp.s
+#objdump: -dr --prefix-addresses 
+
+# Test relaxation of conditional jumps
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section text2:
+00000000 <[^>]*> bge	r2,r3,00008000 <[^>]*>
+00000004 <[^>]*> bge	r2,r3,00000014 <[^>]*>
+00000008 <[^>]*> movhi	at,1
+0000000c <[^>]*> ori	at,at,24
+00000010 <[^>]*> jmp	at
+00000014 <[^>]*> bge	r3,r2,00000020 <sym>
+00000018 <[^>]*> nop
+0000001c <[^>]*> nop
+00000020 <sym> nop
+
+Disassembly of section text1:
+00008000 <[^>]*> beq	r2,r3,00010000 <on_border>
+00008004 <[^>]*> bne	r2,r3,00008014 <[^>]*>
+00008008 <[^>]*> movhi	at,1
+0000800c <[^>]*> ori	at,at,24
+00008010 <[^>]*> jmp	at
+00008014 <[^>]*> nop
+00008018 <[^>]*> nop
+#...
+00010000 <on_border> bne	r2,r3,00010018 <in_range>
+00010004 <[^>]*> nop
+00010008 <[^>]*> nop
+0001000c <[^>]*> nop
+00010010 <[^>]*> nop
+00010014 <[^>]*> nop
+00010018 <in_range> nop
+#pass
Index: ld/testsuite/ld-nios2/relax_cjmp.s
===================================================================
RCS file: ld/testsuite/ld-nios2/relax_cjmp.s
diff -N ld/testsuite/ld-nios2/relax_cjmp.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/relax_cjmp.s	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,32 @@
+# relaxing conditional jumps -- absolute
+
+.globl text1
+.section text1, "ax", @progbits
+	beq r2, r3, on_border
+	beq r2, r3, out_of_range
+	nop
+	nop
+
+.align 15
+on_border:
+	bne r2, r3, in_range
+	nop
+	nop
+	nop
+	nop
+	nop
+out_of_range:
+in_range:
+	nop
+	
+.globl text2
+.section text2, "ax", @progbits
+
+	bge r2, r3, text1
+	blt r2, r3, out_of_range
+	ble r2, r3, sym
+	nop
+	nop
+sym:
+	nop
+
Index: ld/testsuite/ld-nios2/relax_jmp.ld
===================================================================
RCS file: ld/testsuite/ld-nios2/relax_jmp.ld
diff -N ld/testsuite/ld-nios2/relax_jmp.ld
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/relax_jmp.ld	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,11 @@
+/* Simple script for testing relaxation */
+
+OUTPUT_FORMAT("elf32-littlenios2", "elf32-littlenios2", "elf32-littlenios2")
+OUTPUT_ARCH(nios2)
+ENTRY(_start)
+SECTIONS
+{
+	_start = .;
+	text2 0 : { *(text2) }
+	text1 0x8000 : { *(text1) }
+}
Index: ld/testsuite/ld-nios2/relax_section.d
===================================================================
RCS file: ld/testsuite/ld-nios2/relax_section.d
diff -N ld/testsuite/ld-nios2/relax_section.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/relax_section.d	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,35 @@
+#name: NIOS2 relax_section
+#as: -relax-section
+#ld: --relax -Trelax_jmp.ld
+#source: relax_section.s
+#objdump: -dr --prefix-addresses 
+
+# Test relaxation of section
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section text1:
+00008000 <[^>]*> bne	r2,r3,00008010 <[^>]*>
+00008004 <[^>]*> nextpc	at
+00008008 <[^>]*> addi	at,at,32764
+0000800c <[^>]*> jmp	at
+00008010 <[^>]*> bge	r2,r3,00008024 <[^>]*>
+00008014 <[^>]*> nextpc	at
+00008018 <[^>]*> addi	at,at,32767
+0000801c <[^>]*> addi	at,at,9
+00008020 <[^>]*> jmp	at
+00008024 <[^>]*> bne	r2,r3,00008030 <in_range>
+00008028 <[^>]*> nop
+0000802c <[^>]*> nop
+00008030 <in_range> nop
+#...
+00010000 <[^>]*> br	00008030 <in_range>
+00010004 <just_out_of_range> nop
+00010008 <[^>]*> nop
+0001000c <[^>]*> nop
+00010010 <[^>]*> nop
+00010014 <[^>]*> nop
+00010018 <[^>]*> nop
+0001001c <[^>]*> nop
+00010020 <farther_out_of_range> nop
+#pass
Index: ld/testsuite/ld-nios2/relax_section.s
===================================================================
RCS file: ld/testsuite/ld-nios2/relax_section.s
diff -N ld/testsuite/ld-nios2/relax_section.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/relax_section.s	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,23 @@
+# relaxing conditional and unconditional jumps -- pc-relative
+
+.globl text1
+.section text1, "ax", @progbits
+	beq r2, r3, just_out_of_range
+	blt r2, r3, farther_out_of_range
+	bne r2, r3, in_range
+	nop
+	nop
+in_range:
+	nop
+.align 15
+	br in_range
+just_out_of_range:
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+farther_out_of_range:
+	nop
Index: ld/testsuite/ld-nios2/relax_ujmp.d
===================================================================
RCS file: ld/testsuite/ld-nios2/relax_ujmp.d
diff -N ld/testsuite/ld-nios2/relax_ujmp.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/relax_ujmp.d	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,32 @@
+#name: NIOS2 relax_ujmp
+#as: -relax-all
+#ld: --relax -Trelax_jmp.ld
+#source: relax_ujmp.s
+#objdump: -dr --prefix-addresses 
+
+# Test relaxation of unconditional jumps
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section text2:
+00000000 <[^>]*> br	00008000 <[^>]*>
+00000004 <[^>]*> movhi	at,1
+00000008 <[^>]*> ori	at,at,16
+0000000c <[^>]*> jmp	at
+00000010 <[^>]*> br	0000001c <sym>
+00000014 <[^>]*> nop
+00000018 <[^>]*> nop
+0000001c <sym> nop
+
+Disassembly of section text1:
+00008000 <[^>]*> br	00010000 <on_border>
+00008004 <[^>]*> movhi	at,1
+00008008 <[^>]*> ori	at,at,16
+0000800c <[^>]*> jmp	at
+#...
+00010000 <on_border> br	00010010 <in_range>
+00010004 <[^>]*> nop
+00010008 <[^>]*> nop
+0001000c <[^>]*> nop
+00010010 <in_range> nop
+#pass
Index: ld/testsuite/ld-nios2/relax_ujmp.s
===================================================================
RCS file: ld/testsuite/ld-nios2/relax_ujmp.s
diff -N ld/testsuite/ld-nios2/relax_ujmp.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/relax_ujmp.s	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,37 @@
+# relaxing unconditional jumps
+
+.globl text1
+.section text1, "ax", @progbits
+
+	br on_border
+	br out_of_range
+	nop
+	nop
+
+
+.align 15
+#	nop
+#	nop
+on_border:
+	br in_range
+	nop
+	nop
+	nop
+out_of_range:
+in_range:
+	nop
+	
+.globl text2
+.section text2, "ax", @progbits
+
+	br text1
+	br out_of_range
+	br sym
+	nop
+	nop
+sym:
+	nop
+
+	
+
+	
Index: ld/testsuite/ld-nios2/reloc.d
===================================================================
RCS file: ld/testsuite/ld-nios2/reloc.d
diff -N ld/testsuite/ld-nios2/reloc.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/reloc.d	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,10 @@
+#name: NIOS2 R_NIOS2_BFD_RELOC_XX
+#source: reloc.s
+#source: reloc_symbol.s
+#ld:
+#objdump: -s
+
+.*: +file format elf32-littlenios2
+
+Contents of section .text:
+ [0-9a-f]+ fa00cefa efbeadde facefaef beadde00  ................
Index: ld/testsuite/ld-nios2/reloc.s
===================================================================
RCS file: ld/testsuite/ld-nios2/reloc.s
diff -N ld/testsuite/ld-nios2/reloc.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/reloc.s	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,9 @@
+# Test for Nios II 32-bit, 16 and 8-bit relocations
+
+.global byte_sym
+.global short_sym
+.global long_sym
+
+.set byte_sym, 0xFA
+.set short_sym, 0xFACE
+.set long_sym, 0xDEADBEEF
Index: ld/testsuite/ld-nios2/reloc_symbol.s
===================================================================
RCS file: ld/testsuite/ld-nios2/reloc_symbol.s
diff -N ld/testsuite/ld-nios2/reloc_symbol.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/reloc_symbol.s	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,24 @@
+.text
+.global _start
+_start:
+
+# byte aligned
+.align 0
+.byte byte_sym
+
+# short aligned
+.align 1
+.short short_sym
+
+# word aligned
+.align 2
+.long  long_sym
+
+# now lets try some unaligned words and halfwords
+.byte byte_sym
+.2byte short_sym
+.4byte  long_sym
+
+#.align 2
+#nop
+
Index: ld/testsuite/ld-nios2/s16.d
===================================================================
RCS file: ld/testsuite/ld-nios2/s16.d
diff -N ld/testsuite/ld-nios2/s16.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/s16.d	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,12 @@
+#name: NIOS2 R_NIOS2_S16
+#source: s16.s
+#source: s16_symbol.s
+#ld:
+#objdump: -s
+
+# Test the signed 16-bit relocations.
+.*: +file format elf32-littlenios2
+
+Contents of section .text:
+ [0-9a-f]+ 04004408 04006008 c4ff5f08 44004808  ..D...`..._.D.H.
+ [0-9a-f]+ 44004008                             D.@.            
Index: ld/testsuite/ld-nios2/s16.s
===================================================================
RCS file: ld/testsuite/ld-nios2/s16.s
diff -N ld/testsuite/ld-nios2/s16.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/s16.s	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,16 @@
+# Test for Nios II 32-bit, 16 and 8-bit relocations
+
+.set noat
+.set some_other_sym, 0x1000
+.text
+.global _start
+_start:
+# signed 16-bit relocation
+	addi r1, r1, some_sym
+	addi r1, r1, min
+	addi r1, r1, max
+	addi r1, r1, some_sym + some_other_sym + 1
+	addi r1, r1, some_sym - some_other_sym + 1
+
+
+
Index: ld/testsuite/ld-nios2/s16_symbol.s
===================================================================
RCS file: ld/testsuite/ld-nios2/s16_symbol.s
diff -N ld/testsuite/ld-nios2/s16_symbol.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/s16_symbol.s	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,10 @@
+.global some_sym
+.global some_other_sym
+.global min
+.global max
+
+.set max, 0x7fff
+.set min, -0x8000
+.set some_sym, 0x1000
+
+
Index: ld/testsuite/ld-nios2/u16.d
===================================================================
RCS file: ld/testsuite/ld-nios2/u16.d
diff -N ld/testsuite/ld-nios2/u16.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/u16.d	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,12 @@
+#name: NIOS2 R_NIOS2_U16
+#source: u16.s
+#source: u16_symbol.s
+#ld:
+#objdump: -s
+
+# Test the unsigned 16-bit relocations.
+.*: +file format elf32-littlenios2
+
+Contents of section .text:
+ [0-9a-f]+ 0c004408 0c004008 ccff7f08 4c004808  ..D...@.....L.H.
+ [0-9a-f]+ 4c004008                             L.@.            
Index: ld/testsuite/ld-nios2/u16.s
===================================================================
RCS file: ld/testsuite/ld-nios2/u16.s
diff -N ld/testsuite/ld-nios2/u16.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/u16.s	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,16 @@
+# Test for Nios II 32-bit, 16 and 8-bit relocations
+
+.set noat
+.set some_other_sym, 0x1000
+.text
+.global _start
+_start:
+# unsigned 16-bit relocation
+	andi r1, r1, some_sym
+	andi r1, r1, min
+	andi r1, r1, max
+	andi r1, r1, some_sym + some_other_sym + 1
+	andi r1, r1, some_sym - some_other_sym + 1
+
+
+
Index: ld/testsuite/ld-nios2/u16_symbol.s
===================================================================
RCS file: ld/testsuite/ld-nios2/u16_symbol.s
diff -N ld/testsuite/ld-nios2/u16_symbol.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-nios2/u16_symbol.s	22 Jan 2013 18:36:38 -0000
@@ -0,0 +1,9 @@
+.global some_sym
+.global min
+.global max
+
+.set max, 0xffff
+.set min, 0
+.set some_sym, 0x1000
+
+

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]