mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 04:00:07 +08:00
(enum bfd_reloc_code_real): Put simple power-to-two relocs together, and add
64-bit versions. Also add sparc v9 reloc types. (bfd_generic_get_relocated_section_contents): Argument to alloca is size_t.
This commit is contained in:
47
bfd/reloc.c
47
bfd/reloc.c
@ -567,8 +567,8 @@ DEFUN(bfd_perform_relocation,(abfd,
|
|||||||
{
|
{
|
||||||
/* We can detect overflow safely here */
|
/* We can detect overflow safely here */
|
||||||
|
|
||||||
bfd_signed_vma reloc_max = (~(1 << (howto->bitsize - 1)));
|
bfd_signed_vma reloc_max = (1 << (howto->bitsize - 1))-1;
|
||||||
bfd_signed_vma reloc_min = (-reloc_max - 1);
|
bfd_signed_vma reloc_min = ~(reloc_max);
|
||||||
|
|
||||||
if ((bfd_signed_vma) relocation > reloc_max
|
if ((bfd_signed_vma) relocation > reloc_max
|
||||||
|| (bfd_signed_vma) relocation < reloc_min)
|
|| (bfd_signed_vma) relocation < reloc_min)
|
||||||
@ -698,17 +698,27 @@ CODE_FRAGMENT
|
|||||||
.typedef enum bfd_reloc_code_real
|
.typedef enum bfd_reloc_code_real
|
||||||
.
|
.
|
||||||
.{
|
.{
|
||||||
|
. {* 64 bits wide, simple reloc *}
|
||||||
|
. BFD_RELOC_64,
|
||||||
|
. {* 64 bits, PC-relative *}
|
||||||
|
. BFD_RELOC_64_PCREL,
|
||||||
|
.
|
||||||
|
. {* 32 bits wide, simple reloc *}
|
||||||
|
. BFD_RELOC_32,
|
||||||
|
. {* 32 bits, PC-relative *}
|
||||||
|
. BFD_RELOC_32_PCREL,
|
||||||
|
.
|
||||||
. {* 16 bits wide, simple reloc *}
|
. {* 16 bits wide, simple reloc *}
|
||||||
. BFD_RELOC_16,
|
. BFD_RELOC_16,
|
||||||
.
|
. {* 16 bits, PC-relative *}
|
||||||
. {* 8 bits wide, but used to form an address like 0xffnn *}
|
. BFD_RELOC_16_PCREL,
|
||||||
. BFD_RELOC_8_FFnn,
|
|
||||||
.
|
.
|
||||||
. {* 8 bits wide, simple *}
|
. {* 8 bits wide, simple *}
|
||||||
. BFD_RELOC_8,
|
. BFD_RELOC_8,
|
||||||
.
|
|
||||||
. {* 8 bits wide, pc relative *}
|
. {* 8 bits wide, pc relative *}
|
||||||
. BFD_RELOC_8_PCREL,
|
. BFD_RELOC_8_PCREL,
|
||||||
|
. {* 8 bits wide, but used to form an address like 0xffnn *}
|
||||||
|
. BFD_RELOC_8_FFnn,
|
||||||
.
|
.
|
||||||
. {* The type of reloc used to build a contructor table - at the
|
. {* The type of reloc used to build a contructor table - at the
|
||||||
. moment probably a 32 bit wide abs address, but the cpu can
|
. moment probably a 32 bit wide abs address, but the cpu can
|
||||||
@ -716,11 +726,6 @@ CODE_FRAGMENT
|
|||||||
.
|
.
|
||||||
. BFD_RELOC_CTOR,
|
. BFD_RELOC_CTOR,
|
||||||
.
|
.
|
||||||
. {* 32 bits wide, simple reloc *}
|
|
||||||
. BFD_RELOC_32,
|
|
||||||
. {* 32 bits, PC-relative *}
|
|
||||||
. BFD_RELOC_32_PCREL,
|
|
||||||
.
|
|
||||||
. {* High 22 bits of 32-bit value; simple reloc. *}
|
. {* High 22 bits of 32-bit value; simple reloc. *}
|
||||||
. BFD_RELOC_HI22,
|
. BFD_RELOC_HI22,
|
||||||
. {* Low 10 bits. *}
|
. {* Low 10 bits. *}
|
||||||
@ -730,7 +735,6 @@ CODE_FRAGMENT
|
|||||||
. BFD_RELOC_24_PCREL,
|
. BFD_RELOC_24_PCREL,
|
||||||
. BFD_RELOC_I960_CALLJ,
|
. BFD_RELOC_I960_CALLJ,
|
||||||
.
|
.
|
||||||
. BFD_RELOC_16_PCREL,
|
|
||||||
. {* 32-bit pc-relative, shifted right 2 bits (i.e., 30-bit
|
. {* 32-bit pc-relative, shifted right 2 bits (i.e., 30-bit
|
||||||
. word displacement, e.g. for SPARC) *}
|
. word displacement, e.g. for SPARC) *}
|
||||||
. BFD_RELOC_32_PCREL_S2,
|
. BFD_RELOC_32_PCREL_S2,
|
||||||
@ -756,6 +760,22 @@ CODE_FRAGMENT
|
|||||||
. {* this one is a.out specific? *}
|
. {* this one is a.out specific? *}
|
||||||
. BFD_RELOC_SPARC_BASE22,
|
. BFD_RELOC_SPARC_BASE22,
|
||||||
.
|
.
|
||||||
|
. {* start-sanitize-v9 *}
|
||||||
|
. BFD_RELOC_SPARC_WDISP19,
|
||||||
|
. BFD_RELOC_SPARC_10,
|
||||||
|
. BFD_RELOC_SPARC_11,
|
||||||
|
.#define BFD_RELOC_SPARC_64 BFD_RELOC_64
|
||||||
|
. BFD_RELOC_SPARC_OLO10,
|
||||||
|
. BFD_RELOC_SPARC_HH22,
|
||||||
|
. BFD_RELOC_SPARC_HM10,
|
||||||
|
. BFD_RELOC_SPARC_LM22,
|
||||||
|
. BFD_RELOC_SPARC_PC_HH22,
|
||||||
|
. BFD_RELOC_SPARC_PC_HM10,
|
||||||
|
. BFD_RELOC_SPARC_PC_LM22,
|
||||||
|
. BFD_RELOC_SPARC_WDISP16,
|
||||||
|
. BFD_RELOC_SPARC_GLOB_JMP,
|
||||||
|
. BFD_RELOC_SPARC_LO7,
|
||||||
|
. {* end-sanitize-v9 *}
|
||||||
. {* Bits 27..2 of the relocation address shifted right 2 bits;
|
. {* Bits 27..2 of the relocation address shifted right 2 bits;
|
||||||
. simple reloc otherwise. *}
|
. simple reloc otherwise. *}
|
||||||
. BFD_RELOC_MIPS_JMP,
|
. BFD_RELOC_MIPS_JMP,
|
||||||
@ -1006,8 +1026,7 @@ DEFUN(bfd_generic_get_relocated_section_contents,(abfd,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bfd_size_type reloc_size = bfd_get_reloc_upper_bound(input_bfd,
|
size_t reloc_size = bfd_get_reloc_upper_bound(input_bfd, input_section);
|
||||||
input_section);
|
|
||||||
arelent **reloc_vector = (arelent **) alloca(reloc_size);
|
arelent **reloc_vector = (arelent **) alloca(reloc_size);
|
||||||
|
|
||||||
/* read in the section */
|
/* read in the section */
|
||||||
|
Reference in New Issue
Block a user