mirror of
https://frontier.innolan.net/github/amigaos-binutils.git
synced 2025-11-20 13:21:54 +00:00
@R new approach to fix the offsets relative to a4.
This commit is contained in:
@ -111,7 +111,8 @@ bfd_boolean
|
|||||||
amiga_final_link PARAMS ((bfd *, struct bfd_link_info *));
|
amiga_final_link PARAMS ((bfd *, struct bfd_link_info *));
|
||||||
bfd_boolean
|
bfd_boolean
|
||||||
aout_amiga_final_link PARAMS ((bfd *, struct bfd_link_info *));
|
aout_amiga_final_link PARAMS ((bfd *, struct bfd_link_info *));
|
||||||
|
static int
|
||||||
|
my_get_offset PARAMS ((arelent *r, PTR data, int flags));
|
||||||
static bfd_reloc_status_type
|
static bfd_reloc_status_type
|
||||||
my_add_to PARAMS ((arelent *, PTR, int, int));
|
my_add_to PARAMS ((arelent *, PTR, int, int));
|
||||||
static void amiga_update_target_section PARAMS ((sec_ptr));
|
static void amiga_update_target_section PARAMS ((sec_ptr));
|
||||||
@ -269,8 +270,51 @@ error_return:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int my_get_offset (r, data, flags)
|
||||||
|
arelent *r;
|
||||||
|
PTR data;
|
||||||
|
int flags;
|
||||||
|
{
|
||||||
|
bfd_byte *p = ((bfd_byte *)data) + r->address;
|
||||||
|
int val;
|
||||||
|
asymbol *sym = *(r->sym_ptr_ptr);
|
||||||
|
|
||||||
/* Add a value to a location */
|
DPRINT(5, ("Entering my_get_offset for %s \n", sym->name));
|
||||||
|
|
||||||
|
switch (r->howto->size)
|
||||||
|
{
|
||||||
|
case 0: /* byte size */
|
||||||
|
if ((flags & ADDEND_UNSIGNED) == 0)
|
||||||
|
val = ((*p & 0xff) ^ 0x80) - 0x80;
|
||||||
|
else
|
||||||
|
val = (*p & 0xff);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: /* word size */
|
||||||
|
if ((flags & ADDEND_UNSIGNED) == 0)
|
||||||
|
val = bfd_getb_signed_16(p);
|
||||||
|
else
|
||||||
|
val = bfd_getb16(p);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2: /* long word */
|
||||||
|
val = bfd_getb_signed_32(p);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: /* Error */
|
||||||
|
val = 0x5a5a5a5a;
|
||||||
|
break;
|
||||||
|
}/* Of switch */
|
||||||
|
|
||||||
|
DPRINT(5, ("Leaving my_get_offset\n"));
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Add a value to a location.
|
||||||
|
* The code is patched directly by adding the 'add' to the existing value at data[r->address]
|
||||||
|
*/
|
||||||
static bfd_reloc_status_type
|
static bfd_reloc_status_type
|
||||||
my_add_to (r, data, add, flags)
|
my_add_to (r, data, add, flags)
|
||||||
arelent *r;
|
arelent *r;
|
||||||
@ -739,8 +783,14 @@ aout_perform_reloc (abfd, r, data, sec, obfd, error_message)
|
|||||||
relocation = sym->value + target_section->output_offset;
|
relocation = sym->value + target_section->output_offset;
|
||||||
/* if the symbol is in .bss, subtract the offset that gas has put
|
/* if the symbol is in .bss, subtract the offset that gas has put
|
||||||
into the opcode */
|
into the opcode */
|
||||||
|
// if (target_section->index == 2)
|
||||||
|
// relocation -= adata(abfd).datasec->_raw_size;
|
||||||
|
// SBF: nope. rather subtract the existing offset.
|
||||||
if (target_section->index == 2)
|
if (target_section->index == 2)
|
||||||
relocation -= adata(abfd).datasec->_raw_size;
|
{
|
||||||
|
relocation -= my_get_offset(r, data, flags);
|
||||||
|
r->addend = 0;
|
||||||
|
}
|
||||||
DPRINT(20,("symbol=%s (0x%lx)\nsection %s (0x%lx; %s; output=0x%lx)"
|
DPRINT(20,("symbol=%s (0x%lx)\nsection %s (0x%lx; %s; output=0x%lx)"
|
||||||
"\nrelocation @0x%lx\n", sym->name, sym->value,
|
"\nrelocation @0x%lx\n", sym->name, sym->value,
|
||||||
target_section->name, target_section,
|
target_section->name, target_section,
|
||||||
|
|||||||
Reference in New Issue
Block a user