summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.asm
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.asm')
-rw-r--r--gdb/testsuite/gdb.asm/asm-source.exp36
-rw-r--r--gdb/testsuite/gdb.asm/asmsrc1.s2
-rw-r--r--gdb/testsuite/gdb.asm/empty.inc1
-rw-r--r--gdb/testsuite/gdb.asm/frv.inc54
-rw-r--r--gdb/testsuite/gdb.asm/mips.inc2
-rw-r--r--gdb/testsuite/gdb.asm/netbsd.inc12
6 files changed, 92 insertions, 15 deletions
diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
index 8b0df38f3f1..e41bfec1a4d 100644
--- a/gdb/testsuite/gdb.asm/asm-source.exp
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -32,8 +32,9 @@ set prms_id 0
set bug_id 0
set asm-arch ""
+set asm-note "empty"
set asm-flags ""
-set link-flags ""
+set link-flags "--entry _start"
switch -glob -- [istarget] {
"alpha*-*-*" {
@@ -51,6 +52,9 @@ switch -glob -- [istarget] {
"d10v-*-*" {
set asm-arch d10v
}
+ "frv-*-*" {
+ set asm-arch frv
+ }
"s390-*-*" {
set asm-arch s390
}
@@ -63,13 +67,10 @@ switch -glob -- [istarget] {
}
"i\[3456\]86-*-*" {
set asm-arch i386
- if [istarget "*-*-cygwin*"] then {
- set link-flags "--entry _start"
- }
}
"m32r*-*" {
set asm-arch m32r
- set link-flags "-Wl,--whole-archive -lgloss -Wl,--no-whole-archive"
+ append link-flags " -Wl,--whole-archive -lgloss -Wl,--no-whole-archive"
}
"m6811-*-*" {
set asm-arch m68hc11
@@ -88,7 +89,6 @@ switch -glob -- [istarget] {
"sh*-*-*" {
set asm-arch sh
set asm-flags "-gdwarf2 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
- set link-flags "--entry _start"
}
"sparc-*-*" {
set asm-arch sparc
@@ -118,13 +118,20 @@ if { "${asm-arch}" == "" } {
gdb_suppress_entire_file "Assembly source test -- not implemented for this target."
}
-# On FreeBSD, crt1.o the final link will fail because of unresolved
-# symbols. It turns out that libc.so references symbols that are
-# normally provided by crt1.o, which isn't linked in since we specify
-# -nostartfiles. Using -nostdlib doesn't help since target_compile
-# automatically adds -lm. Linking statically avoids this mess.
-if [istarget "*-*-freebsd*"] then {
- set link-flags "-static"
+# On FreeBSD and NetBSD, crt1.o the final link will fail because of
+# unresolved symbols. It turns out that libc.so references symbols
+# that are normally provided by crt1.o, which isn't linked in since we
+# specify -nostartfiles. Using -nostdlib doesn't help since
+# target_compile automatically adds -lm. Linking statically avoids
+# this mess.
+if {[istarget "*-*-freebsd*"] || [istarget "*-*-netbsd*"]} then {
+ append link-flags " -static"
+}
+
+# On NetBSD/ELF we need a special NetBSD-identifying note section.
+if { [istarget "*-*-netbsdelf*"]
+ || [istarget "x86_64-*-netbsd*"] } then {
+ set asm-note "netbsd"
}
# Watch out, we are invoking the assembler, but the testsuite sets multilib
@@ -149,6 +156,8 @@ set srcfile2 asmsrc2.s
remote_exec build "rm -f ${subdir}/arch.inc"
remote_download host ${srcdir}/${subdir}/${asm-arch}.inc ${subdir}/arch.inc
+remote_exec build "rm -f ${subdir}/note.inc"
+remote_download host ${srcdir}/${subdir}/${asm-note}.inc ${subdir}/note.inc
if { "${asm-flags}" == "" } {
#set asm-flags "-Wa,-gstabs,-I${srcdir}/${subdir},-I${objdir}/${subdir}"
@@ -362,3 +371,4 @@ gdb_test "disassem foostatic" ".*<foostatic\\+0>:.*End of assembler dump." \
"look at static function"
remote_exec build "rm -f ${subdir}/arch.inc"
+remote_exec build "rm -f ${subdir}/note.inc"
diff --git a/gdb/testsuite/gdb.asm/asmsrc1.s b/gdb/testsuite/gdb.asm/asmsrc1.s
index cba0e90ec2a..48bfb86d419 100644
--- a/gdb/testsuite/gdb.asm/asmsrc1.s
+++ b/gdb/testsuite/gdb.asm/asmsrc1.s
@@ -65,3 +65,5 @@ gdbasm_datavar globalvar 11
comment "A static variable"
gdbasm_datavar staticvar 5
+
+ .include "note.inc"
diff --git a/gdb/testsuite/gdb.asm/empty.inc b/gdb/testsuite/gdb.asm/empty.inc
new file mode 100644
index 00000000000..e786488d9f2
--- /dev/null
+++ b/gdb/testsuite/gdb.asm/empty.inc
@@ -0,0 +1 @@
+ comment "empty"
diff --git a/gdb/testsuite/gdb.asm/frv.inc b/gdb/testsuite/gdb.asm/frv.inc
new file mode 100644
index 00000000000..e8f3b8ff1f3
--- /dev/null
+++ b/gdb/testsuite/gdb.asm/frv.inc
@@ -0,0 +1,54 @@
+ comment "subroutine prologue"
+ .macro gdbasm_enter
+ addi sp,#-16,sp
+ sti fp, @(sp,0)
+ mov sp, fp
+ movsg lr, gr5
+ sti gr5, @(fp,8)
+ .endm
+
+ comment "subroutine epilogue"
+ .macro gdbasm_leave
+ ldi @(fp,8), gr5
+ ld @(fp,gr0), fp
+ addi sp,#16,sp
+ jmpl @(gr5,gr0)
+ .endm
+
+ .macro gdbasm_call subr
+ call \subr
+ .endm
+
+ .macro gdbasm_several_nops
+ nop
+ nop
+ nop
+ nop
+ .endm
+
+ comment "exit (0)"
+ .macro gdbasm_exit0
+ comment "Don't know how to exit, but this will certainly halt..."
+ ldi @(gr0,0), gr5
+ .endm
+
+ comment "crt0 startup"
+ .macro gdbasm_startup
+ call .Lcall
+.Lcall: movsg lr, gr4
+ sethi #gprelhi(.Lcall), gr5
+ setlo #gprello(.Lcall), gr5
+ sub gr4, gr5, gr16
+
+ sethi #gprelhi(_stack), sp
+ setlo #gprello(_stack), sp
+ setlos #0, fp
+ add sp, gr16, sp
+ .endm
+
+ comment "Declare a data variable"
+ .macro gdbasm_datavar name value
+ .data
+\name:
+ .long \value
+ .endm
diff --git a/gdb/testsuite/gdb.asm/mips.inc b/gdb/testsuite/gdb.asm/mips.inc
index 751f73f859b..a0992bb530f 100644
--- a/gdb/testsuite/gdb.asm/mips.inc
+++ b/gdb/testsuite/gdb.asm/mips.inc
@@ -58,7 +58,5 @@
comment "crt0 startup"
.macro gdbasm_startup
- .global __start
-__start:
move $fp, $sp
.endm
diff --git a/gdb/testsuite/gdb.asm/netbsd.inc b/gdb/testsuite/gdb.asm/netbsd.inc
new file mode 100644
index 00000000000..9446966c334
--- /dev/null
+++ b/gdb/testsuite/gdb.asm/netbsd.inc
@@ -0,0 +1,12 @@
+ comment "netbsd .note"
+
+.section ".note.netbsd.ident", "a"
+ .p2align 2
+
+ .long 7
+ .long 4
+ .long 1
+ .ascii "NetBSD\0\0"
+ .long 105010000
+
+ .p2align 2