Browse Source

Split relocation defines out of coff/internal.h

include/
	* coff/internal.h: Delete obsolete relocation defines.  Move used
	relocation defines..
	* coff/i386.h: ..to here..
	* coff/ti.h: ..and here..
	* coff/x86_64.h: ..and here..
	* coff/z80.h: ..and here..
	* coff/z8k.h: ..and here.
bfd/
	* reloc.c: Include x86_64.h rather than internal.h.
binutils-2_37-branch
Alan Modra 6 years ago
parent
commit
dc83f2d20e
  1. 4
      bfd/ChangeLog
  2. 2
      bfd/reloc.c
  3. 10
      include/ChangeLog
  4. 11
      include/coff/i386.h
  5. 142
      include/coff/internal.h
  6. 22
      include/coff/ti.h
  7. 29
      include/coff/x86_64.h
  8. 16
      include/coff/z80.h
  9. 11
      include/coff/z8k.h

4
bfd/ChangeLog

@ -1,3 +1,7 @@
2021-03-03 Alan Modra <amodra@gmail.com>
* reloc.c: Include x86_64.h rather than internal.h.
2021-03-02 Nick Clifton <nickc@redhat.com> 2021-03-02 Nick Clifton <nickc@redhat.com>
PR 27484 PR 27484

2
bfd/reloc.c

@ -51,7 +51,7 @@ SECTION
#include "bfdlink.h" #include "bfdlink.h"
#include "libbfd.h" #include "libbfd.h"
#include "bfdver.h" #include "bfdver.h"
#include "coff/internal.h" #include "coff/x86_64.h"
/* /*
DOCDD DOCDD
INODE INODE

10
include/ChangeLog

@ -1,3 +1,13 @@
2021-03-03 Alan Modra <amodra@gmail.com>
* coff/internal.h: Delete obsolete relocation defines. Move used
relocation defines..
* coff/i386.h: ..to here..
* coff/ti.h: ..and here..
* coff/x86_64.h: ..and here..
* coff/z80.h: ..and here..
* coff/z8k.h: ..and here.
2021-03-02 Nick Alcock <nick.alcock@oracle.com> 2021-03-02 Nick Alcock <nick.alcock@oracle.com>
* ctf-api.h (CTF_LINK_SHARE_DUPLICATED): Note that this might * ctf-api.h (CTF_LINK_SHARE_DUPLICATED): Note that this might

11
include/coff/i386.h

@ -91,3 +91,14 @@ struct external_reloc
#define RELOC struct external_reloc #define RELOC struct external_reloc
#define RELSZ 10 #define RELSZ 10
/* i386 Relocations. */
#define R_DIR32 6
#define R_IMAGEBASE 7
#define R_SECREL32 11
#define R_RELBYTE 15
#define R_RELWORD 16
#define R_RELLONG 17
#define R_PCRBYTE 18
#define R_PCRWORD 19
#define R_PCRLONG 20

142
include/coff/internal.h

