summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2015-06-09 14:14:41 +0930
committerAlan Modra <amodra@gmail.com>2015-06-15 16:24:13 +0930
commit3a062fa1eeee8296dece36a9bb7ecc8d4500de18 (patch)
treea61e166058c750b7f8863c5a3ddb1807bf7c28ee /bfd
parentAutomatic date update in version.in (diff)
downloadbinutils-gdb-3a062fa1eeee8296dece36a9bb7ecc8d4500de18.tar.gz
binutils-gdb-3a062fa1eeee8296dece36a9bb7ecc8d4500de18.tar.bz2
binutils-gdb-3a062fa1eeee8296dece36a9bb7ecc8d4500de18.zip
DJGPP port of binutils broken due to 64 bit cygwin fix
* cofflink.c (_bfd_coff_generic_relocate_section): Revert 2014-03-26 change. Call _bfd_clear_contents for relocs against local and global symbols defined in discarded input sections.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/cofflink.c22
2 files changed, 17 insertions, 11 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index aeda144f79c..5aaa45ee8c8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2015-06-15 Alan Modra <amodra@gmail.com>
+
+ * cofflink.c (_bfd_coff_generic_relocate_section): Revert
+ 2014-03-26 change. Call _bfd_clear_contents for relocs against
+ local and global symbols defined in discarded input sections.
+
2015-06-05 Nick Clifton <nickc@redhat.com>
* elf32-msp430.c (rl78_sym_diff_handler): New function.
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 0ac10de8819..c1541d1bd85 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -2915,6 +2915,7 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
struct internal_syment *sym;
bfd_vma addend;
bfd_vma val;
+ asection *sec;
reloc_howto_type *howto;
bfd_reloc_status_type rstat;
@@ -2965,11 +2966,9 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
}
val = 0;
-
+ sec = NULL;
if (h == NULL)
{
- asection *sec;
-
if (symndx == -1)
{
sec = bfd_abs_section_ptr;
@@ -2978,11 +2977,6 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
else
{
sec = sections[symndx];
-
- /* If the output section has been discarded then ignore this reloc. */
- if (sec->output_section->vma == 0)
- continue;
-
val = (sec->output_section->vma
+ sec->output_offset
+ sym->n_value);
@@ -2996,8 +2990,6 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
|| h->root.type == bfd_link_hash_defweak)
{
/* Defined weak symbols are a GNU extension. */
- asection *sec;
-
sec = h->root.u.def.section;
val = (h->root.u.def.value
+ sec->output_section->vma
@@ -3018,7 +3010,6 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
will resolve a weak external only if a normal
external causes the library member to be linked.
See also linker.c: generic_link_check_archive_element. */
- asection *sec;
struct coff_link_hash_entry *h2 =
h->auxbfd->tdata.coff_obj_data->sym_hashes[
h->aux->x_sym.x_tagndx.l];
@@ -3049,6 +3040,15 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
}
}
+ /* If the input section defining the symbol has been discarded
+ then zero this reloc field. */
+ if (sec != NULL && discarded_section (sec))
+ {
+ _bfd_clear_contents (howto, input_bfd, input_section,
+ contents + (rel->r_vaddr - input_section->vma));
+ continue;
+ }
+
if (info->base_file)
{
/* Emit a reloc if the backend thinks it needs it. */