aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog9
-rw-r--r--ld/Makefile.am6
-rw-r--r--ld/Makefile.in6
-rw-r--r--ld/configure.tgt1
-rw-r--r--ld/emulparams/elf32_sparc_vxworks.sh4
-rw-r--r--ld/testsuite/ChangeLog9
-rw-r--r--ld/testsuite/ld-sparc/sparc.exp27
-rw-r--r--ld/testsuite/ld-sparc/vxworks1-lib.dd45
-rw-r--r--ld/testsuite/ld-sparc/vxworks1-lib.nd9
-rw-r--r--ld/testsuite/ld-sparc/vxworks1-lib.rd12
-rw-r--r--ld/testsuite/ld-sparc/vxworks1-lib.s44
-rw-r--r--ld/testsuite/ld-sparc/vxworks1-static.d4
-rw-r--r--ld/testsuite/ld-sparc/vxworks1.dd52
-rw-r--r--ld/testsuite/ld-sparc/vxworks1.ld30
-rw-r--r--ld/testsuite/ld-sparc/vxworks1.rd22
-rw-r--r--ld/testsuite/ld-sparc/vxworks1.s25
-rw-r--r--ld/testsuite/ld-sparc/vxworks2-static.sd9
-rw-r--r--ld/testsuite/ld-sparc/vxworks2.s6
-rw-r--r--ld/testsuite/ld-sparc/vxworks2.sd13
19 files changed, 333 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 690298e..7ce60d9 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,12 @@
+2006-04-05 Richard Sandiford <richard@codesourcery.com>
+ Daniel Jacobowitz <dan@codesourcery.com>
+
+ * configure.tgt (sparc*-*-vxworks*): New stanza.
+ * emulparams/elf32_sparc_vxworks.sh: New file.
+ * Makefile.am (ALL_EMULATIONS): Add eelf32_sparc_vxworks.o.
+ (eelf32_sparc_vxworks.c): New rule.
+ * Makefile.in: Regenerate.
+
2006-04-04 Eric Botcazou <ebotcazou@adacore.com>
* ldlang.c (lang_map): Print the list of discarded input sections.
diff --git a/ld/Makefile.am b/ld/Makefile.am
index fea8955..758dc7e 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -147,6 +147,7 @@ ALL_EMULATIONS = \
eelf32_i960.o \
eelf32_i860.o \
eelf32_sparc.o \
+ eelf32_sparc_vxworks.o \
eelf32b4300.o \
eelf32bfin.o \
eelf32bfinfd.o \
@@ -687,6 +688,11 @@ em32rlelf_linux.c: $(srcdir)/emulparams/m32rlelf_linux.sh \
eelf32_sparc.c: $(srcdir)/emulparams/elf32_sparc.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32_sparc "$(tdir_elf32_sparc)"
+eelf32_sparc_vxworks.c: $(srcdir)/emulparams/elf32_sparc_vxworks.sh \
+ $(srcdir)/emulparams/vxworks.sh $(srcdir)/emulparams/elf32_sparc.sh \
+ $(srcdir)/emultempl/vxworks.em $(srcdir)/emultempl/elf32.em \
+ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32_sparc_vxworks "$(tdir_elf32_sparc_vxworks)"
eelf32_i860.c: $(srcdir)/emulparams/elf32_i860.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32_i860 "$(tdir_elf32_i860)"
diff --git a/ld/Makefile.in b/ld/Makefile.in
index c3716c0..4564a8b 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -370,6 +370,7 @@ ALL_EMULATIONS = \
eelf32_i960.o \
eelf32_i860.o \
eelf32_sparc.o \
+ eelf32_sparc_vxworks.o \
eelf32b4300.o \
eelf32bfin.o \
eelf32bfinfd.o \
@@ -1493,6 +1494,11 @@ em32rlelf_linux.c: $(srcdir)/emulparams/m32rlelf_linux.sh \
eelf32_sparc.c: $(srcdir)/emulparams/elf32_sparc.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32_sparc "$(tdir_elf32_sparc)"
+eelf32_sparc_vxworks.c: $(srcdir)/emulparams/elf32_sparc_vxworks.sh \
+ $(srcdir)/emulparams/vxworks.sh $(srcdir)/emulparams/elf32_sparc.sh \
+ $(srcdir)/emultempl/vxworks.em $(srcdir)/emultempl/elf32.em \
+ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32_sparc_vxworks "$(tdir_elf32_sparc_vxworks)"
eelf32_i860.c: $(srcdir)/emulparams/elf32_i860.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32_i860 "$(tdir_elf32_i860)"
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 8504c9b..d324e4e 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -494,6 +494,7 @@ sparc*-*-aout) targ_emul=sparcaout ;;
sparc*-*-coff) targ_emul=coff_sparc ;;
sparc*-*-elf) targ_emul=elf32_sparc ;;
sparc*-*-sysv4*) targ_emul=elf32_sparc ;;
+sparc*-*-vxworks*) targ_emul=elf32_sparc_vxworks ;;
sparc64-*-freebsd* | sparcv9-*-freebsd* | sparc64-*-kfreebsd*-gnu | sparcv9-*-kfreebsd*-gnu)
targ_emul=elf64_sparc_fbsd
targ_extra_emuls="elf64_sparc elf32_sparc"
diff --git a/ld/emulparams/elf32_sparc_vxworks.sh b/ld/emulparams/elf32_sparc_vxworks.sh
new file mode 100644
index 0000000..12a9b38
--- /dev/null
+++ b/ld/emulparams/elf32_sparc_vxworks.sh
@@ -0,0 +1,4 @@
+. ${srcdir}/emulparams/elf32_sparc.sh
+OUTPUT_FORMAT="elf32-sparc-vxworks"
+unset DATA_PLT
+. ${srcdir}/emulparams/vxworks.sh
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 7893575..b851e59 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2006-04-05 Richard Sandiford <richard@codesourcery.com>
+
+ * ld-sparc/vxworks1.dd, ld-sparc/vxworks1.ld, ld-sparc/vxworks1-lib.dd,
+ * ld-sparc/vxworks1-lib.nd, ld-sparc/vxworks1-lib.rd,
+ * ld-sparc/vxworks1-lib.s, ld-sparc/vxworks1.rd, ld-sparc/vxworks1.s,
+ * ld-sparc/vxworks1-static.d, ld-sparc/vxworks2.s,
+ * ld-sparc/vxworks2.sd, ld-sparc/vxworks2-static.sd: New tests.
+ * ld-sparc/sparc.exp: Run them.
+
2006-04-05 Ben Elliston <bje@au.ibm.com>
* lib/ld-lib.exp: Comment cleanups.
diff --git a/ld/testsuite/ld-sparc/sparc.exp b/ld/testsuite/ld-sparc/sparc.exp
index aa4c869..6e7e95c 100644
--- a/ld/testsuite/ld-sparc/sparc.exp
+++ b/ld/testsuite/ld-sparc/sparc.exp
@@ -19,6 +19,33 @@
# Test SPARC linking; all types of relocs. This tests the assembler and
# tools like objdump as well as the linker.
+if {[istarget "sparc-*-vxworks"]} {
+ set sparcvxworkstests {
+ {"VxWorks shared library test 1" "-shared -Tvxworks1.ld"
+ "-KPIC" {vxworks1-lib.s}
+ {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}
+ {readelf --symbols vxworks1-lib.nd}}
+ "libvxworks1.so"}
+ {"VxWorks executable test 1 (dynamic)" \
+ "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic"
+ "" {vxworks1.s}
+ {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
+ "vxworks1"}
+ {"VxWorks executable test 2 (dynamic)" \
+ "-Tvxworks1.ld -q --force-dynamic"
+ "" {vxworks2.s}
+ {{readelf --segments vxworks2.sd}}
+ "vxworks2"}
+ {"VxWorks executable test 2 (static)"
+ "-Tvxworks1.ld"
+ "" {vxworks2.s}
+ {{readelf --segments vxworks2-static.sd}}
+ "vxworks2"}
+ }
+ run_ld_link_tests $sparcvxworkstests
+ run_dump_test "vxworks1-static"
+}
+
if { !([istarget "sparc*-*-elf*"]
|| [istarget "sparc*-sun-solaris*"]
|| ([istarget "sparc*-*-linux*"]
diff --git a/ld/testsuite/ld-sparc/vxworks1-lib.dd b/ld/testsuite/ld-sparc/vxworks1-lib.dd
new file mode 100644
index 0000000..49dab7b
--- /dev/null
+++ b/ld/testsuite/ld-sparc/vxworks1-lib.dd
@@ -0,0 +1,45 @@
+
+.*: file format .*
+
+Disassembly of section \.plt:
+
+00080800 <_PROCEDURE_LINKAGE_TABLE_>:
+ 80800: c4 05 e0 08 ld \[ %l7 \+ 8 \], %g2
+ 80804: 81 c0 80 00 jmp %g2
+ 80808: 01 00 00 00 nop
+ 8080c: 03 00 00 00 sethi %hi\(0\), %g1
+ 80810: 82 10 60 0c or %g1, 0xc, %g1 ! c <_PROCEDURE_LINKAGE_TABLE_-0x807f4>
+ 80814: c2 05 c0 01 ld \[ %l7 \+ %g1 \], %g1
+ 80818: 81 c0 40 00 jmp %g1
+ 8081c: 01 00 00 00 nop
+ 80820: 03 00 00 00 sethi %hi\(0\), %g1
+ 80824: 10 bf ff f7 b 80800 <_PROCEDURE_LINKAGE_TABLE_>
+ 80828: 82 10 60 00 mov %g1, %g1 ! 0 <_PROCEDURE_LINKAGE_TABLE_-0x80800>
+Disassembly of section \.text:
+
+00080c00 <foo>:
+ 80c00: 9d e3 bf 98 save %sp, -104, %sp
+ 80c04: 2f 00 00 00 sethi %hi\(0\), %l7
+ 80c08: ee 05 e0 00 ld \[ %l7 \], %l7
+ 80c0c: ee 05 e0 00 ld \[ %l7 \], %l7
+ 80c10: 03 00 00 00 sethi %hi\(0\), %g1
+ 80c14: 82 10 60 10 or %g1, 0x10, %g1 ! 10 <_PROCEDURE_LINKAGE_TABLE_-0x807f0>
+ 80c18: c2 05 c0 01 ld \[ %l7 \+ %g1 \], %g1
+ 80c1c: c4 00 40 00 ld \[ %g1 \], %g2
+ 80c20: 84 00 a0 01 inc %g2
+ 80c24: 40 00 00 08 call 80c44 <slocal>
+ 80c28: c4 20 40 00 st %g2, \[ %g1 \]
+ 80c2c: 7f ff fe f8 call 8080c <_PROCEDURE_LINKAGE_TABLE_\+0xc>
+ 80c30: 01 00 00 00 nop
+ 80c34: 7f ff fe f6 call 8080c <_PROCEDURE_LINKAGE_TABLE_\+0xc>
+ 80c38: 01 00 00 00 nop
+ 80c3c: 81 c7 e0 08 ret
+ 80c40: 81 e8 00 00 restore
+
+00080c44 <slocal>:
+ 80c44: 81 c3 e0 08 retl
+ 80c48: 01 00 00 00 nop
+
+00080c4c <sglobal>:
+ 80c4c: 81 c3 e0 08 retl
+ 80c50: 01 00 00 00 nop
diff --git a/ld/testsuite/ld-sparc/vxworks1-lib.nd b/ld/testsuite/ld-sparc/vxworks1-lib.nd
new file mode 100644
index 0000000..cbc1c8c
--- /dev/null
+++ b/ld/testsuite/ld-sparc/vxworks1-lib.nd
@@ -0,0 +1,9 @@
+#...
+Symbol table '\.dynsym' .*:
+#...
+.*: 00090400 * 0 * OBJECT * GLOBAL * DEFAULT * [0-9]+ _GLOBAL_OFFSET_TABLE_
+#...
+Symbol table '\.symtab' .*:
+#...
+.*: 00090400 * 0 * OBJECT * GLOBAL * DEFAULT * [0-9]+ _GLOBAL_OFFSET_TABLE_
+#pass
diff --git a/ld/testsuite/ld-sparc/vxworks1-lib.rd b/ld/testsuite/ld-sparc/vxworks1-lib.rd
new file mode 100644
index 0000000..1390e78
--- /dev/null
+++ b/ld/testsuite/ld-sparc/vxworks1-lib.rd
@@ -0,0 +1,12 @@
+
+Relocation section '\.rela\.plt' at offset .* contains 1 entries:
+ Offset Info Type Sym\.Value Sym\. Name \+ Addend
+0009040c .*15 R_SPARC_JMP_SLOT 00000000 sexternal \+ 0
+
+Relocation section '\.rela\.dyn' at offset .* contains 5 entries:
+ Offset Info Type Sym\.Value Sym\. Name \+ Addend
+00090c00 00000016 R_SPARC_RELATIVE 00080c44
+00080c04 .*09 R_SPARC_HI22 00000000 __GOTT_BASE__ \+ 0
+00080c08 .*0c R_SPARC_LO10 00000000 __GOTT_BASE__ \+ 0
+00080c0c .*0c R_SPARC_LO10 00000000 __GOTT_INDEX__ \+ 0
+00090410 .*14 R_SPARC_GLOB_DAT 00090800 x \+ 0
diff --git a/ld/testsuite/ld-sparc/vxworks1-lib.s b/ld/testsuite/ld-sparc/vxworks1-lib.s
new file mode 100644
index 0000000..e1221a2
--- /dev/null
+++ b/ld/testsuite/ld-sparc/vxworks1-lib.s
@@ -0,0 +1,44 @@
+ .text
+ .globl foo
+ .type foo, %function
+foo:
+ save %sp, -104, %sp
+ sethi %hi(__GOTT_BASE__), %l7
+ ld [%l7+%lo(__GOTT_BASE__)],%l7
+ ld [%l7+%lo(__GOTT_INDEX__)],%l7
+ sethi %hi(x), %g1
+ or %g1, %lo(x), %g1
+ ld [%l7+%g1], %g1
+ ld [%g1], %g2
+ add %g2, 1, %g2
+
+ call slocal, 0
+ st %g2, [%g1]
+
+ call sexternal, 0
+ nop
+
+ call sexternal, 0
+ nop
+
+ ret
+ restore
+ .size foo, .-foo
+
+ .type slocal, %function
+slocal:
+ retl
+ nop
+ .size slocal, .-slocal
+
+ .globl sglobal
+ .type sglobal, %function
+sglobal:
+ retl
+ nop
+ .size sglobal, .-sglobal
+
+ .data
+ .4byte slocal
+
+ .comm x,4,4
diff --git a/ld/testsuite/ld-sparc/vxworks1-static.d b/ld/testsuite/ld-sparc/vxworks1-static.d
new file mode 100644
index 0000000..88c0baf
--- /dev/null
+++ b/ld/testsuite/ld-sparc/vxworks1-static.d
@@ -0,0 +1,4 @@
+#name: VxWorks executable test 1 (static)
+#source: vxworks1.s
+#ld: tmpdir/libvxworks1.so -Tvxworks1.ld
+#error: Dynamic sections created in non-dynamic link
diff --git a/ld/testsuite/ld-sparc/vxworks1.dd b/ld/testsuite/ld-sparc/vxworks1.dd
new file mode 100644
index 0000000..16e72fd
--- /dev/null
+++ b/ld/testsuite/ld-sparc/vxworks1.dd
@@ -0,0 +1,52 @@
+
+.*: file format .*
+
+Disassembly of section \.plt:
+
+00080800 <_PROCEDURE_LINKAGE_TABLE_>:
+ 80800: 05 00 02 41 sethi %hi\(0x90400\), %g2
+ 80800: R_SPARC_HI22 _GLOBAL_OFFSET_TABLE_\+0x8
+ 80804: 84 10 a0 08 or %g2, 8, %g2 ! 90408 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ 80804: R_SPARC_LO10 _GLOBAL_OFFSET_TABLE_\+0x8
+ 80808: c4 00 80 00 ld \[ %g2 \], %g2
+ 8080c: 81 c0 80 00 jmp %g2
+ 80810: 01 00 00 00 nop
+ 80814: 03 00 02 41 sethi %hi\(0x90400\), %g1
+ 80814: R_SPARC_HI22 _GLOBAL_OFFSET_TABLE_\+0xc
+ 80818: 82 10 60 0c or %g1, 0xc, %g1 ! 9040c <sglobal@plt>
+ 80818: R_SPARC_LO10 _GLOBAL_OFFSET_TABLE_\+0xc
+ 8081c: c2 00 40 00 ld \[ %g1 \], %g1
+ 80820: 81 c0 40 00 jmp %g1
+ 80824: 01 00 00 00 nop
+ 80828: 03 00 00 00 sethi %hi\(0\), %g1
+ 8082c: 10 bf ff f5 b 80800 <_PROCEDURE_LINKAGE_TABLE_>
+ 80830: 82 10 60 00 mov %g1, %g1 ! 0 <_PROCEDURE_LINKAGE_TABLE_-0x80800>
+ 80834: 03 00 02 41 sethi %hi\(0x90400\), %g1
+ 80834: R_SPARC_HI22 _GLOBAL_OFFSET_TABLE_\+0x10
+ 80838: 82 10 60 10 or %g1, 0x10, %g1 ! 90410 <foo@plt>
+ 80838: R_SPARC_LO10 _GLOBAL_OFFSET_TABLE_\+0x10
+ 8083c: c2 00 40 00 ld \[ %g1 \], %g1
+ 80840: 81 c0 40 00 jmp %g1
+ 80844: 01 00 00 00 nop
+ 80848: 03 00 00 00 sethi %hi\(0\), %g1
+ 8084c: 10 bf ff ed b 80800 <_PROCEDURE_LINKAGE_TABLE_>
+ 80850: 82 10 60 01 or %g1, 1, %g1 ! 1 <_PROCEDURE_LINKAGE_TABLE_-0x807ff>
+Disassembly of section \.text:
+
+00080c00 <_start>:
+ 80c00: 9d e3 bf 98 save %sp, -104, %sp
+ 80c04: 7f ff ff 0c call 80834 <_PROCEDURE_LINKAGE_TABLE_\+0x34>
+ 80c04: R_SPARC_WDISP30 \.plt\+0x34
+ 80c08: 01 00 00 00 nop
+ 80c0c: 40 00 00 06 call 80c24 <sexternal>
+ 80c0c: R_SPARC_WDISP30 sexternal
+ 80c10: 01 00 00 00 nop
+ 80c14: 7f ff ff 00 call 80814 <_PROCEDURE_LINKAGE_TABLE_\+0x14>
+ 80c14: R_SPARC_WDISP30 \.plt\+0x14
+ 80c18: 01 00 00 00 nop
+ 80c1c: 81 c7 e0 08 ret
+ 80c20: 81 e8 00 00 restore
+
+00080c24 <sexternal>:
+ 80c24: 81 c3 e0 08 retl
+ 80c28: 01 00 00 00 nop
diff --git a/ld/testsuite/ld-sparc/vxworks1.ld b/ld/testsuite/ld-sparc/vxworks1.ld
new file mode 100644
index 0000000..979d773
--- /dev/null
+++ b/ld/testsuite/ld-sparc/vxworks1.ld
@@ -0,0 +1,30 @@
+SECTIONS
+{
+ . = 0x80000;
+ .interp : { *(.interp) }
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+
+ . = ALIGN (0x400);
+ .rela.dyn : { *(.rela.dyn) }
+ .rela.plt : { *(.rela.plt) }
+
+ . = ALIGN (0x400);
+ .plt : { *(.plt) }
+
+ . = ALIGN (0x400);
+ .text : { *(.text) }
+
+ . = ALIGN (0x10000);
+ .dynamic : { *(.dynamic) }
+
+ . = ALIGN (0x400);
+ .got : { *(.got.plt) *(.got) }
+
+ . = ALIGN (0x400);
+ .bss : { *(.bss) }
+
+ . = ALIGN (0x400);
+ .data : { *(.data) }
+}
diff --git a/ld/testsuite/ld-sparc/vxworks1.rd b/ld/testsuite/ld-sparc/vxworks1.rd
new file mode 100644
index 0000000..e02146b
--- /dev/null
+++ b/ld/testsuite/ld-sparc/vxworks1.rd
@@ -0,0 +1,22 @@
+
+Relocation section '\.rela\.plt' at offset .* contains 2 entries:
+ Offset Info Type Sym\.Value Sym\. Name \+ Addend
+0009040c .*15 R_SPARC_JMP_SLOT 00080814 sglobal \+ 0
+00090410 .*15 R_SPARC_JMP_SLOT 00080834 foo \+ 0
+
+Relocation section '\.rela\.text' at offset .* contains 3 entries:
+ Offset Info Type Sym\.Value Sym\. Name \+ Addend
+00080c04 .*07 R_SPARC_WDISP30 00080800 \.plt \+ 34
+00080c0c .*07 R_SPARC_WDISP30 00080c24 sexternal \+ 0
+00080c14 .*07 R_SPARC_WDISP30 00080800 \.plt \+ 14
+
+Relocation section '\.rela\.plt\.unloaded' at offset .* contains 8 entries:
+ Offset Info Type Sym\.Value Sym\. Name \+ Addend
+00080800 .*09 R_SPARC_HI22 00090400 _GLOBAL_OFFSET_TABLE_ \+ 8
+00080804 .*0c R_SPARC_LO10 00090400 _GLOBAL_OFFSET_TABLE_ \+ 8
+00080814 .*09 R_SPARC_HI22 00090400 _GLOBAL_OFFSET_TABLE_ \+ c
+00080818 .*0c R_SPARC_LO10 00090400 _GLOBAL_OFFSET_TABLE_ \+ c
+0009040c .*03 R_SPARC_32 00080800 _PROCEDURE_LINKAGE_TAB.* \+ 28
+00080834 .*09 R_SPARC_HI22 00090400 _GLOBAL_OFFSET_TABLE_ \+ 10
+00080838 .*0c R_SPARC_LO10 00090400 _GLOBAL_OFFSET_TABLE_ \+ 10
+00090410 .*03 R_SPARC_32 00080800 _PROCEDURE_LINKAGE_TAB.* \+ 48
diff --git a/ld/testsuite/ld-sparc/vxworks1.s b/ld/testsuite/ld-sparc/vxworks1.s
new file mode 100644
index 0000000..82106c8
--- /dev/null
+++ b/ld/testsuite/ld-sparc/vxworks1.s
@@ -0,0 +1,25 @@
+ .text
+ .globl _start
+ .type _start, %function
+_start:
+ save %sp, -104, %sp
+
+ call foo, 0
+ nop
+
+ call sexternal, 0
+ nop
+
+ call sglobal, 0
+ nop
+
+ ret
+ restore
+ .size _start, .-_start
+
+ .globl sexternal
+ .type sexternal, %function
+sexternal:
+ retl
+ nop
+ .size sexternal, .-sexternal
diff --git a/ld/testsuite/ld-sparc/vxworks2-static.sd b/ld/testsuite/ld-sparc/vxworks2-static.sd
new file mode 100644
index 0000000..55fc529
--- /dev/null
+++ b/ld/testsuite/ld-sparc/vxworks2-static.sd
@@ -0,0 +1,9 @@
+#...
+Elf file type is EXEC \(Executable file\)
+Entry point 0x80000
+#...
+Program Headers:
+ Type .*
+ LOAD .* 0x00080000 0x00080000 .* R E 0x10000
+
+#...
diff --git a/ld/testsuite/ld-sparc/vxworks2.s b/ld/testsuite/ld-sparc/vxworks2.s
new file mode 100644
index 0000000..0a883a9
--- /dev/null
+++ b/ld/testsuite/ld-sparc/vxworks2.s
@@ -0,0 +1,6 @@
+ .globl _start
+ .type _start, %function
+_start:
+ retl
+ nop
+ .end _start
diff --git a/ld/testsuite/ld-sparc/vxworks2.sd b/ld/testsuite/ld-sparc/vxworks2.sd
new file mode 100644
index 0000000..0876568
--- /dev/null
+++ b/ld/testsuite/ld-sparc/vxworks2.sd
@@ -0,0 +1,13 @@
+#...
+Elf file type is EXEC \(Executable file\)
+Entry point 0x80400
+#...
+Program Headers:
+ Type .*
+ PHDR .*
+#...
+ LOAD .* 0x00080000 0x00080000 .* R E 0x10000
+ LOAD .* 0x00090000 0x00090000 .* RW 0x10000
+ DYNAMIC .*
+
+#...