@ -668,146 +668,4 @@ struct internal_reloc
unsigned long r_offset; /* Used by Alpha ECOFF, SPARC, others */ unsigned long r_offset; /* Used by Alpha ECOFF, SPARC, others */
}; };
/* X86-64 relocations. */
#define R_AMD64_ABS 0 /* Reference is absolute, no relocation is necessary. */
#define R_AMD64_DIR64 1 /* 64-bit address (VA). */
#define R_AMD64_DIR32 2 /* 32-bit address (VA) R_DIR32. */
#define R_AMD64_IMAGEBASE 3 /* 32-bit absolute ref w/o base R_IMAGEBASE. */
#define R_AMD64_PCRLONG 4 /* 32-bit relative address from byte following reloc R_PCRLONG. */
#define R_AMD64_PCRLONG_1 5 /* 32-bit relative address from byte distance 1 from reloc. */
#define R_AMD64_PCRLONG_2 6 /* 32-bit relative address from byte distance 2 from reloc. */
#define R_AMD64_PCRLONG_3 7 /* 32-bit relative address from byte distance 3 from reloc. */
#define R_AMD64_PCRLONG_4 8 /* 32-bit relative address from byte distance 4 from reloc. */
#define R_AMD64_PCRLONG_5 9 /* 32-bit relative address from byte distance 5 from reloc. */
#define R_AMD64_SECTION 10 /* Section index. */
#define R_AMD64_SECREL 11 /* 32 bit offset from base of section containing target R_SECREL. */
#define R_AMD64_SECREL7 12 /* 7 bit unsigned offset from base of section containing target. */
#define R_AMD64_TOKEN 13 /* 32 bit metadata token. */
#define R_AMD64_PCRQUAD 14 /* Pseude PC64 relocation - Note: not specified by MS/AMD but need for gas pc-relative 64bit wide relocation generated by ELF. */
/* i386 Relocations. */
#define R_DIR16 1
#define R_REL24 5
#define R_DIR32 6
#define R_IMAGEBASE 7
#define R_SECREL32 11
#define R_RELBYTE 15
#define R_RELWORD 16
#define R_RELLONG 17
#define R_PCRBYTE 18
#define R_PCRWORD 19
#define R_PCRLONG 20
#define R_PCR24 21
#define R_IPRSHORT 24
#define R_IPRLONG 26
#define R_GETSEG 29
#define R_GETPA 30
#define R_TAGWORD 31
#define R_JUMPTARG 32 /* strange 29k 00xx00xx reloc */
#define R_PARTLS16 32
#define R_PARTMS8 33
#define R_PCR16L 128
#define R_PCR26L 129
#define R_VRT16 130
#define R_HVRT16 131
#define R_LVRT16 132
#define R_VRT32 133
/* This reloc identifies mov.b instructions with a 16bit absolute
address. The linker tries to turn insns with this reloc into
an absolute 8-bit address. */
#define R_MOV16B1 0x41
/* This reloc identifies mov.b instructions which had a 16bit
absolute address which have been shortened into a 8-bit
absolute address. */
#define R_MOV16B2 0x42
/* This reloc identifies jmp insns with a 16bit target address;
the linker tries to turn these insns into bra insns with
an 8bit pc-relative target. */
#define R_JMP1 0x43
/* This reloc identifies a bra with an 8-bit pc-relative
target that was formerly a jmp insn with a 16bit target. */
#define R_JMP2 0x44
/* ??? */
#define R_RELLONG_NEG 0x45
/* This reloc identifies jmp insns with a 24bit target address;
the linker tries to turn these insns into bra insns with
an 8bit pc-relative target. */
#define R_JMPL1 0x46
/* This reloc identifies a bra with an 8-bit pc-relative
target that was formerly a jmp insn with a 24bit target. */
#define R_JMPL2 0x47
/* This reloc identifies mov.b instructions with a 24bit absolute
address. The linker tries to turn insns with this reloc into
an absolute 8-bit address. */
#define R_MOV24B1 0x48
/* This reloc identifies mov.b instructions which had a 24bit
absolute address which have been shortened into a 8-bit
absolute address. */
#define R_MOV24B2 0x49
/* An h8300 memory indirect jump/call. Forces the address of the jump/call
target into the function vector (in page zero), and the address of the
vector entry to be placed in the jump/call instruction. */
#define R_MEM_INDIRECT 0x4a
/* This reloc identifies a 16bit pc-relative branch target which was
shortened into an 8bit pc-relative branch target. */
#define R_PCRWORD_B 0x4b
/* This reloc identifies mov.[wl] instructions with a 32/24 bit
absolute address; the linker may turn this into a mov.[wl]
insn with a 16bit absolute address. */
#define R_MOVL1 0x4c
/* This reloc identifies mov.[wl] insns which formerly had
a 32/24bit absolute address and now have a 16bit absolute address. */
#define R_MOVL2 0x4d
/* This reloc identifies a bCC:8 which will have it's condition
inverted and its target redirected to the target of the branch
in the following insn. */
#define R_BCC_INV 0x4e
/* This reloc identifies a jmp instruction that has been deleted. */
#define R_JMP_DEL 0x4f
/* Z8k modes */
#define R_IMM16 0x01 /* 16 bit abs */
#define R_JR 0x02 /* jr 8 bit disp */
#define R_IMM4L 0x23 /* low nibble */
#define R_IMM8 0x22 /* 8 bit abs */
#define R_IMM32 R_RELLONG /* 32 bit abs */
#define R_CALL R_DA /* Absolute address which could be a callr */
#define R_JP R_DA /* Absolute address which could be a jp */
#define R_REL16 0x04 /* 16 bit PC rel */
#define R_CALLR 0x05 /* callr 12 bit disp */
#define R_SEG 0x10 /* set if in segmented mode */
#define R_IMM4H 0x24 /* high nibble */
#define R_DISP7 0x25 /* djnz displacement */
/* Z80 modes */
#define R_OFF8 0x32 /* 8 bit signed abs, for (i[xy]+d) */
#define R_IMM24 0x33 /* 24 bit abs */
#define R_IMM16BE 0x3A /* 16 bit abs, big endian */
/* R_JR, R_IMM8, R_IMM16, R_IMM32 - as for Z8k */
#define R_BYTE0 0x34 /* first (lowest) 8 bits of multibyte value */
#define R_BYTE1 0x35 /* second 8 bits of multibyte value */
#define R_BYTE2 0x36 /* third 8 bits of multibyte value */
#define R_BYTE3 0x37 /* fourth (highest) 8 bits of multibyte value */
#define R_WORD0 0x38 /* lowest 16 bits of 32 or 24 bit value */
#define R_WORD1 0x39 /* highest 16 bits of 32 or 24 bit value */
#endif /* GNU_COFF_INTERNAL_H */ #endif /* GNU_COFF_INTERNAL_H */

