aboutsummaryrefslogtreecommitdiff
path: root/bfd/cofflink.c
diff options
context:
space:
mode:
authorSteve Chamberlain <sac@cygnus>1995-06-29 01:17:58 +0000
committerSteve Chamberlain <sac@cygnus>1995-06-29 01:17:58 +0000
commit89665c8562dac7459029330dabb4e426cd1643a6 (patch)
treeba05dedc3eeb42b9c2cb71a26a7ab31b83a12276 /bfd/cofflink.c
parent6f2d32120e50bd3bc24ac0c16f53875a35788314 (diff)
downloadgdb-89665c8562dac7459029330dabb4e426cd1643a6.zip
gdb-89665c8562dac7459029330dabb4e426cd1643a6.tar.gz
gdb-89665c8562dac7459029330dabb4e426cd1643a6.tar.bz2
Wed Jun 28 18:04:42 1995 Steve Chamberlain <sac@slash.cygnus.com>
* Makefile.in: versados.o is now conditionally built. * coffcode.h (add_data_entry): New function. (coff_write_object_contents): Clean up. Calculate data entries. * cofflink.c (_bfd_coff_generic_relocate_section): .reloc and .edata sections are IMAGE_BASED too. If there's a base_file then write out base information. * configure.host (i386-*-pe): New. * syms.c (coff_section_type): Only scan prefixes. * targets.c (bfd_target_vector): Versados is now conditionally built. * config/m68k-coff.mt: Build versados.o * hosts/i386pe.h: New file.
Diffstat (limited to 'bfd/cofflink.c')
-rw-r--r--bfd/cofflink.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 2e6fe26..1e3d33e 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -674,9 +674,9 @@ process_embedded_commands (abfd)
char *s;
char *e;
char *copy;
- if (!s)
+ if (!sec)
return 1;
-
+
copy = malloc (sec->_raw_size);
if (!copy)
{
@@ -2312,6 +2312,10 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
{
if (strncmp (sec->name, ".idata$", 7) == 0)
val -= NT_IMAGE_BASE;
+ if (strncmp (sec->name, ".reloc", 6) == 0)
+ val -= NT_IMAGE_BASE;
+ else if (strncmp (sec->name, ".edata", 5) == 0)
+ val -= NT_IMAGE_BASE;
else if (strncmp (sec->name, ".rsrc$", 6) == 0)
{
val -= NT_IMAGE_BASE;
@@ -2339,6 +2343,10 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
{
if (strncmp (sec->name, ".idata$", 7) == 0)
val -= NT_IMAGE_BASE;
+ else if (strncmp (sec->name, ".reloc", 5) == 0)
+ val -= NT_IMAGE_BASE;
+ else if (strncmp (sec->name, ".edata", 5) == 0)
+ val -= NT_IMAGE_BASE;
else if (strncmp (sec->name, ".rsrc$", 6) == 0)
{
val -= NT_IMAGE_BASE;
@@ -2451,6 +2459,24 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
val = val + add_to_val;
}
+
+ if (info->base_file)
+ {
+ /* So if this is non pcrelative, and is referenced
+ to a section or a common symbol, then it needs a reloc */
+ if (!howto->pc_relative
+ && (sym->n_scnum
+ || sym->n_value))
+ {
+ /* relocation to a symbol in a section which
+ isn't absolute - we output the address here
+ to a file */
+ bfd_vma addr = rel->r_vaddr +
+ + input_section->output_offset
+ + input_section->output_section->vma;
+ fwrite (&addr, 1,4, info->base_file);
+ }
+ }
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents,