aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-04-14 12:04:09 +0100
committerNick Clifton <nickc@redhat.com>2016-04-14 12:04:09 +0100
commit84865015459b4e9e8ac67f9b91617fbd856d5119 (patch)
tree744eddbeb143af1555bb6e24a2962536f9319c38 /binutils/testsuite
parent8dc483a0b6cf73204ce438f4abf2efd323d97e40 (diff)
downloadgdb-84865015459b4e9e8ac67f9b91617fbd856d5119.zip
gdb-84865015459b4e9e8ac67f9b91617fbd856d5119.tar.gz
gdb-84865015459b4e9e8ac67f9b91617fbd856d5119.tar.bz2
Fix copying Solaris binaries with objcopy.
PR target/19938 bfd * elf-bbfd.h (struct elf_backend_data): New field: elf_strtab_flags. New field: elf_backend_set_special_section_info_and_link * elfxx-target.h (elf_backend_strtab_flags): Define if not already defined. (elf_backend_set_special_section_info_and_link): Define if not already defined. (elfNN_bed): Use elf_backend_set_special_section_info_and_link and elf_backend_strtab_flags macros to initialise fields in structure. * elf.c (_bfd_elf_make_section_from_shdr): Check for SHF_STRINGS being set even if SHF_MERGE is not set. (elf_fake_sections): Likewise. (section_match): New function. Matches two ELF sections based upon fixed characteristics. (find_link): New function. Locates a section in a BFD that matches a section in a different BFD. (_bfd_elf_copy_private_bfd_data): Copy the sh_info and sh_link fields of reserved sections. (bfd_elf_compute_section_file_positions): Set the flags for the .shstrtab section based upon the elf_strtab_flags field in the elf_backend_data structure. (swap_out_syms): Likewise for the .strtab section. * elflink.c (bfd_elf_final_link): Set the flags for the .strtab section based upon the elf_strtab_flags field in the elf_backend_data structure. * elf32-i386.c (elf32_i386_set_special_info_link): New function. (elf_backend_strtab_flags): Set to SHF_STRINGS for Solaris targets. (elf_backend_set_special_section_info_and_link): Define for Solaris targets. * elf32-sparc.c: Likewise. * elf64-x86-64.c: Likewise. binutils* testsuite/binutils-all/i386/compressed-1b.d: Allow for the string sections possibly having the SHF_STRINGS flag bit set. * testsuite/binutils-all/i386/compressed-1c.d: Likewise. * testsuite/binutils-all/readelf.s: Likewise. * testsuite/binutils-all/readelf.s-64: Likewise. * testsuite/binutils-all/x86-64/compressed-1b.d: Likewise. * testsuite/binutils-all/x86-64/compressed-1c.d: Likewise. gas * testsuite/gas/i386/ilp32/x86-64-unwind.d: Allow for the string sections possibly having the SHF_STRINGS flag bit set. * testsuite/gas/i386/x86-64-unwind.d: Likewise.
Diffstat (limited to 'binutils/testsuite')
-rw-r--r--binutils/testsuite/binutils-all/i386/compressed-1b.d2
-rw-r--r--binutils/testsuite/binutils-all/i386/compressed-1c.d2
-rw-r--r--binutils/testsuite/binutils-all/readelf.s4
-rw-r--r--binutils/testsuite/binutils-all/readelf.s-644
-rw-r--r--binutils/testsuite/binutils-all/testprog.c4
-rw-r--r--binutils/testsuite/binutils-all/x86-64/compressed-1b.d2
-rw-r--r--binutils/testsuite/binutils-all/x86-64/compressed-1c.d2
7 files changed, 10 insertions, 10 deletions
diff --git a/binutils/testsuite/binutils-all/i386/compressed-1b.d b/binutils/testsuite/binutils-all/i386/compressed-1b.d
index 40bd5e6..d74af4d 100644
--- a/binutils/testsuite/binutils-all/i386/compressed-1b.d
+++ b/binutils/testsuite/binutils-all/i386/compressed-1b.d
@@ -13,6 +13,6 @@ Section Headers:
\[ 1\] .text PROGBITS 00000000 000040 00001b 00 AX 0 0 16
\[ 2\] .data PROGBITS 00000000 00005b 000000 00 WA 0 0 1
\[ 3\] .bss NOBITS 00000000 00005b 000000 00 WA 0 0 1
- \[ 4\] .shstrtab STRTAB 00000000 [0-9a-f]+ 00001c 00 0 0 1
+ \[ 4\] .shstrtab STRTAB 00000000 [0-9a-f]+ 00001c 00 . 0 0 1
Key to Flags:
#...
diff --git a/binutils/testsuite/binutils-all/i386/compressed-1c.d b/binutils/testsuite/binutils-all/i386/compressed-1c.d
index 1f46e3c..3a0cba5 100644
--- a/binutils/testsuite/binutils-all/i386/compressed-1c.d
+++ b/binutils/testsuite/binutils-all/i386/compressed-1c.d
@@ -13,6 +13,6 @@ Section Headers:
\[ 1\] .text PROGBITS 00000000 000040 00001b 00 AX 0 0 16
\[ 2\] .data PROGBITS 00000000 00005b 000000 00 WA 0 0 1
\[ 3\] .bss NOBITS 00000000 00005b 000000 00 WA 0 0 1
- \[ 4\] .shstrtab STRTAB 00000000 [0-9a-f]+ 00001c 00 0 0 1
+ \[ 4\] .shstrtab STRTAB 00000000 [0-9a-f]+ 00001c 00 .* 0 0 1
Key to Flags:
#...
diff --git a/binutils/testsuite/binutils-all/readelf.s b/binutils/testsuite/binutils-all/readelf.s
index 3b044b1..22b3843 100644
--- a/binutils/testsuite/binutils-all/readelf.s
+++ b/binutils/testsuite/binutils-all/readelf.s
@@ -14,8 +14,8 @@ Section Headers:
# MIPS targets put .reginfo, .mdebug, .MIPS.abiflags and .gnu.attributes here.
# v850 targets put .call_table_data and .call_table_text here.
#...
- +\[ .\] .shstrtab +STRTAB +00000000 0+.* 0+.* 00 +0 +0 +.
+ +\[ .\] .shstrtab +STRTAB +00000000 0+.* 0+.* 00 .* +0 +0 +.
+\[..\] .symtab +SYMTAB +00000000 0+.* 0+.* 10 +.. +.+ +4
- +\[..\] .strtab +STRTAB +00000000 0+.* 0+.* 00 +0 +0 +1
+ +\[..\] .strtab +STRTAB +00000000 0+.* 0+.* 00 .* +0 +0 +1
Key to Flags:
#...
diff --git a/binutils/testsuite/binutils-all/readelf.s-64 b/binutils/testsuite/binutils-all/readelf.s-64
index 40b1f5a..d198300 100644
--- a/binutils/testsuite/binutils-all/readelf.s-64
+++ b/binutils/testsuite/binutils-all/readelf.s-64
@@ -14,11 +14,11 @@ Section Headers:
+\[ 4\] .bss +NOBITS +0000000000000000 +000000(4c|50|54|58)
+0000000000000000 +0000000000000000 +WA +0 +0 +.*
+\[ 5\] .shstrtab +STRTAB +0000000000000000 +[0-9a-f]+
- +00000000000000.. +0000000000000000 +0 +0 +.*
+ +00000000000000.. +0000000000000000 .* +0 +0 +.*
+\[ 6\] .symtab +SYMTAB +0000000000000000 +0+.*
# aarch64-elf targets have one more data symbol.
+0+.* +0000000000000018 +7 +(6|7) +8
+\[ 7\] .strtab +STRTAB +0000000000000000 +0+.*
- +0+.* +0000000000000000 +0 +0 +1
+ +0+.* +0000000000000000 .* +0 +0 +1
Key to Flags:
#...
diff --git a/binutils/testsuite/binutils-all/testprog.c b/binutils/testsuite/binutils-all/testprog.c
index 6ead98e..b8531e2 100644
--- a/binutils/testsuite/binutils-all/testprog.c
+++ b/binutils/testsuite/binutils-all/testprog.c
@@ -1,12 +1,12 @@
/* This program is used to test objcopy, readelf and strip. */
-extern int strcmp (char *, const char *);
+extern int strcmp (const char *, const char *);
extern int printf (const char *, ...);
int common;
int global = 1;
static int local = 2;
-static char string[] = "string";
+static const char string[] = "string";
int
fn (void)
diff --git a/binutils/testsuite/binutils-all/x86-64/compressed-1b.d b/binutils/testsuite/binutils-all/x86-64/compressed-1b.d
index f55efac..040bdd3 100644
--- a/binutils/testsuite/binutils-all/x86-64/compressed-1b.d
+++ b/binutils/testsuite/binutils-all/x86-64/compressed-1b.d
@@ -13,6 +13,6 @@ Section Headers:
\[ 1\] .text PROGBITS 0000000000000000 000040 000015 00 AX 0 0 16
\[ 2\] .data PROGBITS 0000000000000000 000055 000000 00 WA 0 0 1
\[ 3\] .bss NOBITS 0000000000000000 000055 000000 00 WA 0 0 1
- \[ 4\] .shstrtab STRTAB 0000000000000000 [0-9a-f]+ 00001c 00 0 0 1
+ \[ 4\] .shstrtab STRTAB 0000000000000000 [0-9a-f]+ 00001c 00 .* 0 0 1
Key to Flags:
#...
diff --git a/binutils/testsuite/binutils-all/x86-64/compressed-1c.d b/binutils/testsuite/binutils-all/x86-64/compressed-1c.d
index bb8f6e3..96eb6d4 100644
--- a/binutils/testsuite/binutils-all/x86-64/compressed-1c.d
+++ b/binutils/testsuite/binutils-all/x86-64/compressed-1c.d
@@ -13,6 +13,6 @@ Section Headers:
\[ 1\] .text PROGBITS 0000000000000000 000040 000015 00 AX 0 0 16
\[ 2\] .data PROGBITS 0000000000000000 000055 000000 00 WA 0 0 1
\[ 3\] .bss NOBITS 0000000000000000 000055 000000 00 WA 0 0 1
- \[ 4\] .shstrtab STRTAB 0000000000000000 [0-9a-f]+ 00001c 00 0 0 1
+ \[ 4\] .shstrtab STRTAB 0000000000000000 [0-9a-f]+ 00001c 00 .* 0 0 1
Key to Flags:
#...