aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Tietz <kai.tietz@onevision.com>2008-10-09 09:00:08 +0000
committerKai Tietz <kai.tietz@onevision.com>2008-10-09 09:00:08 +0000
commitd078078ddb99e3b2c63f093cb1d898cd7f36960a (patch)
tree0d4f960c5e6933a7b201b9bb2905b312ef419605
parentc8d104ad6940c4f094193620122d26d8d2ff4167 (diff)
downloadgdb-d078078ddb99e3b2c63f093cb1d898cd7f36960a.zip
gdb-d078078ddb99e3b2c63f093cb1d898cd7f36960a.tar.gz
gdb-d078078ddb99e3b2c63f093cb1d898cd7f36960a.tar.bz2
binutils/
2008-10-09 Kai Tietz <kai.tietz@onevision.com> * dlltool.c (PAGE_SIZE): Make sure it has bfd_vma type. (PAGE_MASK): Likewise. (sfunc): Change to address size of bfd_vma for base-file. (flush_page): Likewise. (gen_exp_file): Likewise. bfd/ 2008-10-09 Kai Tietz <kai.tietz@onevision.com> * cofflink.c (_bfd_coff_generic_relocate_section): Dump bfd_vma sized addresses instead of long sized.
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/cofflink.c10
-rw-r--r--binutils/ChangeLog8
-rw-r--r--binutils/dlltool.c43
4 files changed, 44 insertions, 21 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 935959b..2c5e391 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,7 @@
+2008-10-09 Kai Tietz <kai.tietz@onevision.com>
+
+ * cofflink.c (_bfd_coff_generic_relocate_section): Dump bfd_vma sized addresses instead of long sized.
+
2008-10-09 Alan Modra <amodra@bigpond.net.au>
* elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Don't attempt to
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 19a7dd2..d771168 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -2985,16 +2985,16 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
absolute. We output the address here to a file.
This file is then read by dlltool when generating the
reloc section. Note that the base file is not
- portable between systems. We write out a long here,
- and dlltool reads in a long. */
- long addr = (rel->r_vaddr
+ portable between systems. We write out a bfd_vma here,
+ and dlltool reads in a bfd_vma. */
+ bfd_vma addr = (rel->r_vaddr
- 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;
- if (fwrite (&addr, 1, sizeof (long), (FILE *) info->base_file)
- != sizeof (long))
+ if (fwrite (&addr, 1, sizeof (bfd_vma), (FILE *) info->base_file)
+ != sizeof (bfd_vma))
{
bfd_set_error (bfd_error_system_call);
return FALSE;
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index aa8d4f4..e31605d 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,11 @@
+2008-10-09 Kai Tietz <kai.tietz@onevision.com>
+
+ * dlltool.c (PAGE_SIZE): Make sure it has bfd_vma type.
+ (PAGE_MASK): Likewise.
+ (sfunc): Change to address size of bfd_vma for base-file.
+ (flush_page): Likewise.
+ (gen_exp_file): Likewise.
+
2008-10-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* readelf.c (process_section_headers): Do not cut the section names and
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index 505402b..1e2f1f9 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -241,8 +241,8 @@
#define show_allnames 0
-#define PAGE_SIZE 4096
-#define PAGE_MASK (-PAGE_SIZE)
+#define PAGE_SIZE ((bfd_vma) 4096)
+#define PAGE_MASK ((bfd_vma) (-4096))
#include "sysdep.h"
#include "bfd.h"
#include "libiberty.h"
@@ -712,7 +712,7 @@ static void scan_open_obj_file (bfd *);
static void scan_obj_file (const char *);
static void dump_def_info (FILE *);
static int sfunc (const void *, const void *);
-static void flush_page (FILE *, long *, int, int);
+static void flush_page (FILE *, bfd_vma *, bfd_vma, int);
static void gen_def_file (void);
static void generate_idata_ofile (FILE *);
static void assemble_file (const char *, const char *);
@@ -1584,18 +1584,21 @@ dump_def_info (FILE *f)
static int
sfunc (const void *a, const void *b)
{
- return *(const long *) a - *(const long *) b;
+ if (*(const bfd_vma *) a == *(const bfd_vma *) b)
+ return 0;
+
+ return ((*(const bfd_vma *) a > *(const bfd_vma *) b) ? 1 : -1);
}
static void
-flush_page (FILE *f, long *need, int page_addr, int on_page)
+flush_page (FILE *f, bfd_vma *need, bfd_vma page_addr, int on_page)
{
int i;
/* Flush this page. */
fprintf (f, "\t%s\t0x%08x\t%s Starting RVA for chunk\n",
ASM_LONG,
- page_addr,
+ (int) page_addr,
ASM_C);
fprintf (f, "\t%s\t0x%x\t%s Size of block\n",
ASM_LONG,
@@ -1604,12 +1607,20 @@ flush_page (FILE *f, long *need, int page_addr, int on_page)
for (i = 0; i < on_page; i++)
{
- unsigned long needed = need[i];
+ bfd_vma needed = need[i];
if (needed)
- needed = ((needed - page_addr) | 0x3000) & 0xffff;
+ {
+#ifndef DLLTOOL_MX86_64
+ /* Relocation via HIGHLOW. */
+ needed = ((needed - page_addr) | 0x3000) & 0xffff;
+#else
+ /* Relocation via DIR64. */
+ needed = ((needed - page_addr) | 0xa000) & 0xffff;
+#endif
+ }
- fprintf (f, "\t%s\t0x%lx\n", ASM_SHORT, needed);
+ fprintf (f, "\t%s\t0x%lx\n", ASM_SHORT, (long) needed);
}
/* And padding */
@@ -1977,12 +1988,12 @@ gen_exp_file (void)
/* Dump the reloc section if a base file is provided. */
if (base_file)
{
- int addr;
- long need[PAGE_SIZE];
- long page_addr;
+ bfd_vma addr;
+ bfd_vma need[PAGE_SIZE];
+ bfd_vma page_addr;
int numbytes;
int num_entries;
- long *copy;
+ bfd_vma *copy;
int j;
int on_page;
fprintf (f, "\t.section\t.init\n");
@@ -1993,7 +2004,7 @@ gen_exp_file (void)
fseek (base_file, 0, SEEK_SET);
copy = xmalloc (numbytes);
fread (copy, 1, numbytes, base_file);
- num_entries = numbytes / sizeof (long);
+ num_entries = numbytes / sizeof (bfd_vma);
fprintf (f, "\t.section\t.reloc\n");
@@ -2001,8 +2012,8 @@ gen_exp_file (void)
{
int src;
int dst = 0;
- int last = -1;
- qsort (copy, num_entries, sizeof (long), sfunc);
+ bfd_vma last = (bfd_vma) -1;
+ qsort (copy, num_entries, sizeof (bfd_vma), sfunc);
/* Delete duplicates */
for (src = 0; src < num_entries; src++)
{