This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Patch for 64-bit change address in 32-bit environment
- To: binutils at sourceware dot cygnus dot com
- Subject: Patch for 64-bit change address in 32-bit environment
- From: Ulf Carlsson <ulfc at calypso dot engr dot sgi dot com>
- Date: Sun, 9 Apr 2000 00:11:06 -0700 (PDT)
The current implementation of set_section_start() can't handle 64-bit addresses
if you've compiled the 64-bit linker in a 32-bit environment. The problem
is that strtoul() uses unsigned longs. I have attached a workaround for this.
Ulf
2000-04-09 Ulf Carlsson <ulfc@engr.sgi.com>
* lexsup.c (set_section_start): Handle 64-bit addresses is 32-bit
compiling environments.
diff -u binutils-current.orig/ld/lexsup.c binutils-current/ld/lexsup.c
--- binutils-current.orig/ld/lexsup.c Tue Apr 4 10:32:33 2000
+++ binutils-current/ld/lexsup.c Tue Apr 4 19:29:31 2000
@@ -1051,7 +1051,22 @@
char *sect, *valstr;
{
char *end;
- unsigned long val = strtoul (valstr, &end, 16);
+ bfd_vma val;
+
+ if (valstr[0] == '0' && (valstr[1] == 'x' || valstr[1] == 'X'))
+ valstr += 2;
+ if (strlen (valstr) > 8 && sizeof (unsigned long) < 8)
+ {
+ char save;
+ save = *(valstr + 8);
+ *(valstr + 8) = '\0';
+ val = (bfd_vma) strtoul (valstr, &end, 16) << 32;
+ valstr += 8;
+ *valstr = save;
+ }
+ else
+ val = 0;
+ val += strtoul (valstr, &end, 16);
if (*end)
einfo (_("%P%F: invalid hex number `%s'\n"), valstr);
lang_section_start (sect, exp_intop (val));