From 86b9b00b99d5ac8ed4de39ad7ea6a7a7694051f3 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 22 Jul 1998 22:01:56 +0000 Subject: [PATCH] Rewrite relocation definition using macros. --- include/elf/alpha.h | 113 ++++++++++++++++++++++++++++++++++++++++ include/elf/arm.h | 35 ++++++++----- include/elf/d10v.h | 24 ++++++--- include/elf/d30v.h | 36 ++++++++----- include/elf/m32r.h | 43 +++++++++------- include/elf/m68k.h | 56 +++++++++++--------- include/elf/mips.h | 7 +++ include/elf/mn10200.h | 25 ++++++--- include/elf/mn10300.h | 10 +++- include/elf/ppc.h | 7 +++ include/elf/sh.h | 46 ++++++++++------- include/elf/sparc.h | 116 ++++++++++++++++++++++++++++-------------- 12 files changed, 381 insertions(+), 137 deletions(-) create mode 100644 include/elf/alpha.h diff --git a/include/elf/alpha.h b/include/elf/alpha.h new file mode 100644 index 00000000000..f6899a7063d --- /dev/null +++ b/include/elf/alpha.h @@ -0,0 +1,113 @@ +/* ALPHA ELF support for BFD. + Copyright (C) 1996, 1998 Free Software Foundation, Inc. + + By Eric Youngdale, . No processor supplement available + for this platform. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* This file holds definitions specific to the ALPHA ELF ABI. Note + that most of this is not actually implemented by BFD. */ + +#ifndef _ELF_ALPHA_H +#define _ELF_ALPHA_H + +/* Processor specific flags for the ELF header e_flags field. */ + +/* All addresses must be below 2GB. */ +#define EF_ALPHA_32BIT 0x00000001 + +/* All relocations needed for relaxation with code movement are present. */ +#define EF_ALPHA_CANRELAX 0x00000002 + +/* Processor specific section flags. */ + +/* This section must be in the global data area. */ +#define SHF_ALPHA_GPREL 0x10000000 + +/* Section contains some sort of debugging information. The exact + format is unspecified. It's probably ECOFF symbols. */ +#define SHT_ALPHA_DEBUG 0x70000001 + +/* Section contains register usage information. */ +#define SHT_ALPHA_REGINFO 0x70000002 + +/* A section of type SHT_MIPS_REGINFO contains the following + structure. */ +typedef struct +{ + /* Mask of general purpose registers used. */ + unsigned long ri_gprmask; + /* Mask of co-processor registers used. */ + unsigned long ri_cprmask[4]; + /* GP register value for this object file. */ + long ri_gp_value; +} Elf64_RegInfo; + +/* Special values for the st_other field in the symbol table. */ + +#define STO_ALPHA_NOPV 0x80 +#define STO_ALPHA_STD_GPLOAD 0x88 + +/* Unless otherwise told we define an enum with the relocation entries. */ +#ifndef START_RELOC_NUMBERS +# define START_RELOC_NUMBERS(name) enum name { +# define RELOC_NUMBER(name, number) name = number , +# define END_RELOC_NUMBERS }; +#endif + +/* Alpha relocs. */ +START_RELOC_NUMBERS (elf_alpha_reloc_type) + RELOC_NUMBER (R_ALPHA_NONE, 0) /* No reloc */ + RELOC_NUMBER (R_ALPHA_REFLONG, 1) /* Direct 32 bit */ + RELOC_NUMBER (R_ALPHA_REFQUAD, 2) /* Direct 64 bit */ + RELOC_NUMBER (R_ALPHA_GPREL32, 3) /* GP relative 32 bit */ + RELOC_NUMBER (R_ALPHA_LITERAL, 4) /* GP relative 16 bit w/optimization */ + RELOC_NUMBER (R_ALPHA_LITUSE, 5) /* Optimization hint for LITERAL */ + RELOC_NUMBER (R_ALPHA_GPDISP, 6) /* Add displacement to GP */ + RELOC_NUMBER (R_ALPHA_BRADDR, 7) /* PC+4 relative 23 bit shifted */ + RELOC_NUMBER (R_ALPHA_HINT, 8) /* PC+4 relative 16 bit shifted */ + RELOC_NUMBER (R_ALPHA_SREL16, 9) /* PC relative 16 bit */ + RELOC_NUMBER (R_ALPHA_SREL32, 10) /* PC relative 32 bit */ + RELOC_NUMBER (R_ALPHA_SREL64, 11) /* PC relative 64 bit */ + +/* Inherited these from ECOFF, but they are not particularly useful + and are depreciated. And not implemented in the BFD, btw. */ + RELOC_NUMBER (R_ALPHA_OP_PUSH, 12) /* OP stack push */ + RELOC_NUMBER (R_ALPHA_OP_STORE, 13) /* OP stack pop and store */ + RELOC_NUMBER (R_ALPHA_OP_PSUB, 14) /* OP stack subtract */ + RELOC_NUMBER (R_ALPHA_OP_PRSHIFT, 15) /* OP stack right shift */ + + RELOC_NUMBER (R_ALPHA_GPVALUE, 16) + RELOC_NUMBER (R_ALPHA_GPRELHIGH, 17) + RELOC_NUMBER (R_ALPHA_GPRELLOW, 18) + RELOC_NUMBER (R_ALPHA_IMMED_GP_16, 19) + RELOC_NUMBER (R_ALPHA_IMMED_GP_HI32, 20) + RELOC_NUMBER (R_ALPHA_IMMED_SCN_HI32, 21) + RELOC_NUMBER (R_ALPHA_IMMED_BR_HI32, 22) + RELOC_NUMBER (R_ALPHA_IMMED_LO32, 23) + +/* These relocations are specific to shared libraries. */ + RELOC_NUMBER (R_ALPHA_COPY, 24) /* Copy symbol at runtime */ + RELOC_NUMBER (R_ALPHA_GLOB_DAT, 25) /* Create GOT entry */ + RELOC_NUMBER (R_ALPHA_JMP_SLOT, 26) /* Create PLT entry */ + RELOC_NUMBER (R_ALPHA_RELATIVE, 27) /* Adjust by program base */ + + RELOC_NUMBER (R_ALPHA_max, 28) +END_RELOC_NUMBERS + +#endif /* _ELF_ALPHA_H */ diff --git a/include/elf/arm.h b/include/elf/arm.h index 64247579a4c..a71feaa7aab 100644 --- a/include/elf/arm.h +++ b/include/elf/arm.h @@ -20,18 +20,27 @@ #ifndef _ELF_ARM_H #define _ELF_ARM_H -/* Relocations. */ -#define R_ARM_NONE 0 /* No reloc */ -#define R_ARM_PC24 1 /* PC relative 26 bit branch */ -#define R_ARM_ABS32 2 /* Direct 32 bit */ -#define R_ARM_REL32 3 /* PC relative 32 bit */ -#define R_ARM_COPY 20 /* Copy symbol at runtime */ -#define R_ARM_GLOB_DAT 21 /* Create GOT entry */ -#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */ -#define R_ARM_RELATIVE 23 /* Adjust by program base */ -#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */ -#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */ -#define R_ARM_GOT32 26 /* 32 bit GOT entry */ -#define R_ARM_PLT32 27 /* 32 bit PLT address */ +/* Unless otherwise told we define an enum with the relocation entries. */ +#ifndef START_RELOC_NUMBERS +# define START_RELOC_NUMBERS(name) enum name { +# define RELOC_NUMBER(name, number) name = number , +# define END_RELOC_NUMBERS }; +#endif + +/* Relocation types. */ +START_RELOC_NUMBERS (elf_arm_reloc_type) + RELOC_NUMBER (R_ARM_NONE, 0) /* No reloc */ + RELOC_NUMBER (R_ARM_PC24, 1) /* PC relative 26 bit branch */ + RELOC_NUMBER (R_ARM_ABS32, 2) /* Direct 32 bit */ + RELOC_NUMBER (R_ARM_REL32, 3) /* PC relative 32 bit */ + RELOC_NUMBER (R_ARM_COPY, 20) /* Copy symbol at runtime */ + RELOC_NUMBER (R_ARM_GLOB_DAT, 21) /* Create GOT entry */ + RELOC_NUMBER (R_ARM_JUMP_SLOT, 22) /* Create PLT entry */ + RELOC_NUMBER (R_ARM_RELATIVE, 23) /* Adjust by program base */ + RELOC_NUMBER (R_ARM_GOTOFF, 24) /* 32 bit offset to GOT */ + RELOC_NUMBER (R_ARM_GOTPC, 25) /* 32 bit PC relative offset to GOT */ + RELOC_NUMBER (R_ARM_GOT32, 26) /* 32 bit GOT entry */ + RELOC_NUMBER (R_ARM_PLT32, 27) /* 32 bit PLT address */ +END_RELOC_NUMBERS #endif diff --git a/include/elf/d10v.h b/include/elf/d10v.h index f0952f226d5..dff8abd1cbc 100644 --- a/include/elf/d10v.h +++ b/include/elf/d10v.h @@ -20,12 +20,22 @@ #ifndef _ELF_D10V_H #define _ELF_D10V_H -#define R_D10V_NONE 0 -#define R_D10V_10_PCREL_R 1 -#define R_D10V_10_PCREL_L 2 -#define R_D10V_16 3 -#define R_D10V_18 4 -#define R_D10V_18_PCREL 5 -#define R_D10V_32 6 +/* Unless otherwise told we define an enum with the relocation entries. */ +#ifndef START_RELOC_NUMBERS +# define START_RELOC_NUMBERS(name) enum name { +# define RELOC_NUMBER(name, number) name = number , +# define END_RELOC_NUMBERS }; +#endif + +/* Relocation types. */ +START_RELOC_NUMBERS (elf_d10v_reloc_type) + RELOC_NUMBER (R_D10V_NONE, 0) + RELOC_NUMBER (R_D10V_10_PCREL_R, 1) + RELOC_NUMBER (R_D10V_10_PCREL_L, 2) + RELOC_NUMBER (R_D10V_16, 3) + RELOC_NUMBER (R_D10V_18, 4) + RELOC_NUMBER (R_D10V_18_PCREL, 5) + RELOC_NUMBER (R_D10V_32, 6) +END_RELOC_NUMBERS #endif diff --git a/include/elf/d30v.h b/include/elf/d30v.h index 23758ea744c..f2aa6c8a00b 100644 --- a/include/elf/d30v.h +++ b/include/elf/d30v.h @@ -20,18 +20,28 @@ #ifndef _ELF_D30V_H #define _ELF_D30V_H -#define R_D30V_NONE 0 -#define R_D30V_6 1 -#define R_D30V_9_PCREL 2 -#define R_D30V_9_PCREL_R 3 -#define R_D30V_15 4 -#define R_D30V_15_PCREL 5 -#define R_D30V_15_PCREL_R 6 -#define R_D30V_21 7 -#define R_D30V_21_PCREL 8 -#define R_D30V_21_PCREL_R 9 -#define R_D30V_32 10 -#define R_D30V_32_PCREL 11 -#define R_D30V_32_NORMAL 12 +/* Unless otherwise told we define an enum with the relocation entries. */ +#ifndef START_RELOC_NUMBERS +# define START_RELOC_NUMBERS(name) enum name { +# define RELOC_NUMBER(name, number) name = number , +# define END_RELOC_NUMBERS }; +#endif + +/* Relocations. */ +START_RELOC_NUMBERS (elf_d30v_reloc_type) + RELOC_NUMBER (R_D30V_NONE, 0) + RELOC_NUMBER (R_D30V_6, 1) + RELOC_NUMBER (R_D30V_9_PCREL, 2) + RELOC_NUMBER (R_D30V_9_PCREL_R, 3) + RELOC_NUMBER (R_D30V_15, 4) + RELOC_NUMBER (R_D30V_15_PCREL, 5) + RELOC_NUMBER (R_D30V_15_PCREL_R, 6) + RELOC_NUMBER (R_D30V_21, 7) + RELOC_NUMBER (R_D30V_21_PCREL, 8) + RELOC_NUMBER (R_D30V_21_PCREL_R, 9) + RELOC_NUMBER (R_D30V_32, 10) + RELOC_NUMBER (R_D30V_32_PCREL, 11) + RELOC_NUMBER (R_D30V_32_NORMAL, 12) +END_RELOC_NUMBERS #endif diff --git a/include/elf/m32r.h b/include/elf/m32r.h index 951b1f58b4b..618e8ae0ccd 100644 --- a/include/elf/m32r.h +++ b/include/elf/m32r.h @@ -1,5 +1,5 @@ /* M32R ELF support for BFD. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -20,21 +20,28 @@ along with this program; if not, write to the Free Software Foundation, Inc., #ifndef _ELF_M32R_H #define _ELF_M32R_H -enum reloc_type -{ - R_M32R_NONE = 0, - R_M32R_16, - R_M32R_32, - R_M32R_24, - R_M32R_10_PCREL, - R_M32R_18_PCREL, - R_M32R_26_PCREL, - R_M32R_HI16_ULO, - R_M32R_HI16_SLO, - R_M32R_LO16, - R_M32R_SDA16, - R_M32R_max -}; +/* Unless otherwise told we define an enum with the relocation entries. */ +#ifndef START_RELOC_NUMBERS +# define START_RELOC_NUMBERS(name) enum name { +# define RELOC_NUMBER(name, number) name = number , +# define END_RELOC_NUMBERS }; +#endif + +/* Relocations. */ +START_RELOC_NUMBERS (elf_m32r_reloc_type) + RELOC_NUMBER (R_M32R_NONE, 0) + RELOC_NUMBER (R_M32R_16, 1) + RELOC_NUMBER (R_M32R_32, 2) + RELOC_NUMBER (R_M32R_24, 3) + RELOC_NUMBER (R_M32R_10_PCREL, 4) + RELOC_NUMBER (R_M32R_18_PCREL, 5) + RELOC_NUMBER (R_M32R_26_PCREL, 6) + RELOC_NUMBER (R_M32R_HI16_ULO, 7) + RELOC_NUMBER (R_M32R_HI16_SLO, 8) + RELOC_NUMBER (R_M32R_LO16, 9) + RELOC_NUMBER (R_M32R_SDA16, 10) + RELOC_NUMBER (R_M32R_max, 11) +END_RELOC_NUMBERS /* Processor specific section indices. These sections do not actually exist. Symbols with a st_shndx field corresponding to one of these @@ -53,12 +60,14 @@ enum reloc_type /* Processor specific flags for the ELF header e_flags field. */ -/* Two bit V850 architecture field. */ +/* Two bit m32r architecture field. */ #define EF_M32R_ARCH 0x30000000 /* m32r code. */ #define E_M32R_ARCH 0x00000000 +/* start-sanitize-m32rx */ /* m32rx code. */ #define E_M32RX_ARCH 0x10000000 +/* end-sanitize-m32rx */ #endif diff --git a/include/elf/m68k.h b/include/elf/m68k.h index aee6cd1e4fc..5d23c28256d 100644 --- a/include/elf/m68k.h +++ b/include/elf/m68k.h @@ -20,28 +20,38 @@ #ifndef _ELF_M68K_H #define _ELF_M68K_H -#define R_68K_NONE 0 /* No reloc */ -#define R_68K_32 1 /* Direct 32 bit */ -#define R_68K_16 2 /* Direct 16 bit */ -#define R_68K_8 3 /* Direct 8 bit */ -#define R_68K_PC32 4 /* PC relative 32 bit */ -#define R_68K_PC16 5 /* PC relative 16 bit */ -#define R_68K_PC8 6 /* PC relative 8 bit */ -#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */ -#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */ -#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */ -#define R_68K_GOT32O 10 /* 32 bit GOT offset */ -#define R_68K_GOT16O 11 /* 16 bit GOT offset */ -#define R_68K_GOT8O 12 /* 8 bit GOT offset */ -#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */ -#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */ -#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */ -#define R_68K_PLT32O 16 /* 32 bit PLT offset */ -#define R_68K_PLT16O 17 /* 16 bit PLT offset */ -#define R_68K_PLT8O 18 /* 8 bit PLT offset */ -#define R_68K_COPY 19 /* Copy symbol at runtime */ -#define R_68K_GLOB_DAT 20 /* Create GOT entry */ -#define R_68K_JMP_SLOT 21 /* Create PLT entry */ -#define R_68K_RELATIVE 22 /* Adjust by program base */ +/* Unless otherwise told we define an enum with the relocation entries. */ +#ifndef START_RELOC_NUMBERS +# define START_RELOC_NUMBERS(name) enum name { +# define RELOC_NUMBER(name, number) name = number , +# define END_RELOC_NUMBERS }; +#endif + +/* Relocation types. */ +START_RELOC_NUMBERS (elf_m68k_reloc_type) + RELOC_NUMBER (R_68K_NONE, 0) /* No reloc */ + RELOC_NUMBER (R_68K_32, 1) /* Direct 32 bit */ + RELOC_NUMBER (R_68K_16, 2) /* Direct 16 bit */ + RELOC_NUMBER (R_68K_8, 3) /* Direct 8 bit */ + RELOC_NUMBER (R_68K_PC32, 4) /* PC relative 32 bit */ + RELOC_NUMBER (R_68K_PC16, 5) /* PC relative 16 bit */ + RELOC_NUMBER (R_68K_PC8, 6) /* PC relative 8 bit */ + RELOC_NUMBER (R_68K_GOT32, 7) /* 32 bit PC relative GOT entry */ + RELOC_NUMBER (R_68K_GOT16, 8) /* 16 bit PC relative GOT entry */ + RELOC_NUMBER (R_68K_GOT8, 9) /* 8 bit PC relative GOT entry */ + RELOC_NUMBER (R_68K_GOT32O, 10) /* 32 bit GOT offset */ + RELOC_NUMBER (R_68K_GOT16O, 11) /* 16 bit GOT offset */ + RELOC_NUMBER (R_68K_GOT8O, 12) /* 8 bit GOT offset */ + RELOC_NUMBER (R_68K_PLT32, 13) /* 32 bit PC relative PLT address */ + RELOC_NUMBER (R_68K_PLT16, 14) /* 16 bit PC relative PLT address */ + RELOC_NUMBER (R_68K_PLT8, 15) /* 8 bit PC relative PLT address */ + RELOC_NUMBER (R_68K_PLT32O, 16) /* 32 bit PLT offset */ + RELOC_NUMBER (R_68K_PLT16O, 17) /* 16 bit PLT offset */ + RELOC_NUMBER (R_68K_PLT8O, 18) /* 8 bit PLT offset */ + RELOC_NUMBER (R_68K_COPY, 19) /* Copy symbol at runtime */ + RELOC_NUMBER (R_68K_GLOB_DAT, 20) /* Create GOT entry */ + RELOC_NUMBER (R_68K_JMP_SLOT, 21) /* Create PLT entry */ + RELOC_NUMBER (R_68K_RELATIVE, 22) /* Adjust by program base */ +END_RELOC_NUMBERS #endif diff --git a/include/elf/mips.h b/include/elf/mips.h index c3efe57a614..0c023dbb711 100644 --- a/include/elf/mips.h +++ b/include/elf/mips.h @@ -27,6 +27,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _ELF_MIPS_H #define _ELF_MIPS_H +/* Unless otherwise told we define an enum with the relocation entries. */ +#ifndef START_RELOC_NUMBERS +# define START_RELOC_NUMBERS(name) enum name { +# define RELOC_NUMBER(name, number) name = number , +# define END_RELOC_NUMBERS }; +#endif + /* Relocation types. */ START_RELOC_NUMBERS (elf_mips_reloc_type) RELOC_NUMBER (R_MIPS_NONE, 0) diff --git a/include/elf/mn10200.h b/include/elf/mn10200.h index edba0555b0c..077c0dd02b2 100644 --- a/include/elf/mn10200.h +++ b/include/elf/mn10200.h @@ -22,14 +22,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _ELF_MN10200_H #define _ELF_MN10200_H +/* Unless otherwise told we define an enum with the relocation entries. */ +#ifndef START_RELOC_NUMBERS +# define START_RELOC_NUMBERS(name) enum name { +# define RELOC_NUMBER(name, number) name = number , +# define END_RELOC_NUMBERS }; +#endif + /* Relocations. */ -#define R_MN10200_NONE 0 -#define R_MN10200_32 1 -#define R_MN10200_16 2 -#define R_MN10200_8 3 -#define R_MN10200_24 4 -#define R_MN10200_PCREL8 5 -#define R_MN10200_PCREL16 6 -#define R_MN10200_PCREL24 7 +START_RELOC_NUMBERS (elf_mn10200_reloc_type) + RELOC_NUMBER (R_MN10200_NONE, 0) + RELOC_NUMBER (R_MN10200_32, 1) + RELOC_NUMBER (R_MN10200_16, 2) + RELOC_NUMBER (R_MN10200_8, 3) + RELOC_NUMBER (R_MN10200_24, 4) + RELOC_NUMBER (R_MN10200_PCREL8, 5) + RELOC_NUMBER (R_MN10200_PCREL16, 6) + RELOC_NUMBER (R_MN10200_PCREL24, 7) +END_RELOC_NUMBERS #endif /* _ELF_MN10200_H */ diff --git a/include/elf/mn10300.h b/include/elf/mn10300.h index 0458af0308b..1d64c40ca0a 100644 --- a/include/elf/mn10300.h +++ b/include/elf/mn10300.h @@ -22,7 +22,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _ELF_MN10300_H #define _ELF_MN10300_H -/* Relocations. Keep this list sorted wrt the numeric value. */ +/* Unless otherwise told we define an enum with the relocation entries. */ +#ifndef START_RELOC_NUMBERS +# define START_RELOC_NUMBERS(name) enum name { +# define RELOC_NUMBER(name, number) name = number , +# define END_RELOC_NUMBERS }; +#endif + +/* Relocations. */ START_RELOC_NUMBERS (elf_mn10300_reloc_type) RELOC_NUMBER (R_MN10300_NONE, 0) RELOC_NUMBER (R_MN10300_32, 1) @@ -33,6 +40,7 @@ START_RELOC_NUMBERS (elf_mn10300_reloc_type) RELOC_NUMBER (R_MN10300_PCREL8, 6) RELOC_NUMBER (R_MN10300_GNU_VTINHERIT, 7) RELOC_NUMBER (R_MN10300_GNU_VTENTRY, 8) + RELOC_NUMBER (R_MN10300_MAX, 9) END_RELOC_NUMBERS /* Machine variant if we know it. This field was invented at Cygnus, diff --git a/include/elf/ppc.h b/include/elf/ppc.h index 1343b32374b..c577fdb1d89 100644 --- a/include/elf/ppc.h +++ b/include/elf/ppc.h @@ -27,6 +27,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _ELF_PPC_H #define _ELF_PPC_H +/* Unless otherwise told we define an enum with the relocation entries. */ +#ifndef START_RELOC_NUMBERS +# define START_RELOC_NUMBERS(name) enum name { +# define RELOC_NUMBER(name, number) name = number , +# define END_RELOC_NUMBERS }; +#endif + /* Relocations. */ START_RELOC_NUMBERS (elf_ppc_reloc_type) RELOC_NUMBER (R_PPC_NONE, 0) diff --git a/include/elf/sh.h b/include/elf/sh.h index eab7c453cc7..e8534791f28 100644 --- a/include/elf/sh.h +++ b/include/elf/sh.h @@ -20,23 +20,33 @@ #ifndef _ELF_SH_H #define _ELF_SH_H -#define R_SH_NONE 0 -#define R_SH_DIR32 1 -#define R_SH_REL32 2 -#define R_SH_DIR8WPN 3 -#define R_SH_IND12W 4 -#define R_SH_DIR8WPL 5 -#define R_SH_DIR8WPZ 6 -#define R_SH_DIR8BP 7 -#define R_SH_DIR8W 8 -#define R_SH_DIR8L 9 -#define R_SH_SWITCH16 25 -#define R_SH_SWITCH32 26 -#define R_SH_USES 27 -#define R_SH_COUNT 28 -#define R_SH_ALIGN 29 -#define R_SH_CODE 30 -#define R_SH_DATA 31 -#define R_SH_LABEL 32 +/* Unless otherwise told we define an enum with the relocation entries. */ +#ifndef START_RELOC_NUMBERS +# define START_RELOC_NUMBERS(name) enum name { +# define RELOC_NUMBER(name, number) name = number , +# define END_RELOC_NUMBERS }; +#endif + +/* Relocations. */ +START_RELOC_NUMBERS (elf_sh_reloc_type) + RELOC_NUMBER (R_SH_NONE, 0) + RELOC_NUMBER (R_SH_DIR32, 1) + RELOC_NUMBER (R_SH_REL32, 2) + RELOC_NUMBER (R_SH_DIR8WPN, 3) + RELOC_NUMBER (R_SH_IND12W, 4) + RELOC_NUMBER (R_SH_DIR8WPL, 5) + RELOC_NUMBER (R_SH_DIR8WPZ, 6) + RELOC_NUMBER (R_SH_DIR8BP, 7) + RELOC_NUMBER (R_SH_DIR8W, 8) + RELOC_NUMBER (R_SH_DIR8L, 9) + RELOC_NUMBER (R_SH_SWITCH16, 25) + RELOC_NUMBER (R_SH_SWITCH32, 26) + RELOC_NUMBER (R_SH_USES, 27) + RELOC_NUMBER (R_SH_COUNT, 28) + RELOC_NUMBER (R_SH_ALIGN, 29) + RELOC_NUMBER (R_SH_CODE, 30) + RELOC_NUMBER (R_SH_DATA, 31) + RELOC_NUMBER (R_SH_LABEL, 32) +END_RELOC_NUMBERS #endif diff --git a/include/elf/sparc.h b/include/elf/sparc.h index 1b5300183a6..91c71e6b5a2 100644 --- a/include/elf/sparc.h +++ b/include/elf/sparc.h @@ -1,5 +1,5 @@ /* SPARC ELF support for BFD. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. By Doug Evans, Cygnus Support, . This file is part of BFD, the Binary File Descriptor library. @@ -30,6 +30,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */ #define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */ +#define EF_SPARC_LEDATA 0x800000 /* little endian data */ + /* This name is used in the V9 ABI. */ #define EF_SPARC_EXT_MASK 0xffff00 /* reserved for vendor extensions */ @@ -53,46 +55,86 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define STT_REGISTER 13 /* global reg reserved to app. */ -/* Relocation types. */ +/* Unless otherwise told we define an enum with the relocation entries. */ +#ifndef START_RELOC_NUMBERS +# define START_RELOC_NUMBERS(name) enum name { +# define RELOC_NUMBER(name, number) name = number , +# define END_RELOC_NUMBERS }; +#endif -enum elf_sparc_reloc_type { - R_SPARC_NONE = 0, - R_SPARC_8, R_SPARC_16, R_SPARC_32, - R_SPARC_DISP8, R_SPARC_DISP16, R_SPARC_DISP32, - R_SPARC_WDISP30, R_SPARC_WDISP22, - R_SPARC_HI22, R_SPARC_22, - R_SPARC_13, R_SPARC_LO10, - R_SPARC_GOT10, R_SPARC_GOT13, R_SPARC_GOT22, - R_SPARC_PC10, R_SPARC_PC22, - R_SPARC_WPLT30, - R_SPARC_COPY, - R_SPARC_GLOB_DAT, R_SPARC_JMP_SLOT, - R_SPARC_RELATIVE, - R_SPARC_UA32, - - /* ??? These 6 relocs are new but not currently used. For binary - compatility in the sparc64-elf toolchain, we leave them out. - A non-binary upward compatible change is expected for sparc64-elf. */ +/* Relocation types. */ +START_RELOC_NUMBERS (elf_sparc_reloc_type) + RELOC_NUMBER (R_SPARC_NONE, 0) + RELOC_NUMBER (R_SPARC_8, 1) + RELOC_NUMBER (R_SPARC_16, 2) + RELOC_NUMBER (R_SPARC_32, 3) + RELOC_NUMBER (R_SPARC_DISP8, 4) + RELOC_NUMBER (R_SPARC_DISP16, 5) + RELOC_NUMBER (R_SPARC_DISP32, 6) + RELOC_NUMBER (R_SPARC_WDISP30, 7) + RELOC_NUMBER (R_SPARC_WDISP22, 8) + RELOC_NUMBER (R_SPARC_HI22, 9) + RELOC_NUMBER (R_SPARC_22, 10) + RELOC_NUMBER (R_SPARC_13, 11) + RELOC_NUMBER (R_SPARC_LO10, 12) + RELOC_NUMBER (R_SPARC_GOT10, 13) + RELOC_NUMBER (R_SPARC_GOT13, 14) + RELOC_NUMBER (R_SPARC_GOT22, 15) + RELOC_NUMBER (R_SPARC_PC10, 16) + RELOC_NUMBER (R_SPARC_PC22, 17) + RELOC_NUMBER (R_SPARC_WPLT30, 18) + RELOC_NUMBER (R_SPARC_COPY, 19) + RELOC_NUMBER (R_SPARC_GLOB_DAT, 20) + RELOC_NUMBER (R_SPARC_JMP_SLOT, 21) + RELOC_NUMBER (R_SPARC_RELATIVE, 22) + RELOC_NUMBER (R_SPARC_UA32, 23) + + /* ??? These 6 relocs are new but not currently used. For binary + compatility in the sparc64-elf toolchain, we leave them out. + A non-binary upward compatible change is expected for sparc64-elf. */ #ifndef SPARC64_OLD_RELOCS - /* ??? New relocs on the UltraSPARC. Not sure what they're for yet. */ - R_SPARC_PLT32, R_SPARC_HIPLT22, R_SPARC_LOPLT10, - R_SPARC_PCPLT32, R_SPARC_PCPLT22, R_SPARC_PCPLT10, + /* ??? New relocs on the UltraSPARC. Not sure what they're for yet. */ + RELOC_NUMBER (R_SPARC_PLT32, 24) + RELOC_NUMBER (R_SPARC_HIPLT22, 25) + RELOC_NUMBER (R_SPARC_LOPLT10, 26) + RELOC_NUMBER (R_SPARC_PCPLT32, 27) + RELOC_NUMBER (R_SPARC_PCPLT22, 28) + RELOC_NUMBER (R_SPARC_PCPLT10, 29) #endif - /* v9 relocs */ - R_SPARC_10, R_SPARC_11, R_SPARC_64, - R_SPARC_OLO10, R_SPARC_HH22, R_SPARC_HM10, R_SPARC_LM22, - R_SPARC_PC_HH22, R_SPARC_PC_HM10, R_SPARC_PC_LM22, - R_SPARC_WDISP16, R_SPARC_WDISP19, - R_SPARC_UNUSED_42, - R_SPARC_7, R_SPARC_5, R_SPARC_6, - R_SPARC_DISP64, R_SPARC_PLT64, - R_SPARC_HIX22, R_SPARC_LOX10, - R_SPARC_H44, R_SPARC_M44, R_SPARC_L44, - R_SPARC_REGISTER, - - R_SPARC_max -}; + /* v9 relocs */ + RELOC_NUMBER (R_SPARC_10, 30) + RELOC_NUMBER (R_SPARC_11, 31) + RELOC_NUMBER (R_SPARC_64, 32) + RELOC_NUMBER (R_SPARC_OLO10, 33) + RELOC_NUMBER (R_SPARC_HH22, 34) + RELOC_NUMBER (R_SPARC_HM10, 35) + RELOC_NUMBER (R_SPARC_LM22, 36) + RELOC_NUMBER (R_SPARC_PC_HH22, 37) + RELOC_NUMBER (R_SPARC_PC_HM10, 38) + RELOC_NUMBER (R_SPARC_PC_LM22, 39) + RELOC_NUMBER (R_SPARC_WDISP16, 40) + RELOC_NUMBER (R_SPARC_WDISP19, 41) + RELOC_NUMBER (R_SPARC_UNUSED_42, 42) + RELOC_NUMBER (R_SPARC_7, 43) + RELOC_NUMBER (R_SPARC_5, 44) + RELOC_NUMBER (R_SPARC_6, 45) + RELOC_NUMBER (R_SPARC_DISP64, 46) + RELOC_NUMBER (R_SPARC_PLT64, 47) + RELOC_NUMBER (R_SPARC_HIX22, 48) + RELOC_NUMBER (R_SPARC_LOX10, 49) + RELOC_NUMBER (R_SPARC_H44, 50) + RELOC_NUMBER (R_SPARC_M44, 51) + RELOC_NUMBER (R_SPARC_L44, 52) + RELOC_NUMBER (R_SPARC_REGISTER, 53) + RELOC_NUMBER (R_SPARC_UA64, 54) + RELOC_NUMBER (R_SPARC_UA16, 55) + + /* little endian relocs */ + RELOC_NUMBER (R_SPARC_32LE, 56) + + RELOC_NUMBER (R_SPARC_max, 57) +END_RELOC_NUMBERS /* Relocation macros. */ -- 2.30.2