aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2007-03-01 16:39:42 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2007-03-01 16:39:42 +0000
commitd3e52d400ebf3840199b62eaafa92954110dc4fa (patch)
tree7f4378331536c4e5e2ad822afd989d2cf101f111 /ld
parent336becc77940136f16d65d66361397d6c4556293 (diff)
downloadgdb-d3e52d400ebf3840199b62eaafa92954110dc4fa.zip
gdb-d3e52d400ebf3840199b62eaafa92954110dc4fa.tar.gz
gdb-d3e52d400ebf3840199b62eaafa92954110dc4fa.tar.bz2
binutils/
200x-xx-xx Phil Edwards <phil@codesourcery.com> Richard Sandiford <richard@codesourcery.com> * NEWS: Mention addition of --extract-symbol. * doc/binutils.texi: Document it. * objcopy.c (extract_symbol): New variable. (OPTION_EXTRACT_SYMBOLS): New command_line_switch. (copy_options): Add an entry for --extract-symbol. (copy_usage): Mention --extract-symbol. (copy_object): Set the start address to zero for --extract-symbol. Do not copy private BFD data in that case. (setup_section): Set the size, LMA and VMA to zero for --extract-symbol. Do not copy private BFD data in that case. (copy_section): Do not copy section contents if --extract-symbol is passed. (copy_main): Set extract_symbol to TRUE if --extract-symbol is passed. ld/testsuite/ * ld-elf/extract-symbol-1sym.d, ld-elf/extract-symbol-1sec.d, * ld-elf/extract-symbol-1.s, ld-elf/extract-symbol-1.ld: New tests. * ld-elf/binutils.exp: Run them.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog6
-rw-r--r--ld/testsuite/ld-elf/binutils.exp3
-rw-r--r--ld/testsuite/ld-elf/extract-symbol-1.ld18
-rw-r--r--ld/testsuite/ld-elf/extract-symbol-1.s15
-rw-r--r--ld/testsuite/ld-elf/extract-symbol-1sec.d12
-rw-r--r--ld/testsuite/ld-elf/extract-symbol-1sym.d10
6 files changed, 64 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 72cffce..704fa91 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2007-03-01 Richard Sandiford <richard@codesourcery.com>
+
+ * ld-elf/extract-symbol-1sym.d, ld-elf/extract-symbol-1sec.d,
+ * ld-elf/extract-symbol-1.s, ld-elf/extract-symbol-1.ld: New tests.
+ * ld-elf/binutils.exp: Run them.
+
2007-02-28 Nick Clifton <nickc@redhat.com>
PR ld/3796
diff --git a/ld/testsuite/ld-elf/binutils.exp b/ld/testsuite/ld-elf/binutils.exp
index 7ced42c..6e5caba 100644
--- a/ld/testsuite/ld-elf/binutils.exp
+++ b/ld/testsuite/ld-elf/binutils.exp
@@ -122,3 +122,6 @@ binutils_test objcopy "-z max-page-size=0x100000" tdata2
binutils_test objcopy "" tdata2
binutils_test objcopy "-shared" tdata2
binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tdata2
+
+run_dump_test extract-symbol-1sec
+run_dump_test extract-symbol-1sym
diff --git a/ld/testsuite/ld-elf/extract-symbol-1.ld b/ld/testsuite/ld-elf/extract-symbol-1.ld
new file mode 100644
index 0000000..a989b26
--- /dev/null
+++ b/ld/testsuite/ld-elf/extract-symbol-1.ld
@@ -0,0 +1,18 @@
+ENTRY(_entry)
+PHDRS
+{
+ data PT_LOAD;
+}
+SECTIONS
+{
+ . = 0x10000;
+ .foo : { *(.foo) } :data
+
+ . = 0x20000;
+ .bar : { *(.bar) } :data
+
+ /DISCARD/ : { *(*) }
+
+ _entry = 0x30000;
+ linker_symbol = 0x40000;
+}
diff --git a/ld/testsuite/ld-elf/extract-symbol-1.s b/ld/testsuite/ld-elf/extract-symbol-1.s
new file mode 100644
index 0000000..0971500
--- /dev/null
+++ b/ld/testsuite/ld-elf/extract-symbol-1.s
@@ -0,0 +1,15 @@
+ .globl B
+ .globl C
+
+ .section .foo,"awx",%progbits
+ .4byte 1,2,3,4
+B:
+ .4byte 5,6,7
+
+ .section .bar,"ax",%nobits
+ .space 0x123
+C:
+ .space 0x302
+
+ .globl D
+ .equ D,0x12345678
diff --git a/ld/testsuite/ld-elf/extract-symbol-1sec.d b/ld/testsuite/ld-elf/extract-symbol-1sec.d
new file mode 100644
index 0000000..d6425c6
--- /dev/null
+++ b/ld/testsuite/ld-elf/extract-symbol-1sec.d
@@ -0,0 +1,12 @@
+#name: --extract-symbol test 1 (sections)
+#source: extract-symbol-1.s
+#ld: -Textract-symbol-1.ld
+#objcopy_linked_file: --extract-symbol
+#objdump: --headers
+#...
+Sections:
+ *Idx +Name +Size +VMA +LMA .*
+ *0 +\.foo +0+ +0+ +0+ .*
+ *CONTENTS, ALLOC, LOAD, CODE
+ *1 +\.bar +0+ +0+ +0+ .*
+ *ALLOC, READONLY, CODE
diff --git a/ld/testsuite/ld-elf/extract-symbol-1sym.d b/ld/testsuite/ld-elf/extract-symbol-1sym.d
new file mode 100644
index 0000000..bf48e5c
--- /dev/null
+++ b/ld/testsuite/ld-elf/extract-symbol-1sym.d
@@ -0,0 +1,10 @@
+#name: --extract-symbol test 1 (symbols)
+#source: extract-symbol-1.s
+#ld: -Textract-symbol-1.ld
+#objcopy_linked_file: --extract-symbol
+#nm: -n
+0*00010010 T B
+0*00020123 T C
+0*00030000 A _entry
+0*00040000 A linker_symbol
+0*12345678 A D