aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>1999-08-19 13:04:45 +0000
committerNick Clifton <nickc@redhat.com>1999-08-19 13:04:45 +0000
commit69e70d305635c2caacc43c2744b455ca84f8e322 (patch)
treea2be8de8de1739dcdaa81d9704d4b771247d068c
parent98c1d4aab729f61101ac21f24f0c946cb5ceac23 (diff)
downloadfsf-binutils-gdb-69e70d305635c2caacc43c2744b455ca84f8e322.zip
fsf-binutils-gdb-69e70d305635c2caacc43c2744b455ca84f8e322.tar.gz
fsf-binutils-gdb-69e70d305635c2caacc43c2744b455ca84f8e322.tar.bz2
Add code to emit relocs into a base file.
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/coff-mcore.c28
2 files changed, 34 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8fde096..40916d9 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,12 @@
1999-08-19 Nick Clifton <nickc@cygnus.com>
+ * coff-mcore.c (mcore_emit_base_file_entry): New function: Emit
+ relocations into the base file.
+ (coff_mcore_relocate_section): Call mcore_emit_base_file_entry if
+ we are building a base file.
+
+1999-08-19 Nick Clifton <nickc@cygnus.com>
+
* elf32-arm.h (arm_add_to_rel): New function. Add a value to
a REL style reloc.
(elf32_arm_relocate_section): Use arm_add_to_rel to increment
diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c
index 199a5ab..48f1525 100644
--- a/bfd/coff-mcore.c
+++ b/bfd/coff-mcore.c
@@ -1,5 +1,5 @@
/* BFD back-end for Motorolla MCore COFF/PE
- Copyright 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -248,6 +248,25 @@ coff_mcore_link_hash_table_create (abfd)
return & ret->root.root;
}
+/* Add an entry to the base file. */
+static void
+mcore_emit_base_file_entry (info, output_bfd, input_section, reloc_offset)
+ struct bfd_link_info * info;
+ bfd * output_bfd;
+ asection * input_section;
+ bfd_vma reloc_offset;
+{
+ bfd_vma addr = reloc_offset
+ - input_section->vma
+ + input_section->output_offset
+ + input_section->output_section->vma;
+
+ if (coff_data (output_bfd)->pe)
+ addr -= pe_data (output_bfd)->pe_opthdr.ImageBase;
+
+ fwrite (&addr, 1, sizeof (addr), (FILE *) info->base_file);
+}
+
/*ARGSUSED*/
static bfd_reloc_status_type
mcore_coff_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section,
@@ -512,6 +531,13 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
break;
}
+ if (info->base_file)
+ {
+ /* Emit a reloc if the backend thinks it needs it. */
+ if (sym && pe_data (output_bfd)->in_reloc_p (output_bfd, howto))
+ mcore_emit_base_file_entry (info, output_bfd, input_section, rel->r_vaddr);
+ }
+
switch (rstat)
{
default: