aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/reloc.c2
-rw-r--r--include/ChangeLog10
-rw-r--r--include/coff/i386.h11
-rw-r--r--include/coff/internal.h142
-rw-r--r--include/coff/ti.h22
-rw-r--r--include/coff/x86_64.h29
-rw-r--r--include/coff/z80.h16
-rw-r--r--include/coff/z8k.h11
9 files changed, 97 insertions, 150 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a056a14..0e518ce 100644
--- a/bfd/ChangeLog
+++ b/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>
PR 27484
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 4f4b95a..a754718 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -51,7 +51,7 @@ SECTION
#include "bfdlink.h"
#include "libbfd.h"
#include "bfdver.h"
-#include "coff/internal.h"
+#include "coff/x86_64.h"
/*
DOCDD
INODE
diff --git a/include/ChangeLog b/include/ChangeLog
index d287b78..7c53c21 100644
--- a/include/ChangeLog
+++ b/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>
* ctf-api.h (CTF_LINK_SHARE_DUPLICATED): Note that this might
diff --git a/include/coff/i386.h b/include/coff/i386.h
index 4372194..dd2eda1 100644
--- a/include/coff/i386.h
+++ b/include/coff/i386.h
@@ -91,3 +91,14 @@ struct external_reloc
#define RELOC struct external_reloc
#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
diff --git a/include/coff/internal.h b/include/coff/internal.h
index 8e21b4e..1655181 100644
--- a/include/coff/internal.h
+++ b/include/coff/internal.h
@@ -668,146 +668,4 @@ struct internal_reloc
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 */
diff --git a/include/coff/ti.h b/include/coff/ti.h
index fc246ee..5d242d1 100644
--- a/include/coff/ti.h
+++ b/include/coff/ti.h
@@ -549,12 +549,20 @@ struct external_reloc
do memset (dst->r_reserved, 0, sizeof (dst->r_reserved)); while (0)
/* various relocation types. */
-#define R_ABS 0x0000 /* no relocation */
-#define R_REL13 0x002A /* 13-bit direct reference (???) */
-#define R_PARTLS7 0x0028 /* 7 LSBs of an address */
-#define R_PARTMS9 0x0029 /* 9MSBs of an address */
-#define R_EXTWORD 0x002B /* 23-bit direct reference */
-#define R_EXTWORD16 0x002C /* 16-bit direct reference to 23-bit addr*/
-#define R_EXTWORDMS7 0x002D /* upper 7 bits of 23-bit address */
+#define R_REL24 5
+#define R_RELWORD 16
+#define R_RELLONG 17
+#define R_PCRWORD 19
+#define R_PCR24 21
+#define R_PARTLS16 32
+#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 */
diff --git a/include/coff/x86_64.h b/include/coff/x86_64.h
index 583b7df..4d3e6e7 100644
--- a/include/coff/x86_64.h
+++ b/include/coff/x86_64.h
@@ -75,3 +75,32 @@ struct external_reloc
#define RELOC struct external_reloc
#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
diff --git a/include/coff/z80.h b/include/coff/z80.h
index d929216..1ba8e45 100644
--- a/include/coff/z80.h
+++ b/include/coff/z80.h
@@ -58,3 +58,19 @@ struct external_reloc
#define RELOC struct external_reloc
#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 */
diff --git a/include/coff/z8k.h b/include/coff/z8k.h
index c1da61c..90ac466 100644
--- a/include/coff/z8k.h
+++ b/include/coff/z8k.h
@@ -47,3 +47,14 @@ struct external_reloc
#define RELOC struct external_reloc
#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 */