22
include/coff/ti.h

@ -549,12 +549,20 @@ struct external_reloc
do memset (dst->r_reserved, 0, sizeof (dst->r_reserved)); while (0) do memset (dst->r_reserved, 0, sizeof (dst->r_reserved)); while (0)
/* various relocation types. */ /* various relocation types. */
#define R_ABS 0x0000 /* no relocation */ #define R_REL24 5
#define R_REL13 0x002A /* 13-bit direct reference (???) */ #define R_RELWORD 16
#define R_PARTLS7 0x0028 /* 7 LSBs of an address */ #define R_RELLONG 17
#define R_PARTMS9 0x0029 /* 9MSBs of an address */ #define R_PCRWORD 19
#define R_EXTWORD 0x002B /* 23-bit direct reference */ #define R_PCR24 21
#define R_EXTWORD16 0x002C /* 16-bit direct reference to 23-bit addr*/ #define R_PARTLS16 32
#define R_EXTWORDMS7 0x002D /* upper 7 bits of 23-bit address */ #define R_PARTMS8 33
#define R_ABS 0 /* no relocation */
#define R_REL13 0x2A /* 13-bit direct reference (???) */
#define R_PARTLS7 0x28 /* 7 LSBs of an address */
#define R_PARTMS9 0x29 /* 9MSBs of an address */
#define R_EXTWORD 0x2B /* 23-bit direct reference */
#define R_EXTWORD16 0x2C /* 16-bit direct reference to 23-bit addr*/
#define R_EXTWORDMS7 0x2D /* upper 7 bits of 23-bit address */
#endif /* COFF_TI_H */ #endif /* COFF_TI_H */

29
include/coff/x86_64.h

