aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2006-03-03 09:32:01 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2006-03-03 09:32:01 +0000
commit4f471f3957423c32c72298899a3e1f96b010d22a (patch)
tree6b9d2237599644d52b4cbd50628afd3762c295a4 /ld
parenta10138943b15cfa070d4526dc8bbec3976e51cdb (diff)
downloadgdb-4f471f3957423c32c72298899a3e1f96b010d22a.zip
gdb-4f471f3957423c32c72298899a3e1f96b010d22a.tar.gz
gdb-4f471f3957423c32c72298899a3e1f96b010d22a.tar.bz2
ld/
* emulparams/vxworks.sh (VXWORKS_BASE_EM_FILE): New variable. (EXTRA_EM_FILE): Define. * emultempl/vxworks.em: New file. * ld.texinfo (--force-dynamic): Document. * Makefile.am (eelf32ppcvxworks.cm, eelf_i386_vxworks.c): Depend on vxworks.em. * Makefile.in: Regenerate. ld/testsuite/ * ld-i386/vxworks1-static.d, ld-i386/vxworks2.s, * ld-i386/vxworks2.sd, ld-i386/vxworks2-static.sd: New tests. * ld-i386/i386.exp: Run them. * ld-powerpc/vxworks1-static.d, ld-powerpc/vxworks2.s, * ld-powerpc/vxworks2.sd, ld-powerpc/vxworks2-static.sd: New tests. * ld-powerpc/powerpc.exp: Run them.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog10
-rw-r--r--ld/Makefile.am5
-rw-r--r--ld/Makefile.in5
-rw-r--r--ld/emulparams/vxworks.sh2
-rw-r--r--ld/emultempl/vxworks.em49
-rw-r--r--ld/ld.texinfo6
-rw-r--r--ld/testsuite/ChangeLog9
-rw-r--r--ld/testsuite/ld-i386/i386.exp16
-rw-r--r--ld/testsuite/ld-i386/vxworks1-static.d4
-rw-r--r--ld/testsuite/ld-i386/vxworks2-static.sd9
-rw-r--r--ld/testsuite/ld-i386/vxworks2.s5
-rw-r--r--ld/testsuite/ld-i386/vxworks2.sd13
-rw-r--r--ld/testsuite/ld-powerpc/powerpc.exp16
-rw-r--r--ld/testsuite/ld-powerpc/vxworks1-static.d4
-rw-r--r--ld/testsuite/ld-powerpc/vxworks2-static.sd9
-rw-r--r--ld/testsuite/ld-powerpc/vxworks2.s5
-rw-r--r--ld/testsuite/ld-powerpc/vxworks2.sd13
17 files changed, 172 insertions, 8 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 7568cd4..8ab52a4 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,13 @@
+2006-03-03 Richard Sandiford <richard@codesourcery.com>
+
+ * emulparams/vxworks.sh (VXWORKS_BASE_EM_FILE): New variable.
+ (EXTRA_EM_FILE): Define.
+ * emultempl/vxworks.em: New file.
+ * ld.texinfo (--force-dynamic): Document.
+ * Makefile.am (eelf32ppcvxworks.cm, eelf_i386_vxworks.c): Depend
+ on vxworks.em.
+ * Makefile.in: Regenerate.
+
2006-03-02 Richard Sandiford <richard@codesourcery.com>
* emulparams/elf32ppccommon.sh: New file, extracted from...
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 9554ab7..9679af0 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -768,7 +768,8 @@ eelf32ppcwindiss.c: $(srcdir)/emulparams/elf32ppcwindiss.sh \
${GENSCRIPTS} elf32ppcwindiss "$(tdir_elf32ppcwindiss)"
eelf32ppcvxworks.c: $(srcdir)/emulparams/elf32ppcvxworks.sh \
$(srcdir)/emulparams/elf32ppccommon.sh $(srcdir)/emulparams/vxworks.sh \
- $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ $(srcdir)/emultempl/vxworks.em $(srcdir)/emultempl/elf32.em \
+ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32ppcvxworks "$(tdir_elf32ppcvxworks)"
eelf32lsmip.c: $(srcdir)/emulparams/elf32lsmip.sh \
$(srcdir)/emulparams/elf32lmip.sh $(srcdir)/emulparams/elf32bmip.sh \
@@ -901,7 +902,7 @@ eelf_i386_ldso.c: $(srcdir)/emulparams/elf_i386_ldso.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf_i386_ldso "$(tdir_elf_i386_ldso)"
eelf_i386_vxworks.c: $(srcdir)/emulparams/elf_i386_vxworks.sh \
- $(srcdir)/emulparams/vxworks.sh \
+ $(srcdir)/emulparams/vxworks.sh $(srcdir)/emultempl/vxworks.em \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf_i386_vxworks "$(tdir_elf_i386_vxworks)"
eelf_s390.c: $(srcdir)/emulparams/elf_s390.sh \
diff --git a/ld/Makefile.in b/ld/Makefile.in
index a1a6f03..264f036 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -1574,7 +1574,8 @@ eelf32ppcwindiss.c: $(srcdir)/emulparams/elf32ppcwindiss.sh \
${GENSCRIPTS} elf32ppcwindiss "$(tdir_elf32ppcwindiss)"
eelf32ppcvxworks.c: $(srcdir)/emulparams/elf32ppcvxworks.sh \
$(srcdir)/emulparams/elf32ppccommon.sh $(srcdir)/emulparams/vxworks.sh \
- $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ $(srcdir)/emultempl/vxworks.em $(srcdir)/emultempl/elf32.em \
+ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32ppcvxworks "$(tdir_elf32ppcvxworks)"
eelf32lsmip.c: $(srcdir)/emulparams/elf32lsmip.sh \
$(srcdir)/emulparams/elf32lmip.sh $(srcdir)/emulparams/elf32bmip.sh \
@@ -1707,7 +1708,7 @@ eelf_i386_ldso.c: $(srcdir)/emulparams/elf_i386_ldso.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf_i386_ldso "$(tdir_elf_i386_ldso)"
eelf_i386_vxworks.c: $(srcdir)/emulparams/elf_i386_vxworks.sh \
- $(srcdir)/emulparams/vxworks.sh \
+ $(srcdir)/emulparams/vxworks.sh $(srcdir)/emultempl/vxworks.em \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf_i386_vxworks "$(tdir_elf_i386_vxworks)"
eelf_s390.c: $(srcdir)/emulparams/elf_s390.sh \
diff --git a/ld/emulparams/vxworks.sh b/ld/emulparams/vxworks.sh
index 0bd00e5..e626732 100644
--- a/ld/emulparams/vxworks.sh
+++ b/ld/emulparams/vxworks.sh
@@ -23,3 +23,5 @@ FINI_END='KEEP (*(.fini$99));
ETEXT_NAME=etext_unrelocated
OTHER_SYMBOLS="PROVIDE (_ehdr = ${TEXT_START_ADDR});"
DATA_END_SYMBOLS=".edata : { PROVIDE (_edata = .); }"
+VXWORKS_BASE_EM_FILE=$EXTRA_EM_FILE
+EXTRA_EM_FILE=vxworks
diff --git a/ld/emultempl/vxworks.em b/ld/emultempl/vxworks.em
new file mode 100644
index 0000000..eafbb58
--- /dev/null
+++ b/ld/emultempl/vxworks.em
@@ -0,0 +1,49 @@
+if test -n "$VXWORKS_BASE_EM_FILE" ; then
+. "${srcdir}/emultempl/${VXWORKS_BASE_EM_FILE}.em"
+fi
+
+cat >>e${EMULATION_NAME}.c <<EOF
+
+static int force_dynamic;
+
+static void
+vxworks_after_open (void)
+{
+ ${LDEMUL_AFTER_OPEN-gld${EMULATION_NAME}_after_open} ();
+
+ if (force_dynamic
+ && link_info.input_bfds
+ && !_bfd_elf_link_create_dynamic_sections (link_info.input_bfds,
+ &link_info))
+ einfo ("%X%P: Cannot create dynamic sections %E\n");
+
+ if (!force_dynamic
+ && !link_info.shared
+ && elf_hash_table (&link_info)->dynamic_sections_created)
+ einfo ("%X%P: Dynamic sections created in non-dynamic link\n");
+}
+
+EOF
+
+PARSE_AND_LIST_PROLOGUE=$PARSE_AND_LIST_PROLOGUE'
+enum {
+ OPTION_FORCE_DYNAMIC = 501
+};
+'
+
+PARSE_AND_LIST_LONGOPTS=$PARSE_AND_LIST_LONGOPTS'
+ {"force-dynamic", no_argument, NULL, OPTION_FORCE_DYNAMIC},
+'
+
+PARSE_AND_LIST_OPTIONS=$PARSE_AND_LIST_OPTIONS'
+ fprintf (file, _("\
+ --force-dynamic Always create dynamic sections\n"));
+'
+
+PARSE_AND_LIST_ARGS_CASES=$PARSE_AND_LIST_ARGS_CASES'
+ case OPTION_FORCE_DYNAMIC:
+ force_dynamic = 1;
+ break;
+'
+
+LDEMUL_AFTER_OPEN=vxworks_after_open
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index d455727..1e3b3e8 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -772,6 +772,12 @@ in larger executables.
This option is currently only supported on ELF platforms.
+@kindex --force-dynamic
+@cindex forcing the creation of dynamic sections
+@item --force-dynamic
+Force the output file to have dynamic sections. This option is specific
+to VxWorks targets.
+
@cindex partial link
@cindex relocatable output
@kindex -r
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 1e5b950..a8e2d96 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2006-03-03 Richard Sandiford <richard@codesourcery.com>
+
+ * ld-i386/vxworks1-static.d, ld-i386/vxworks2.s,
+ * ld-i386/vxworks2.sd, ld-i386/vxworks2-static.sd: New tests.
+ * ld-i386/i386.exp: Run them.
+ * ld-powerpc/vxworks1-static.d, ld-powerpc/vxworks2.s,
+ * ld-powerpc/vxworks2.sd, ld-powerpc/vxworks2-static.sd: New tests.
+ * ld-powerpc/powerpc.exp: Run them.
+
2006-03-02 Richard Sandiford <richard@codesourcery.com>
* ld-powerpc/vxworks1.ld: Use a page alignment of 0x10000.
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index b0195ca..ad8a610 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -26,12 +26,24 @@ if {[istarget "i?86-*-vxworks"]} {
{{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}
{readelf --symbols vxworks1-lib.nd}}
"libvxworks1.so"}
- {"VxWorks dynamic executable test 1" \
- "tmpdir/libvxworks1.so -Tvxworks1.ld -q" "" {vxworks1.s}
+ {"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 $i386tests
+ run_dump_test "vxworks1-static"
}
if { !([istarget "i?86-*-elf*"]
diff --git a/ld/testsuite/ld-i386/vxworks1-static.d b/ld/testsuite/ld-i386/vxworks1-static.d
new file mode 100644
index 0000000..88c0baf
--- /dev/null
+++ b/ld/testsuite/ld-i386/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-i386/vxworks2-static.sd b/ld/testsuite/ld-i386/vxworks2-static.sd
new file mode 100644
index 0000000..912755b
--- /dev/null
+++ b/ld/testsuite/ld-i386/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 0x1000
+
+#...
diff --git a/ld/testsuite/ld-i386/vxworks2.s b/ld/testsuite/ld-i386/vxworks2.s
new file mode 100644
index 0000000..28c8acb
--- /dev/null
+++ b/ld/testsuite/ld-i386/vxworks2.s
@@ -0,0 +1,5 @@
+ .globl _start
+ .type _start,@function
+_start:
+ ret
+ .end _start
diff --git a/ld/testsuite/ld-i386/vxworks2.sd b/ld/testsuite/ld-i386/vxworks2.sd
new file mode 100644
index 0000000..5ff87d3
--- /dev/null
+++ b/ld/testsuite/ld-i386/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 0x1000
+ LOAD .* 0x00081000 0x00081000 .* RW 0x1000
+ DYNAMIC .*
+
+#...
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index db7fe59..681bb6e 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -31,12 +31,24 @@ if {[istarget "*-*-vxworks"]} {
{{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}
{readelf --symbols vxworks1-lib.nd}}
"libvxworks1.so"}
- {"VxWorks dynamic executable test 1" \
- "tmpdir/libvxworks1.so -Tvxworks1.ld -q" "-mregnames" {vxworks1.s}
+ {"VxWorks executable test 1 (dynamic)" \
+ "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic"
+ "-mregnames" {vxworks1.s}
{{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
"vxworks1"}
+ {"VxWorks executable test 2 (dynamic)" \
+ "-Tvxworks1.ld -q --force-dynamic"
+ "-mregnames" {vxworks2.s}
+ {{readelf --segments vxworks2.sd}}
+ "vxworks2"}
+ {"VxWorks executable test 2 (static)"
+ "-Tvxworks1.ld"
+ "-mregnames" {vxworks2.s}
+ {{readelf --segments vxworks2-static.sd}}
+ "vxworks2"}
}
run_ld_link_tests $ppcvxtests
+ run_dump_test "vxworks1-static"
return
}
diff --git a/ld/testsuite/ld-powerpc/vxworks1-static.d b/ld/testsuite/ld-powerpc/vxworks1-static.d
new file mode 100644
index 0000000..4c2d1fd
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/vxworks1-static.d
@@ -0,0 +1,4 @@
+#name: VxWorks executable test 1 (static)
+#source: vxworks1.s -mregnames
+#ld: tmpdir/libvxworks1.so -Tvxworks1.ld
+#error: Dynamic sections created in non-dynamic link
diff --git a/ld/testsuite/ld-powerpc/vxworks2-static.sd b/ld/testsuite/ld-powerpc/vxworks2-static.sd
new file mode 100644
index 0000000..55fc529
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/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-powerpc/vxworks2.s b/ld/testsuite/ld-powerpc/vxworks2.s
new file mode 100644
index 0000000..5e8d73a
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/vxworks2.s
@@ -0,0 +1,5 @@
+ .globl _start
+ .type _start,@function
+_start:
+ blr
+ .end _start
diff --git a/ld/testsuite/ld-powerpc/vxworks2.sd b/ld/testsuite/ld-powerpc/vxworks2.sd
new file mode 100644
index 0000000..0876568
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/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 .*
+
+#...