diff options
author | Alan Modra <amodra@gmail.com> | 2002-09-21 10:09:13 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2002-09-21 10:09:13 +0000 |
commit | 5f81912811c3fc31aec0a156e6a021b4f901d623 (patch) | |
tree | 65ab0f56ed88f8cacbd94f6fd92ef277e656f5f0 | |
parent | 5ad8645cf8d41991011e0ba4d274400231c61c35 (diff) | |
download | gdb-5f81912811c3fc31aec0a156e6a021b4f901d623.zip gdb-5f81912811c3fc31aec0a156e6a021b4f901d623.tar.gz gdb-5f81912811c3fc31aec0a156e6a021b4f901d623.tar.bz2 |
* elf32-ppc.c (ppc_elf_relocate_section): Allow ".sbss.*" and
".sdata.*" for R_PPC_SDAREL16, ".sbss2*" and ".sdata2*" for
R_PPC_EMB_SDA2REL. Similarly for R_PPC_EMB_SDA21 and
R_PPC_EMB_RELSDA.
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/elf32-ppc.c | 18 |
2 files changed, 17 insertions, 6 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4f97925..6d449d1 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,10 @@ 2002-09-21 Alan Modra <amodra@bigpond.net.au> + * elf32-ppc.c (ppc_elf_relocate_section): Allow ".sbss.*" and + ".sdata.*" for R_PPC_SDAREL16, ".sbss2*" and ".sdata2*" for + R_PPC_EMB_SDA2REL. Similarly for R_PPC_EMB_SDA21 and + R_PPC_EMB_RELSDA. + * elfcode.h (elf_slurp_reloc_table_from_section): Make "symcount" unsigned. Move "symcount" assignment out of loop. * Makefile.am: Run "make dep-am". diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index a2a0a6d..6faffd20 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -3483,8 +3483,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, BFD_ASSERT (sec != (asection *) 0); name = bfd_get_section_name (abfd, sec->output_section); - if (strcmp (name, ".sdata") != 0 - && strcmp (name, ".sbss") != 0) + if (! ((strncmp (name, ".sdata", 6) == 0 + && (name[6] == 0 || name[6] == '.')) + || (strncmp (name, ".sbss", 5) == 0 + && (name[5] == 0 || name[5] == '.')))) { (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"), bfd_archive_filename (input_bfd), @@ -3505,7 +3507,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, BFD_ASSERT (sec != (asection *) 0); name = bfd_get_section_name (abfd, sec->output_section); - if (strcmp (name, ".sdata2") != 0 && strcmp (name, ".sbss2") != 0) + if (! (strncmp (name, ".sdata2", 7) == 0 + || strncmp (name, ".sbss2", 6) == 0)) { (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"), bfd_archive_filename (input_bfd), @@ -3532,7 +3535,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, BFD_ASSERT (sec != (asection *) 0); name = bfd_get_section_name (abfd, sec->output_section); - if (strcmp (name, ".sdata") == 0 || strcmp (name, ".sbss") == 0) + if (((strncmp (name, ".sdata", 6) == 0 + && (name[6] == 0 || name[6] == '.')) + || (strncmp (name, ".sbss", 5) == 0 + && (name[5] == 0 || name[5] == '.')))) { reg = 13; addend -= (sdata->sym_hash->root.u.def.value @@ -3540,8 +3546,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, + sdata->sym_hash->root.u.def.section->output_offset); } - else if (strcmp (name, ".sdata2") == 0 - || strcmp (name, ".sbss2") == 0) + else if (strncmp (name, ".sdata2", 7) == 0 + || strncmp (name, ".sbss2", 6) == 0) { reg = 2; addend -= (sdata2->sym_hash->root.u.def.value |