diff options
author | Ronald Hoogenbllon <rhoogenboom@irdeto.com> | 2015-10-21 15:16:35 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2015-10-21 15:16:35 +0100 |
commit | 2b35fb28f397a26c0da03f7579116d28af2af824 (patch) | |
tree | 7dc8a9042b84587fa9c317fbf1feda1caf6a1f97 /binutils/testsuite | |
parent | 1283d92f0e4704bb31b1e163b9c88216756ef62c (diff) | |
download | gdb-2b35fb28f397a26c0da03f7579116d28af2af824.zip gdb-2b35fb28f397a26c0da03f7579116d28af2af824.tar.gz gdb-2b35fb28f397a26c0da03f7579116d28af2af824.tar.bz2 |
Add ability for objcopy to insert new symbols into a binary.
PR binutils/19104
binutils * objcopy.c (command_line_switch): Add OPTION_ADD_SYMBOL.
(copy_options): Add add-symbol.
(copy_usage): Likewise.
(parse_symflags): New function.
(need_sym_before): New function.
(create_new_symbol): New function.
(filter_symbols): Add code to insert new symbols.
(copy_main): Process OPTION_ADD_SYMBOL.
* doc/binutils.texi: Document new feature.
* NEWS: Add note about the new feature.
tests * binutils-all/add-symbol.d: New test.
* binutils-all/objcopy.exp: Run the new test.
Diffstat (limited to 'binutils/testsuite')
-rw-r--r-- | binutils/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/add-symbol.d | 16 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/objcopy.exp | 1 |
3 files changed, 23 insertions, 0 deletions
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index 79b5b25..a442136 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-10-21 Ronald Hoogenbllon <rhoogenboom@irdeto.com> + + PR binutils/19104 + * binutils-all/add-symbol.d: New test. + * binutils-all/objcopy.exp: Run the new test. + 2015-10-15 Alan Modra <amodra@gmail.com> * binutils-all/objcopy.exp: Delete trailing whitespace. Use diff --git a/binutils/testsuite/binutils-all/add-symbol.d b/binutils/testsuite/binutils-all/add-symbol.d new file mode 100644 index 0000000..d421dc9 --- /dev/null +++ b/binutils/testsuite/binutils-all/add-symbol.d @@ -0,0 +1,16 @@ +#PROG: objcopy +#name: objcopy add-symbol +#source: symbols.s +#objcopy: --add-symbol NEW=0x1234 --add-symbol NEW_DATA=.data:0x4321,local +#objdump: --syms +# MIPS targets swap the order of the symbols in the output. +#not-target: mips-*-* tx39-*-* + +.*: +file format .* + +SYMBOL TABLE: +#... +0+04321 l[ ]+.data[ ]+0+00 NEW_DATA +#... +0+01234 g[ ]+\*ABS\*[ ]+0+00 NEW +#pass diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp index 252cb49..bac0ccd 100644 --- a/binutils/testsuite/binutils-all/objcopy.exp +++ b/binutils/testsuite/binutils-all/objcopy.exp @@ -1097,6 +1097,7 @@ if [is_elf_format] { run_dump_test "testranges-ia64" run_dump_test "add-section" + run_dump_test "add-symbol" run_dump_test "add-empty-section" run_dump_test "exclude-1a" |