2005-10-26 01:40:19 +08:00
|
|
|
/* BFD back-end for Zilog Z80 COFF binaries.
|
2020-01-01 15:57:01 +08:00
|
|
|
Copyright (C) 2005-2020 Free Software Foundation, Inc.
|
2005-10-26 01:40:19 +08:00
|
|
|
Contributed by Arnold Metselaar <arnold_m@operamail.com>
|
|
|
|
|
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
|
|
2013-01-11 04:03:55 +08:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
2005-10-26 01:40:19 +08:00
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-07-03 22:26:43 +08:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2005-10-26 01:40:19 +08:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
MA 02110-1301, USA. */
|
|
|
|
|
|
|
|
#include "sysdep.h"
|
2007-04-26 22:47:00 +08:00
|
|
|
#include "bfd.h"
|
2005-10-26 01:40:19 +08:00
|
|
|
#include "libbfd.h"
|
|
|
|
#include "bfdlink.h"
|
|
|
|
#include "coff/z80.h"
|
|
|
|
#include "coff/internal.h"
|
|
|
|
#include "libcoff.h"
|
2020-01-02 22:10:40 +08:00
|
|
|
#include "libiberty.h"
|
2005-10-26 01:40:19 +08:00
|
|
|
|
|
|
|
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 0
|
|
|
|
|
2020-01-02 22:10:40 +08:00
|
|
|
typedef struct {
|
|
|
|
bfd_reloc_code_real_type r_type;
|
|
|
|
reloc_howto_type howto;
|
|
|
|
} bfd_howto_type;
|
2005-10-26 01:40:19 +08:00
|
|
|
|
2020-01-02 22:10:40 +08:00
|
|
|
#define BFD_EMPTY_HOWTO(rt,x) {rt, EMPTY_HOWTO(x)}
|
|
|
|
#define BFD_HOWTO(rt,a,b,c,d,e,f,g,h,i,j,k,l,m) {rt, HOWTO(a,b,c,d,e,f,g,h,i,j,k,l,m)}
|
2005-10-26 01:40:19 +08:00
|
|
|
|
2020-01-02 22:10:40 +08:00
|
|
|
static bfd_howto_type howto_table[] =
|
|
|
|
{
|
|
|
|
BFD_EMPTY_HOWTO (BFD_RELOC_NONE, 0),
|
|
|
|
|
|
|
|
BFD_HOWTO (BFD_RELOC_32,
|
|
|
|
R_IMM32, /* type */
|
|
|
|
0, /* rightshift */
|
|
|
|
2, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
32, /* bitsize */
|
|
|
|
FALSE, /* pc_relative */
|
|
|
|
0, /* bitpos */
|
|
|
|
complain_overflow_bitfield, /* complain_on_overflow */
|
|
|
|
0, /* special_function */
|
|
|
|
"r_imm32", /* name */
|
|
|
|
FALSE, /* partial_inplace */
|
|
|
|
0xffffffff, /* src_mask */
|
|
|
|
0xffffffff, /* dst_mask */
|
|
|
|
FALSE), /* pcrel_offset */
|
|
|
|
|
|
|
|
BFD_HOWTO (BFD_RELOC_24,
|
|
|
|
R_IMM24, /* type */
|
|
|
|
0, /* rightshift */
|
|
|
|
1, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
24, /* bitsize */
|
|
|
|
FALSE, /* pc_relative */
|
|
|
|
0, /* bitpos */
|
|
|
|
complain_overflow_bitfield, /* complain_on_overflow */
|
|
|
|
0, /* special_function */
|
|
|
|
"r_imm24", /* name */
|
|
|
|
FALSE, /* partial_inplace */
|
|
|
|
0x00ffffff, /* src_mask */
|
|
|
|
0x00ffffff, /* dst_mask */
|
|
|
|
FALSE), /* pcrel_offset */
|
|
|
|
|
|
|
|
BFD_HOWTO (BFD_RELOC_16,
|
|
|
|
R_IMM16, /* type */
|
|
|
|
0, /* rightshift */
|
|
|
|
1, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
16, /* bitsize */
|
|
|
|
FALSE, /* pc_relative */
|
|
|
|
0, /* bitpos */
|
|
|
|
complain_overflow_bitfield, /* complain_on_overflow */
|
|
|
|
0, /* special_function */
|
|
|
|
"r_imm16", /* name */
|
|
|
|
FALSE, /* partial_inplace */
|
|
|
|
0x0000ffff, /* src_mask */
|
|
|
|
0x0000ffff, /* dst_mask */
|
|
|
|
FALSE), /* pcrel_offset */
|
|
|
|
|
|
|
|
BFD_HOWTO (BFD_RELOC_8,
|
|
|
|
R_IMM8, /* type */
|
|
|
|
0, /* rightshift */
|
|
|
|
0, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
8, /* bitsize */
|
|
|
|
FALSE, /* pc_relative */
|
|
|
|
0, /* bitpos */
|
|
|
|
complain_overflow_bitfield, /* complain_on_overflow */
|
|
|
|
0, /* special_function */
|
|
|
|
"r_imm8", /* name */
|
|
|
|
FALSE, /* partial_inplace */
|
|
|
|
0x000000ff, /* src_mask */
|
|
|
|
0x000000ff, /* dst_mask */
|
|
|
|
FALSE), /* pcrel_offset */
|
|
|
|
|
|
|
|
BFD_HOWTO (BFD_RELOC_8_PCREL,
|
|
|
|
R_JR, /* type */
|
|
|
|
0, /* rightshift */
|
|
|
|
0, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
8, /* bitsize */
|
|
|
|
TRUE, /* pc_relative */
|
|
|
|
0, /* bitpos */
|
|
|
|
complain_overflow_signed, /* complain_on_overflow */
|
|
|
|
0, /* special_function */
|
|
|
|
"r_jr", /* name */
|
|
|
|
FALSE, /* partial_inplace */
|
|
|
|
0, /* src_mask */
|
|
|
|
0xFF, /* dst_mask */
|
|
|
|
TRUE), /* pcrel_offset */
|
|
|
|
|
|
|
|
BFD_HOWTO (BFD_RELOC_Z80_DISP8,
|
|
|
|
R_OFF8, /* type */
|
|
|
|
0, /* rightshift */
|
|
|
|
0, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
8, /* bitsize */
|
|
|
|
FALSE, /* pc_relative */
|
|
|
|
0, /* bitpos */
|
|
|
|
complain_overflow_signed, /* complain_on_overflow */
|
|
|
|
0, /* special_function */
|
|
|
|
"r_off8", /* name */
|
|
|
|
FALSE, /* partial_inplace */
|
|
|
|
0, /* src_mask */
|
|
|
|
0xff, /* dst_mask */
|
|
|
|
FALSE), /* pcrel_offset */
|
|
|
|
|
|
|
|
BFD_HOWTO (BFD_RELOC_Z80_BYTE0,
|
|
|
|
R_BYTE0, /* type */
|
|
|
|
0, /* rightshift */
|
|
|
|
0, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
8, /* bitsize */
|
|
|
|
FALSE, /* pc_relative */
|
|
|
|
0, /* bitpos */
|
|
|
|
complain_overflow_dont, /* complain_on_overflow */
|
|
|
|
0, /* special_function */
|
|
|
|
"r_byte0", /* name */
|
|
|
|
FALSE, /* partial_inplace */
|
|
|
|
0, /* src_mask */
|
|
|
|
0xff, /* dst_mask */
|
|
|
|
FALSE), /* pcrel_offset */
|
|
|
|
|
|
|
|
BFD_HOWTO (BFD_RELOC_Z80_BYTE1,
|
|
|
|
R_BYTE1, /* type */
|
|
|
|
8, /* rightshift */
|
|
|
|
0, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
8, /* bitsize */
|
|
|
|
FALSE, /* pc_relative */
|
|
|
|
0, /* bitpos */
|
|
|
|
complain_overflow_dont, /* complain_on_overflow */
|
|
|
|
0, /* special_function */
|
|
|
|
"r_byte1", /* name */
|
|
|
|
FALSE, /* partial_inplace */
|
|
|
|
0, /* src_mask */
|
|
|
|
0xff, /* dst_mask */
|
|
|
|
FALSE), /* pcrel_offset */
|
|
|
|
|
|
|
|
BFD_HOWTO (BFD_RELOC_Z80_BYTE2,
|
|
|
|
R_BYTE2, /* type */
|
|
|
|
16, /* rightshift */
|
|
|
|
0, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
8, /* bitsize */
|
|
|
|
FALSE, /* pc_relative */
|
|
|
|
0, /* bitpos */
|
|
|
|
complain_overflow_dont, /* complain_on_overflow */
|
|
|
|
0, /* special_function */
|
|
|
|
"r_byte2", /* name */
|
|
|
|
FALSE, /* partial_inplace */
|
|
|
|
0, /* src_mask */
|
|
|
|
0xff, /* dst_mask */
|
|
|
|
FALSE), /* pcrel_offset */
|
|
|
|
|
|
|
|
BFD_HOWTO (BFD_RELOC_Z80_BYTE3,
|
|
|
|
R_BYTE3, /* type */
|
|
|
|
24, /* rightshift */
|
|
|
|
0, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
8, /* bitsize */
|
|
|
|
FALSE, /* pc_relative */
|
|
|
|
0, /* bitpos */
|
|
|
|
complain_overflow_dont, /* complain_on_overflow */
|
|
|
|
0, /* special_function */
|
|
|
|
"r_byte3", /* name */
|
|
|
|
FALSE, /* partial_inplace */
|
|
|
|
0, /* src_mask */
|
|
|
|
0xff, /* dst_mask */
|
|
|
|
FALSE), /* pcrel_offset */
|
|
|
|
|
|
|
|
BFD_HOWTO (BFD_RELOC_Z80_WORD0,
|
|
|
|
R_WORD0, /* type */
|
|
|
|
0, /* rightshift */
|
|
|
|
0, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
16, /* bitsize */
|
|
|
|
FALSE, /* pc_relative */
|
|
|
|
0, /* bitpos */
|
|
|
|
complain_overflow_dont, /* complain_on_overflow */
|
|
|
|
0, /* special_function */
|
|
|
|
"r_word0", /* name */
|
|
|
|
FALSE, /* partial_inplace */
|
|
|
|
0, /* src_mask */
|
|
|
|
0xffff, /* dst_mask */
|
|
|
|
FALSE), /* pcrel_offset */
|
|
|
|
|
|
|
|
BFD_HOWTO (BFD_RELOC_Z80_WORD1,
|
|
|
|
R_WORD1, /* type */
|
|
|
|
16, /* rightshift */
|
|
|
|
0, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
16, /* bitsize */
|
|
|
|
FALSE, /* pc_relative */
|
|
|
|
0, /* bitpos */
|
|
|
|
complain_overflow_dont, /* complain_on_overflow */
|
|
|
|
0, /* special_function */
|
|
|
|
"r_word1", /* name */
|
|
|
|
FALSE, /* partial_inplace */
|
|
|
|
0, /* src_mask */
|
|
|
|
0xffff, /* dst_mask */
|
|
|
|
FALSE), /* pcrel_offset */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define NUM_HOWTOS ARRAY_SIZE (howto_table)
|
2005-10-26 01:40:19 +08:00
|
|
|
|
|
|
|
#define BADMAG(x) Z80BADMAG(x)
|
|
|
|
#define Z80 1 /* Customize coffcode.h. */
|
|
|
|
#define __A_MAGIC_SET__
|
|
|
|
|
|
|
|
/* Code to swap in the reloc. */
|
|
|
|
|
|
|
|
#define SWAP_IN_RELOC_OFFSET H_GET_32
|
|
|
|
#define SWAP_OUT_RELOC_OFFSET H_PUT_32
|
|
|
|
|
|
|
|
#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \
|
|
|
|
dst->r_stuff[0] = 'S'; \
|
|
|
|
dst->r_stuff[1] = 'C';
|
|
|
|
|
|
|
|
/* Code to turn a r_type into a howto ptr, uses the above howto table. */
|
|
|
|
static void
|
|
|
|
rtype2howto (arelent *internal, struct internal_reloc *dst)
|
|
|
|
{
|
2020-01-02 22:10:40 +08:00
|
|
|
unsigned i;
|
|
|
|
for (i = 0; i < NUM_HOWTOS; i++)
|
2005-10-26 01:40:19 +08:00
|
|
|
{
|
2020-01-02 22:10:40 +08:00
|
|
|
if (howto_table[i].howto.type == dst->r_type)
|
|
|
|
{
|
|
|
|
internal->howto = &howto_table[i].howto;
|
|
|
|
return;
|
|
|
|
}
|
2005-10-26 01:40:19 +08:00
|
|
|
}
|
2020-01-02 22:10:40 +08:00
|
|
|
internal->howto = NULL;
|
2005-10-26 01:40:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#define RTYPE2HOWTO(internal, relocentry) rtype2howto (internal, relocentry)
|
|
|
|
|
|
|
|
static reloc_howto_type *
|
|
|
|
coff_z80_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
|
|
|
|
bfd_reloc_code_real_type code)
|
|
|
|
{
|
2020-01-02 22:10:40 +08:00
|
|
|
unsigned i;
|
|
|
|
for (i = 0; i < NUM_HOWTOS; i++)
|
|
|
|
if (howto_table[i].r_type == code)
|
|
|
|
return &howto_table[i].howto;
|
|
|
|
|
|
|
|
BFD_FAIL ();
|
|
|
|
return NULL;
|
2005-10-26 01:40:19 +08:00
|
|
|
}
|
|
|
|
|
2007-03-26 20:23:03 +08:00
|
|
|
static reloc_howto_type *
|
|
|
|
coff_z80_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
|
|
|
|
const char *r_name)
|
|
|
|
{
|
2020-01-02 22:10:40 +08:00
|
|
|
unsigned i;
|
|
|
|
for (i = 0; i < NUM_HOWTOS; i++)
|
|
|
|
if (strcasecmp(howto_table[i].howto.name, r_name) == 0)
|
|
|
|
return &howto_table[i].howto;
|
2007-03-26 20:23:03 +08:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-10-26 01:40:19 +08:00
|
|
|
/* Perform any necessary magic to the addend in a reloc entry. */
|
|
|
|
|
|
|
|
#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
|
|
|
|
cache_ptr->addend = ext_reloc.r_offset;
|
|
|
|
|
|
|
|
#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
|
|
|
|
reloc_processing(relent, reloc, symbols, abfd, section)
|
|
|
|
|
|
|
|
static void
|
|
|
|
reloc_processing (arelent *relent,
|
BFD whitespace fixes
Binutils is supposed to use tabs. In my git config I have
whitespace = indent-with-non-tab,space-before-tab,trailing-space
and I got annoyed enough seeing red in "git diff" output to fix
the problems.
* doc/header.sed: Trim trailing space when splitting lines.
* aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c,
* aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h,
* arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c,
* archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c,
* bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c,
* coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c,
* coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c,
* coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c,
* coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c,
* coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c,
* cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c,
* cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c,
* cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c,
* cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c,
* cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c,
* cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c,
* cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c,
* ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c,
* elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c,
* elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c,
* elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h,
* elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c,
* elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c,
* elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c,
* elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c,
* elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c,
* elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c,
* elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c,
* elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h,
* elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c,
* elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c,
* elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c,
* elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c,
* elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c,
* elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h,
* elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c,
* elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c,
* elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c,
* host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c,
* i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c,
* i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h,
* libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h,
* libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c,
* m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c,
* mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c,
* mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h,
* netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c,
* nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c,
* opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c,
* pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c,
* pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c,
* peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c,
* riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h,
* sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c,
* syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c,
* vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c,
* vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c,
* xsym.c, * xsym.h: Whitespace fixes.
* bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-06 06:56:00 +08:00
|
|
|
struct internal_reloc *reloc,
|
|
|
|
asymbol **symbols,
|
|
|
|
bfd *abfd,
|
|
|
|
asection *section)
|
2005-10-26 01:40:19 +08:00
|
|
|
{
|
|
|
|
relent->address = reloc->r_vaddr;
|
|
|
|
rtype2howto (relent, reloc);
|
|
|
|
|
|
|
|
if (reloc->r_symndx > 0)
|
|
|
|
relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
|
|
|
|
else
|
|
|
|
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
|
|
|
|
|
|
|
relent->addend = reloc->r_offset;
|
|
|
|
relent->address -= section->vma;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
extra_case (bfd *in_abfd,
|
BFD whitespace fixes
Binutils is supposed to use tabs. In my git config I have
whitespace = indent-with-non-tab,space-before-tab,trailing-space
and I got annoyed enough seeing red in "git diff" output to fix
the problems.
* doc/header.sed: Trim trailing space when splitting lines.
* aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c,
* aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h,
* arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c,
* archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c,
* bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c,
* coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c,
* coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c,
* coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c,
* coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c,
* coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c,
* cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c,
* cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c,
* cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c,
* cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c,
* cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c,
* cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c,
* cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c,
* ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c,
* elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c,
* elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c,
* elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h,
* elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c,
* elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c,
* elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c,
* elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c,
* elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c,
* elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c,
* elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c,
* elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h,
* elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c,
* elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c,
* elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c,
* elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c,
* elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c,
* elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h,
* elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c,
* elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c,
* elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c,
* host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c,
* i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c,
* i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h,
* libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h,
* libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c,
* m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c,
* mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c,
* mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h,
* netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c,
* nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c,
* opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c,
* pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c,
* pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c,
* peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c,
* riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h,
* sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c,
* syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c,
* vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c,
* vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c,
* xsym.c, * xsym.h: Whitespace fixes.
* bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-06 06:56:00 +08:00
|
|
|
struct bfd_link_info *link_info,
|
|
|
|
struct bfd_link_order *link_order,
|
|
|
|
arelent *reloc,
|
|
|
|
bfd_byte *data,
|
|
|
|
unsigned int *src_ptr,
|
|
|
|
unsigned int *dst_ptr)
|
2005-10-26 01:40:19 +08:00
|
|
|
{
|
|
|
|
asection * input_section = link_order->u.indirect.section;
|
2020-01-02 22:10:40 +08:00
|
|
|
int val = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
|
2005-10-26 01:40:19 +08:00
|
|
|
|
|
|
|
switch (reloc->howto->type)
|
|
|
|
{
|
|
|
|
case R_OFF8:
|
2020-01-02 22:10:40 +08:00
|
|
|
if (reloc->howto->partial_inplace)
|
|
|
|
val += (signed char)(bfd_get_8 ( in_abfd, data+*src_ptr)
|
|
|
|
& reloc->howto->src_mask);
|
|
|
|
if (val>127 || val<-128) /* Test for overflow. */
|
Return void from linker callbacks
The ldmain.c implementation of these linker callback functions always
return true, so any code handling a false return is dead. What's
more, some of the bfd backends abort if ever a false return is seen,
and there seems to be some confusion in gdb's compile-object-load.c.
The return value was never meant to be "oh yes, a multiple_definition
error occurred", but rather "out of memory or other catastrophic
failure".
This patch removes the status return on the callbacks that always
return true. I kept the return status for "notice" because that one
does happen to need to return "out of memory".
include/
* bfdlink.h (struct bfd_link_callbacks): Update comments.
Return void from multiple_definition, multiple_common,
add_to_set, constructor, warning, undefined_symbol,
reloc_overflow, reloc_dangerous and unattached_reloc.
bfd/
* aoutx.h: Adjust linker callback calls throughout file,
removing dead code.
* bout.c: Likewise.
* coff-alpha.c: Likewise.
* coff-arm.c: Likewise.
* coff-h8300.c: Likewise.
* coff-h8500.c: Likewise.
* coff-i960.c: Likewise.
* coff-mcore.c: Likewise.
* coff-mips.c: Likewise.
* coff-ppc.c: Likewise.
* coff-rs6000.c: Likewise.
* coff-sh.c: Likewise.
* coff-tic80.c: Likewise.
* coff-w65.c: Likewise.
* coff-z80.c: Likewise.
* coff-z8k.c: Likewise.
* coff64-rs6000.c: Likewise.
* cofflink.c: Likewise.
* ecoff.c: Likewise.
* elf-bfd.h: Likewise.
* elf-m10200.c: Likewise.
* elf-m10300.c: Likewise.
* elf32-arc.c: Likewise.
* elf32-arm.c: Likewise.
* elf32-avr.c: Likewise.
* elf32-bfin.c: Likewise.
* elf32-cr16.c: Likewise.
* elf32-cr16c.c: Likewise.
* elf32-cris.c: Likewise.
* elf32-crx.c: Likewise.
* elf32-d10v.c: Likewise.
* elf32-epiphany.c: Likewise.
* elf32-fr30.c: Likewise.
* elf32-frv.c: Likewise.
* elf32-ft32.c: Likewise.
* elf32-h8300.c: Likewise.
* elf32-hppa.c: Likewise.
* elf32-i370.c: Likewise.
* elf32-i386.c: Likewise.
* elf32-i860.c: Likewise.
* elf32-ip2k.c: Likewise.
* elf32-iq2000.c: Likewise.
* elf32-lm32.c: Likewise.
* elf32-m32c.c: Likewise.
* elf32-m32r.c: Likewise.
* elf32-m68hc1x.c: Likewise.
* elf32-m68k.c: Likewise.
* elf32-mep.c: Likewise.
* elf32-metag.c: Likewise.
* elf32-microblaze.c: Likewise.
* elf32-moxie.c: Likewise.
* elf32-msp430.c: Likewise.
* elf32-mt.c: Likewise.
* elf32-nds32.c: Likewise.
* elf32-nios2.c: Likewise.
* elf32-or1k.c: Likewise.
* elf32-ppc.c: Likewise.
* elf32-s390.c: Likewise.
* elf32-score.c: Likewise.
* elf32-score7.c: Likewise.
* elf32-sh.c: Likewise.
* elf32-sh64.c: Likewise.
* elf32-spu.c: Likewise.
* elf32-tic6x.c: Likewise.
* elf32-tilepro.c: Likewise.
* elf32-v850.c: Likewise.
* elf32-vax.c: Likewise.
* elf32-visium.c: Likewise.
* elf32-xstormy16.c: Likewise.
* elf32-xtensa.c: Likewise.
* elf64-alpha.c: Likewise.
* elf64-hppa.c: Likewise.
* elf64-ia64-vms.c: Likewise.
* elf64-mmix.c: Likewise.
* elf64-ppc.c: Likewise.
* elf64-s390.c: Likewise.
* elf64-sh64.c: Likewise.
* elf64-x86-64.c: Likewise.
* elflink.c: Likewise.
* elfnn-aarch64.c: Likewise.
* elfnn-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* elfxx-sparc.c: Likewise.
* elfxx-tilegx.c: Likewise.
* linker.c: Likewise.
* pdp11.c: Likewise.
* pe-mips.c: Likewise.
* reloc.c: Likewise.
* reloc16.c: Likewise.
* simple.c: Likewise.
* vms-alpha.c: Likewise.
* xcofflink.c: Likewise.
* elf32-rl78.c (get_symbol_value, get_romstart, get_ramstart): Delete
status param. Adjust calls to these and linker callbacks throughout.
* elf32-rx.c: (get_symbol_value, get_gp, get_romstart,
get_ramstart): Delete status param. Adjust calls to these and
linker callbacks throughout.
ld/
* ldmain.c (multiple_definition, multiple_common, add_to_set,
constructor_callback, warning_callback, undefined_symbol,
reloc_overflow, reloc_dangerous, unattached_reloc): Return void.
* emultempl/elf32.em: Adjust callback calls.
gdb/
* compile/compile-object-load.c (link_callbacks_multiple_definition,
link_callbacks_warning, link_callbacks_undefined_symbol,
link_callbacks_undefined_symbol, link_callbacks_reloc_overflow,
link_callbacks_reloc_dangerous,
link_callbacks_unattached_reloc): Return void.
2016-05-27 15:50:55 +08:00
|
|
|
(*link_info->callbacks->reloc_overflow)
|
|
|
|
(link_info, NULL, bfd_asymbol_name (*reloc->sym_ptr_ptr),
|
|
|
|
reloc->howto->name, reloc->addend, input_section->owner,
|
|
|
|
input_section, reloc->address);
|
|
|
|
|
2005-10-26 01:40:19 +08:00
|
|
|
bfd_put_8 (in_abfd, val, data + *dst_ptr);
|
|
|
|
(*dst_ptr) += 1;
|
|
|
|
(*src_ptr) += 1;
|
|
|
|
break;
|
|
|
|
|
2020-01-02 22:10:40 +08:00
|
|
|
case R_BYTE3:
|
|
|
|
bfd_put_8 (in_abfd, val >> 24, data + *dst_ptr);
|
|
|
|
(*dst_ptr) += 1;
|
|
|
|
(*src_ptr) += 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case R_BYTE2:
|
|
|
|
bfd_put_8 (in_abfd, val >> 16, data + *dst_ptr);
|
|
|
|
(*dst_ptr) += 1;
|
|
|
|
(*src_ptr) += 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case R_BYTE1:
|
|
|
|
bfd_put_8 (in_abfd, val >> 8, data + *dst_ptr);
|
|
|
|
(*dst_ptr) += 1;
|
|
|
|
(*src_ptr) += 1;
|
|
|
|
break;
|
|
|
|
|
2005-10-26 01:40:19 +08:00
|
|
|
case R_IMM8:
|
2020-01-02 22:10:40 +08:00
|
|
|
if (reloc->howto->partial_inplace)
|
|
|
|
val += bfd_get_8 ( in_abfd, data+*src_ptr) & reloc->howto->src_mask;
|
|
|
|
//fallthrough
|
|
|
|
case R_BYTE0:
|
2005-10-26 01:40:19 +08:00
|
|
|
bfd_put_8 (in_abfd, val, data + *dst_ptr);
|
|
|
|
(*dst_ptr) += 1;
|
|
|
|
(*src_ptr) += 1;
|
|
|
|
break;
|
|
|
|
|
2020-01-02 22:10:40 +08:00
|
|
|
case R_WORD1:
|
|
|
|
bfd_put_16 (in_abfd, val >> 16, data + *dst_ptr);
|
|
|
|
(*dst_ptr) += 2;
|
|
|
|
(*src_ptr) += 2;
|
|
|
|
break;
|
|
|
|
|
2005-10-26 01:40:19 +08:00
|
|
|
case R_IMM16:
|
2020-01-02 22:10:40 +08:00
|
|
|
if (reloc->howto->partial_inplace)
|
|
|
|
val += bfd_get_16 ( in_abfd, data+*src_ptr) & reloc->howto->src_mask;
|
|
|
|
//fallthrough
|
|
|
|
case R_WORD0:
|
2005-10-26 01:40:19 +08:00
|
|
|
bfd_put_16 (in_abfd, val, data + *dst_ptr);
|
|
|
|
(*dst_ptr) += 2;
|
|
|
|
(*src_ptr) += 2;
|
|
|
|
break;
|
|
|
|
|
2006-02-05 19:57:35 +08:00
|
|
|
case R_IMM24:
|
2020-01-02 22:10:40 +08:00
|
|
|
if (reloc->howto->partial_inplace)
|
|
|
|
val += (bfd_get_16 ( in_abfd, data+*src_ptr)
|
|
|
|
+ (bfd_get_8 ( in_abfd, data+*src_ptr+2) << 16))
|
|
|
|
& reloc->howto->src_mask;
|
2006-02-05 19:57:35 +08:00
|
|
|
bfd_put_16 (in_abfd, val, data + *dst_ptr);
|
|
|
|
bfd_put_8 (in_abfd, val >> 16, data + *dst_ptr+2);
|
|
|
|
(*dst_ptr) += 3;
|
|
|
|
(*src_ptr) += 3;
|
|
|
|
break;
|
|
|
|
|
2005-10-26 01:40:19 +08:00
|
|
|
case R_IMM32:
|
2020-01-02 22:10:40 +08:00
|
|
|
if (reloc->howto->partial_inplace)
|
|
|
|
val += bfd_get_32 ( in_abfd, data+*src_ptr) & reloc->howto->src_mask;
|
2005-10-26 01:40:19 +08:00
|
|
|
bfd_put_32 (in_abfd, val, data + *dst_ptr);
|
|
|
|
(*dst_ptr) += 4;
|
|
|
|
(*src_ptr) += 4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case R_JR:
|
|
|
|
{
|
2020-01-02 22:10:40 +08:00
|
|
|
if (reloc->howto->partial_inplace)
|
|
|
|
val += (signed char)(bfd_get_8 ( in_abfd, data+*src_ptr)
|
|
|
|
& reloc->howto->src_mask);
|
2005-12-27 11:06:27 +08:00
|
|
|
bfd_vma dot = (*dst_ptr
|
|
|
|
+ input_section->output_offset
|
2005-10-26 01:40:19 +08:00
|
|
|
+ input_section->output_section->vma);
|
2020-01-02 22:10:40 +08:00
|
|
|
int gap = val - dot;
|
2005-10-26 01:40:19 +08:00
|
|
|
if (gap >= 128 || gap < -128)
|
Return void from linker callbacks
The ldmain.c implementation of these linker callback functions always
return true, so any code handling a false return is dead. What's
more, some of the bfd backends abort if ever a false return is seen,
and there seems to be some confusion in gdb's compile-object-load.c.
The return value was never meant to be "oh yes, a multiple_definition
error occurred", but rather "out of memory or other catastrophic
failure".
This patch removes the status return on the callbacks that always
return true. I kept the return status for "notice" because that one
does happen to need to return "out of memory".
include/
* bfdlink.h (struct bfd_link_callbacks): Update comments.
Return void from multiple_definition, multiple_common,
add_to_set, constructor, warning, undefined_symbol,
reloc_overflow, reloc_dangerous and unattached_reloc.
bfd/
* aoutx.h: Adjust linker callback calls throughout file,
removing dead code.
* bout.c: Likewise.
* coff-alpha.c: Likewise.
* coff-arm.c: Likewise.
* coff-h8300.c: Likewise.
* coff-h8500.c: Likewise.
* coff-i960.c: Likewise.
* coff-mcore.c: Likewise.
* coff-mips.c: Likewise.
* coff-ppc.c: Likewise.
* coff-rs6000.c: Likewise.
* coff-sh.c: Likewise.
* coff-tic80.c: Likewise.
* coff-w65.c: Likewise.
* coff-z80.c: Likewise.
* coff-z8k.c: Likewise.
* coff64-rs6000.c: Likewise.
* cofflink.c: Likewise.
* ecoff.c: Likewise.
* elf-bfd.h: Likewise.
* elf-m10200.c: Likewise.
* elf-m10300.c: Likewise.
* elf32-arc.c: Likewise.
* elf32-arm.c: Likewise.
* elf32-avr.c: Likewise.
* elf32-bfin.c: Likewise.
* elf32-cr16.c: Likewise.
* elf32-cr16c.c: Likewise.
* elf32-cris.c: Likewise.
* elf32-crx.c: Likewise.
* elf32-d10v.c: Likewise.
* elf32-epiphany.c: Likewise.
* elf32-fr30.c: Likewise.
* elf32-frv.c: Likewise.
* elf32-ft32.c: Likewise.
* elf32-h8300.c: Likewise.
* elf32-hppa.c: Likewise.
* elf32-i370.c: Likewise.
* elf32-i386.c: Likewise.
* elf32-i860.c: Likewise.
* elf32-ip2k.c: Likewise.
* elf32-iq2000.c: Likewise.
* elf32-lm32.c: Likewise.
* elf32-m32c.c: Likewise.
* elf32-m32r.c: Likewise.
* elf32-m68hc1x.c: Likewise.
* elf32-m68k.c: Likewise.
* elf32-mep.c: Likewise.
* elf32-metag.c: Likewise.
* elf32-microblaze.c: Likewise.
* elf32-moxie.c: Likewise.
* elf32-msp430.c: Likewise.
* elf32-mt.c: Likewise.
* elf32-nds32.c: Likewise.
* elf32-nios2.c: Likewise.
* elf32-or1k.c: Likewise.
* elf32-ppc.c: Likewise.
* elf32-s390.c: Likewise.
* elf32-score.c: Likewise.
* elf32-score7.c: Likewise.
* elf32-sh.c: Likewise.
* elf32-sh64.c: Likewise.
* elf32-spu.c: Likewise.
* elf32-tic6x.c: Likewise.
* elf32-tilepro.c: Likewise.
* elf32-v850.c: Likewise.
* elf32-vax.c: Likewise.
* elf32-visium.c: Likewise.
* elf32-xstormy16.c: Likewise.
* elf32-xtensa.c: Likewise.
* elf64-alpha.c: Likewise.
* elf64-hppa.c: Likewise.
* elf64-ia64-vms.c: Likewise.
* elf64-mmix.c: Likewise.
* elf64-ppc.c: Likewise.
* elf64-s390.c: Likewise.
* elf64-sh64.c: Likewise.
* elf64-x86-64.c: Likewise.
* elflink.c: Likewise.
* elfnn-aarch64.c: Likewise.
* elfnn-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* elfxx-sparc.c: Likewise.
* elfxx-tilegx.c: Likewise.
* linker.c: Likewise.
* pdp11.c: Likewise.
* pe-mips.c: Likewise.
* reloc.c: Likewise.
* reloc16.c: Likewise.
* simple.c: Likewise.
* vms-alpha.c: Likewise.
* xcofflink.c: Likewise.
* elf32-rl78.c (get_symbol_value, get_romstart, get_ramstart): Delete
status param. Adjust calls to these and linker callbacks throughout.
* elf32-rx.c: (get_symbol_value, get_gp, get_romstart,
get_ramstart): Delete status param. Adjust calls to these and
linker callbacks throughout.
ld/
* ldmain.c (multiple_definition, multiple_common, add_to_set,
constructor_callback, warning_callback, undefined_symbol,
reloc_overflow, reloc_dangerous, unattached_reloc): Return void.
* emultempl/elf32.em: Adjust callback calls.
gdb/
* compile/compile-object-load.c (link_callbacks_multiple_definition,
link_callbacks_warning, link_callbacks_undefined_symbol,
link_callbacks_undefined_symbol, link_callbacks_reloc_overflow,
link_callbacks_reloc_dangerous,
link_callbacks_unattached_reloc): Return void.
2016-05-27 15:50:55 +08:00
|
|
|
(*link_info->callbacks->reloc_overflow)
|
|
|
|
(link_info, NULL, bfd_asymbol_name (*reloc->sym_ptr_ptr),
|
|
|
|
reloc->howto->name, reloc->addend, input_section->owner,
|
|
|
|
input_section, reloc->address);
|
|
|
|
|
2005-10-26 01:40:19 +08:00
|
|
|
bfd_put_8 (in_abfd, gap, data + *dst_ptr);
|
|
|
|
(*dst_ptr)++;
|
|
|
|
(*src_ptr)++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-02 22:10:40 +08:00
|
|
|
static int
|
|
|
|
z80_is_local_label_name (bfd * abfd ATTRIBUTE_UNUSED,
|
|
|
|
const char * name)
|
|
|
|
{
|
|
|
|
return (name[0] == '.' && name[1] == 'L') ||
|
|
|
|
_bfd_coff_is_local_label_name (abfd, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define coff_bfd_is_local_label_name z80_is_local_label_name
|
|
|
|
|
2005-10-26 01:40:19 +08:00
|
|
|
#define coff_reloc16_extra_cases extra_case
|
|
|
|
#define coff_bfd_reloc_type_lookup coff_z80_reloc_type_lookup
|
2007-03-26 20:23:03 +08:00
|
|
|
#define coff_bfd_reloc_name_lookup coff_z80_reloc_name_lookup
|
2005-10-26 01:40:19 +08:00
|
|
|
|
2008-07-18 19:30:22 +08:00
|
|
|
#ifndef bfd_pe_print_pdata
|
|
|
|
#define bfd_pe_print_pdata NULL
|
|
|
|
#endif
|
|
|
|
|
2005-10-26 01:40:19 +08:00
|
|
|
#include "coffcode.h"
|
|
|
|
|
|
|
|
#undef coff_bfd_get_relocated_section_contents
|
|
|
|
#define coff_bfd_get_relocated_section_contents \
|
|
|
|
bfd_coff_reloc16_get_relocated_section_contents
|
|
|
|
|
|
|
|
#undef coff_bfd_relax_section
|
|
|
|
#define coff_bfd_relax_section bfd_coff_reloc16_relax_section
|
|
|
|
|
bfd target vector rationalisation
This renames the bfd targets to <cpu>_<format>_<other>_<endian>_vec.
So for example, bfd_elf32_ntradlittlemips_vec becomes
mips_elf32_ntrad_le_vec and hp300bsd_vec becomes m68k_aout_hp300bsd_vec.
bfd/
* aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-ns32k.c,
* aout-sparcle.c, * aout0.c, * aoutx.h, * armnetbsd.c, * bout.c,
* cf-i386lynx.c, * cf-sparclynx.c, * cisco-core.c, * coff-alpha.c,
* coff-apollo.c, * coff-arm.c, * coff-aux.c, * coff-go32.c,
* coff-h8300.c, * coff-h8500.c, * coff-i386.c, * coff-i860.c,
* coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mips.c,
* coff-rs6000.c, * coff-sh.c, * coff-sparc.c, * coff-stgo32.c,
* coff-svm68k.c, * coff-tic80.c, * coff-u68k.c, * coff-w65.c,
* coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c,
* coff64-rs6000.c, * config.bfd, * configure.com, * configure.in,
* demo64.c, * elf-m10200.c, * elf-m10300.c, * elf32-am33lin.c,
* elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c,
* elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c,
* elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c,
* elf32-fr30.c, * elf32-frv.c, * elf32-gen.c, * elf32-h8300.c,
* elf32-hppa.c, * elf32-i370.c, * elf32-i386.c, * elf32-i860.c,
* elf32-i960.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c,
* elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c,
* elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c,
* elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c,
* elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c,
* elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-rl78.c,
* elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-sh-symbian.c,
* elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c,
* elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilepro.c, * elf32-v850.c,
* elf32-vax.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xstormy16.c,
* elf32-xtensa.c, * elf64-alpha.c, * elf64-gen.c, * elf64-hppa.c,
* elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c,
* elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c,
* elf64-x86-64.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c,
* epoc-pe-arm.c, * epoc-pei-arm.c, * hp300bsd.c, * hp300hpux.c,
* hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386bsd.c,
* i386dynix.c, * i386freebsd.c, * i386linux.c, * i386lynx.c,
* i386mach3.c, * i386msdos.c, * i386netbsd.c, * i386os9k.c,
* irix-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c,
* m88kmach3.c, * m88kopenbsd.c, * mach-o-i386.c, * mach-o-x86-64.c,
* makefile.vms, * mipsbsd.c, * mmo.c, * netbsd-core.c, * newsos3.c,
* nlm32-alpha.c, * nlm32-i386.c, * nlm32-ppc.c, * nlm32-sparc.c,
* ns32knetbsd.c, * osf-core.c, * pc532-mach.c, * pe-arm-wince.c,
* pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-ppc.c,
* pe-sh.c, * pe-x86_64.c, * pei-arm-wince.c, * pei-arm.c,
* pei-i386.c, * pei-ia64.c, * pei-mcore.c, * pei-mips.c, * pei-ppc.c,
* pei-sh.c, * pei-x86_64.c, * ppcboot.c, * ptrace-core.c, * riscix.c,
* sco5-core.c, * som.c, * sparclinux.c, * sparclynx.c,
* sparcnetbsd.c, * sunos.c, * targets.c, * trad-core.c,
* vax1knetbsd.c, * vaxbsd.c, * vaxnetbsd.c, * versados.c,
* vms-alpha.c, * vms-lib.c: Rename bfd targets to
<cpu>_<format>_<other>_<endian>_vec. Adjust associated MY macros
on aout targets.
* configure: Regenerate.
binutils/
* emul_aix.c: Update bfd target vector naming.
* testsuite/binutils-all/objcopy.exp: Likewise.
ld/
* emultempl/metagelf.em: Update bfd target vector naming.
* emultempl/nios2elf.em: Likewise.
* emultempl/spuelf.em: Likewise.
* emultempl/tic6xdsbt.em: Likewise.
2014-05-02 18:39:40 +08:00
|
|
|
CREATE_LITTLE_COFF_TARGET_VEC (z80_coff_vec, "coff-z80", 0,
|
2013-01-11 04:03:55 +08:00
|
|
|
SEC_CODE | SEC_DATA, '\0', NULL,
|
2005-10-26 01:40:19 +08:00
|
|
|
COFF_SWAP_TABLE)
|
|
|
|
|