@ -75,3 +75,32 @@ struct external_reloc
#define RELOC struct external_reloc #define RELOC struct external_reloc
#define RELSZ 10 #define RELSZ 10
/* X86-64 relocations. */
#define R_AMD64_ABS 0 /* Reference is absolute, no relocation is necessary. */
#define R_AMD64_DIR64 1 /* 64-bit address (VA). */
#define R_AMD64_DIR32 2 /* 32-bit address (VA) R_DIR32. */
#define R_AMD64_IMAGEBASE 3 /* 32-bit absolute ref w/o base R_IMAGEBASE. */
#define R_AMD64_PCRLONG 4 /* 32-bit relative address from byte following reloc R_PCRLONG. */
#define R_AMD64_PCRLONG_1 5 /* 32-bit relative address from byte distance 1 from reloc. */
#define R_AMD64_PCRLONG_2 6 /* 32-bit relative address from byte distance 2 from reloc. */
#define R_AMD64_PCRLONG_3 7 /* 32-bit relative address from byte distance 3 from reloc. */
#define R_AMD64_PCRLONG_4 8 /* 32-bit relative address from byte distance 4 from reloc. */
#define R_AMD64_PCRLONG_5 9 /* 32-bit relative address from byte distance 5 from reloc. */
#define R_AMD64_SECTION 10 /* Section index. */
#define R_AMD64_SECREL 11 /* 32 bit offset from base of section containing target R_SECREL. */
#define R_AMD64_SECREL7 12 /* 7 bit unsigned offset from base of section containing target. */
#define R_AMD64_TOKEN 13 /* 32 bit metadata token. */
#define R_AMD64_PCRQUAD 14 /* Pseude PC64 relocation - Note: not specified by MS/AMD but need for gas pc-relative 64bit wide relocation generated by ELF. */
/* i386 Relocations. */
#define R_DIR32 6
#define R_IMAGEBASE 7
#define R_SECREL32 11
#define R_RELBYTE 15
#define R_RELWORD 16
#define R_RELLONG 17
#define R_PCRBYTE 18
#define R_PCRWORD 19
#define R_PCRLONG 20

16
include/coff/z80.h

@ -58,3 +58,19 @@ struct external_reloc
#define RELOC struct external_reloc #define RELOC struct external_reloc
#define RELSZ 16 #define RELSZ 16
/* Z80 relocations. */
#define R_IMM16 0x01 /* 16 bit abs */
#define R_JR 0x02 /* jr 8 bit disp */
#define R_IMM32 0x11 /* 32 bit abs */
#define R_IMM8 0x22 /* 8 bit abs */
#define R_OFF8 0x32 /* 8 bit signed abs, for (i[xy]+d) */
#define R_IMM24 0x33 /* 24 bit abs */
#define R_IMM16BE 0x3A /* 16 bit abs, big endian */
#define R_BYTE0 0x34 /* first (lowest) 8 bits of multibyte value */
#define R_BYTE1 0x35 /* second 8 bits of multibyte value */
#define R_BYTE2 0x36 /* third 8 bits of multibyte value */
#define R_BYTE3 0x37 /* fourth (highest) 8 bits of multibyte value */
#define R_WORD0 0x38 /* lowest 16 bits of 32 or 24 bit value */
#define R_WORD1 0x39 /* highest 16 bits of 32 or 24 bit value */

11
include/coff/z8k.h

@ -47,3 +47,14 @@ struct external_reloc
#define RELOC struct external_reloc #define RELOC struct external_reloc
#define RELSZ 16 #define RELSZ 16
/* Z8k relocations. */
#define R_IMM16 0x01 /* 16 bit abs */
#define R_JR 0x02 /* jr 8 bit disp */
#define R_IMM32 0x11 /* 32 bit abs */
#define R_IMM8 0x22 /* 8 bit abs */
#define R_IMM4L 0x23 /* low nibble */
#define R_REL16 0x04 /* 16 bit PC rel */
#define R_CALLR 0x05 /* callr 12 bit disp */
#define R_SEG 0x10 /* set if in segmented mode */
#define R_IMM4H 0x24 /* high nibble */
#define R_DISP7 0x25 /* djnz displacement */

Loading…
Cancel
Save