/* MIPS ELF support for BFD.
- Copyright (C) 1993, 1994, 1995, 1996, 1998 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2003, 2004, 2005
+ Free Software Foundation, Inc.
By Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>, from
information in the System V Application Binary Interface, MIPS
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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This file holds definitions specific to the MIPS ELF ABI. Note
that most of this is not actually implemented by BFD. */
START_RELOC_NUMBERS (elf_mips_reloc_type)
RELOC_NUMBER (R_MIPS_NONE, 0)
RELOC_NUMBER (R_MIPS_16, 1)
- RELOC_NUMBER (R_MIPS_32, 2)
- RELOC_NUMBER (R_MIPS_REL32, 3)
+ RELOC_NUMBER (R_MIPS_32, 2) /* In Elf 64: alias R_MIPS_ADD */
+ RELOC_NUMBER (R_MIPS_REL32, 3) /* In Elf 64: alias R_MIPS_REL */
RELOC_NUMBER (R_MIPS_26, 4)
RELOC_NUMBER (R_MIPS_HI16, 5)
RELOC_NUMBER (R_MIPS_LO16, 6)
- RELOC_NUMBER (R_MIPS_GPREL16, 7)
+ RELOC_NUMBER (R_MIPS_GPREL16, 7) /* In Elf 64: alias R_MIPS_GPREL */
RELOC_NUMBER (R_MIPS_LITERAL, 8)
- RELOC_NUMBER (R_MIPS_GOT16, 9)
+ RELOC_NUMBER (R_MIPS_GOT16, 9) /* In Elf 64: alias R_MIPS_GOT */
RELOC_NUMBER (R_MIPS_PC16, 10)
- RELOC_NUMBER (R_MIPS_CALL16, 11)
+ RELOC_NUMBER (R_MIPS_CALL16, 11) /* In Elf 64: alias R_MIPS_CALL */
RELOC_NUMBER (R_MIPS_GPREL32, 12)
/* The remaining relocs are defined on Irix, although they are not
in the MIPS ELF ABI. */
RELOC_NUMBER (R_MIPS_PJUMP, 35)
RELOC_NUMBER (R_MIPS_RELGOT, 36)
RELOC_NUMBER (R_MIPS_JALR, 37)
- RELOC_NUMBER (R_MIPS_max, 38)
+ /* TLS relocations. */
+ RELOC_NUMBER (R_MIPS_TLS_DTPMOD32, 38)
+ RELOC_NUMBER (R_MIPS_TLS_DTPREL32, 39)
+ RELOC_NUMBER (R_MIPS_TLS_DTPMOD64, 40)
+ RELOC_NUMBER (R_MIPS_TLS_DTPREL64, 41)
+ RELOC_NUMBER (R_MIPS_TLS_GD, 42)
+ RELOC_NUMBER (R_MIPS_TLS_LDM, 43)
+ RELOC_NUMBER (R_MIPS_TLS_DTPREL_HI16, 44)
+ RELOC_NUMBER (R_MIPS_TLS_DTPREL_LO16, 45)
+ RELOC_NUMBER (R_MIPS_TLS_GOTTPREL, 46)
+ RELOC_NUMBER (R_MIPS_TLS_TPREL32, 47)
+ RELOC_NUMBER (R_MIPS_TLS_TPREL64, 48)
+ RELOC_NUMBER (R_MIPS_TLS_TPREL_HI16, 49)
+ RELOC_NUMBER (R_MIPS_TLS_TPREL_LO16, 50)
+ RELOC_NUMBER (R_MIPS_GLOB_DAT, 51)
+ FAKE_RELOC (R_MIPS_max, 52)
/* These relocs are used for the mips16. */
+ FAKE_RELOC (R_MIPS16_min, 100)
RELOC_NUMBER (R_MIPS16_26, 100)
RELOC_NUMBER (R_MIPS16_GPREL, 101)
+ RELOC_NUMBER (R_MIPS16_GOT16, 102)
+ RELOC_NUMBER (R_MIPS16_CALL16, 103)
+ RELOC_NUMBER (R_MIPS16_HI16, 104)
+ RELOC_NUMBER (R_MIPS16_LO16, 105)
+ FAKE_RELOC (R_MIPS16_max, 106)
+ /* These relocations are specific to VxWorks. */
+ RELOC_NUMBER (R_MIPS_COPY, 126)
+ RELOC_NUMBER (R_MIPS_JUMP_SLOT, 127)
+ /* This was a GNU extension used by embedded-PIC. It was co-opted by
+ mips-linux for exception-handling data. It is no longer used, but
+ should continue to be supported by the linker for backward
+ compatibility. (GCC stopped using it in May, 2004.) */
+ RELOC_NUMBER (R_MIPS_PC32, 248)
+ /* FIXME: this relocation is used internally by gas. */
+ RELOC_NUMBER (R_MIPS_GNU_REL16_S2, 250)
/* These are GNU extensions to enable C++ vtable garbage collection. */
RELOC_NUMBER (R_MIPS_GNU_VTINHERIT, 253)
RELOC_NUMBER (R_MIPS_GNU_VTENTRY, 254)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_MIPS_maxext)
/* Processor specific flags for the ELF header e_flags field. */
position independent code. */
#define EF_MIPS_CPIC 0x00000004
+/* ??? Unknown flag, set in IRIX 6's BSDdup2.o in libbsd.a. */
+#define EF_MIPS_XGOT 0x00000008
+
+/* Code in file uses UCODE (obsolete) */
+#define EF_MIPS_UCODE 0x00000010
+
/* Code in file uses new ABI (-n32 on Irix 6). */
#define EF_MIPS_ABI2 0x00000020
-/* Indicates code compiled for a 64-bit machine in 32-bit mode.
+/* Process the .MIPS.options section first by ld */
+#define EF_MIPS_OPTIONS_FIRST 0x00000080
+
+/* Architectural Extensions used by this file */
+#define EF_MIPS_ARCH_ASE 0x0f000000
+
+/* Use MDMX multimedia extensions */
+#define EF_MIPS_ARCH_ASE_MDMX 0x08000000
+
+/* Use MIPS-16 ISA extensions */
+#define EF_MIPS_ARCH_ASE_M16 0x04000000
+
+/* Indicates code compiled for a 64-bit machine in 32-bit mode.
(regs are 32-bits wide.) */
#define EF_MIPS_32BITMODE 0x00000100
/* -mips4 code. */
#define E_MIPS_ARCH_4 0x30000000
+/* -mips5 code. */
+#define E_MIPS_ARCH_5 0x40000000
+
+/* -mips32 code. */
+#define E_MIPS_ARCH_32 0x50000000
+
+/* -mips64 code. */
+#define E_MIPS_ARCH_64 0x60000000
+
+/* -mips32r2 code. */
+#define E_MIPS_ARCH_32R2 0x70000000
+
+/* -mips64r2 code. */
+#define E_MIPS_ARCH_64R2 0x80000000
+
/* The ABI of the file. Also see EF_MIPS_ABI2 above. */
#define EF_MIPS_ABI 0x0000F000
the rest are open. */
#define E_MIPS_MACH_3900 0x00810000
-
#define E_MIPS_MACH_4010 0x00820000
#define E_MIPS_MACH_4100 0x00830000
#define E_MIPS_MACH_4650 0x00850000
+#define E_MIPS_MACH_4120 0x00870000
#define E_MIPS_MACH_4111 0x00880000
-
+#define E_MIPS_MACH_SB1 0x008a0000
+#define E_MIPS_MACH_5400 0x00910000
+#define E_MIPS_MACH_5500 0x00980000
+#define E_MIPS_MACH_9000 0x00990000
+#define E_MIPS_MACH_LS2E 0x00A00000
+#define E_MIPS_MACH_LS2F 0x00A10000
\f
/* Processor specific section indices. These sections do not actually
exist. Symbols with a st_shndx field corresponding to one of these
/* ??? */
#define SHT_MIPS_RFDESC 0x7000001a
-/* ??? */
+/* Delta C++: symbol table */
#define SHT_MIPS_DELTASYM 0x7000001b
-/* ??? */
+/* Delta C++: instance table */
#define SHT_MIPS_DELTAINST 0x7000001c
-/* ??? */
+/* Delta C++: class table */
#define SHT_MIPS_DELTACLASS 0x7000001d
/* DWARF debugging section. */
#define SHT_MIPS_DWARF 0x7000001e
-/* ??? */
+/* Delta C++: declarations */
#define SHT_MIPS_DELTADECL 0x7000001f
/* List of libraries the binary depends on. Includes a time stamp, version
/* ??? */
#define SHT_MIPS_TRANSLATE 0x70000022
-/* ??? */
+/* Special pixie sections */
#define SHT_MIPS_PIXIE 0x70000023
-/* ??? */
+/* Address translation table (for debug info) */
#define SHT_MIPS_XLATE 0x70000024
-/* ??? */
+/* SGI internal address translation table (for debug info) */
#define SHT_MIPS_XLATE_DEBUG 0x70000025
-/* ??? */
+/* Intermediate code */
#define SHT_MIPS_WHIRL 0x70000026
-/* ??? */
+/* C++ exception handling region info */
#define SHT_MIPS_EH_REGION 0x70000027
-/* ??? */
+/* Obsolete address translation table (for debug info) */
#define SHT_MIPS_XLATE_OLD 0x70000028
-/* ??? */
+/* Runtime procedure descriptor table exception information (ucode) ??? */
#define SHT_MIPS_PDR_EXCEPTION 0x70000029
/* MIPS ELF .reginfo swapping routines. */
extern void bfd_mips_elf32_swap_reginfo_in
- PARAMS ((bfd *, const Elf32_External_RegInfo *, Elf32_RegInfo *));
+ (bfd *, const Elf32_External_RegInfo *, Elf32_RegInfo *);
extern void bfd_mips_elf32_swap_reginfo_out
- PARAMS ((bfd *, const Elf32_RegInfo *, Elf32_External_RegInfo *));
+ (bfd *, const Elf32_RegInfo *, Elf32_External_RegInfo *);
\f
/* Processor specific section flags. */
/* This section should be merged. */
#define SHF_MIPS_MERGE 0x20000000
-/* This section contains 32 bit addresses. */
-#define SHF_MIPS_ADDR32 0x40000000
+/* This section contains address data of size implied by section
+ element size. */
+#define SHF_MIPS_ADDR 0x40000000
-/* This section contains 64 bit addresses. */
-#define SHF_MIPS_ADDR64 0x80000000
+/* This section contains string data. */
+#define SHF_MIPS_STRING 0x80000000
/* This section may not be stripped. */
#define SHF_MIPS_NOSTRIP 0x08000000
/* Linker should generate implicit weak names for this section. */
#define SHF_MIPS_NAMES 0x02000000
+
+/* Section contais text/data which may be replicated in other sections.
+ Linker should retain only one copy. */
+#define SHF_MIPS_NODUPES 0x01000000
\f
/* Processor specific program header types. */
/* Runtime procedure table. */
#define PT_MIPS_RTPROC 0x70000001
-/* Options (for what ???). */
+/* .MIPS.options section. */
#define PT_MIPS_OPTIONS 0x70000002
\f
/* Processor specific dynamic array tags. */
/* Pixie information (???). */
#define DT_MIPS_PIXIE_INIT 0x70000023
-/* ??? */
+/* Address of .MIPS.symlib */
#define DT_MIPS_SYMBOL_LIB 0x70000024
-/* ??? */
+/* The GOT index of the first PTE for a segment */
#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025
-/* ??? */
+/* The GOT index of the first PTE for a local symbol */
#define DT_MIPS_LOCAL_GOTIDX 0x70000026
-/* ??? */
+/* The GOT index of the first PTE for a hidden symbol */
#define DT_MIPS_HIDDEN_GOTIDX 0x70000027
-/* ??? */
+/* The GOT index of the first PTE for a protected symbol */
#define DT_MIPS_PROTECTED_GOTIDX 0x70000028
/* Address of `.MIPS.options'. */
#define RHF_NOTPOT 0x00000002
/* Ignore LD_LIBRARY_PATH. */
-#define RHS_NO_LIBRARY_REPLACEMENT \
- 0x00000004
+#define RHS_NO_LIBRARY_REPLACEMENT 0x00000004
+
+/* DSO address may not be relocated. */
+#define RHF_NO_MOVE 0x00000008
+
+/* SGI specific features. */
+#define RHF_SGI_ONLY 0x00000010
-#define RHF_NO_MOVE 0x00000008
-#define RHF_SGI_ONLY 0x00000010
+/* Guarantee that .init will finish executing before any non-init
+ code in DSO is called. */
#define RHF_GUARANTEE_INIT 0x00000020
+
+/* Contains Delta C++ code. */
#define RHF_DELTA_C_PLUS_PLUS 0x00000040
+
+/* Guarantee that .init will start executing before any non-init
+ code in DSO is called. */
#define RHF_GUARANTEE_START_INIT 0x00000080
+
+/* Generated by pixie. */
#define RHF_PIXIE 0x00000100
+
+/* Delay-load DSO by default. */
#define RHF_DEFAULT_DELAY_LOAD 0x00000200
+
+/* Object may be requickstarted */
#define RHF_REQUICKSTART 0x00000400
+
+/* Object has been requickstarted */
#define RHF_REQUICKSTARTED 0x00000800
+
+/* Generated by cord. */
#define RHF_CORD 0x00001000
+
+/* Object contains no unresolved undef symbols. */
#define RHF_NO_UNRES_UNDEF 0x00002000
+
+/* Symbol table is in a safe order. */
#define RHF_RLD_ORDER_SAFE 0x00004000
\f
/* Special values for the st_other field in the symbol table. These
are used in an Irix 5 dynamic symbol table. */
-#define STO_DEFAULT 0x00
-#define STO_INTERNAL 0x01
-#define STO_HIDDEN 0x02
-#define STO_PROTECTED 0x03
+#define STO_DEFAULT STV_DEFAULT
+#define STO_INTERNAL STV_INTERNAL
+#define STO_HIDDEN STV_HIDDEN
+#define STO_PROTECTED STV_PROTECTED
/* This value is used for a mips16 .text symbol. */
#define STO_MIPS16 0xf0
+
+/* This bit is used on Irix to indicate a symbol whose definition
+ is optional - if, at final link time, it cannot be found, no
+ error message should be produced. */
+#define STO_OPTIONAL (1 << 2)
+/* A macro to examine the STO_OPTIONAL bit. */
+#define ELF_MIPS_IS_OPTIONAL(other) ((other) & STO_OPTIONAL)
\f
/* The 64-bit MIPS ELF ABI uses an unusual reloc format. Each
relocation entry specifies up to three actual relocations, all at
bfd_signed_vma r_addend;
} Elf64_Mips_Internal_Rela;
+/* MIPS ELF 64 relocation info access macros. */
+#define ELF64_MIPS_R_SSYM(i) (((i) >> 24) & 0xff)
+#define ELF64_MIPS_R_TYPE3(i) (((i) >> 16) & 0xff)
+#define ELF64_MIPS_R_TYPE2(i) (((i) >> 8) & 0xff)
+#define ELF64_MIPS_R_TYPE(i) ((i) & 0xff)
+
/* Values found in the r_ssym field of a relocation entry. */
/* No relocation. */
/* MIPS ELF option header swapping routines. */
extern void bfd_mips_elf_swap_options_in
- PARAMS ((bfd *, const Elf_External_Options *, Elf_Internal_Options *));
+ (bfd *, const Elf_External_Options *, Elf_Internal_Options *);
extern void bfd_mips_elf_swap_options_out
- PARAMS ((bfd *, const Elf_Internal_Options *, Elf_External_Options *));
+ (bfd *, const Elf_Internal_Options *, Elf_External_Options *);
/* Values which may appear in the kind field of an Elf_Options
structure. */
/* MIPS ELF reginfo swapping routines. */
extern void bfd_mips_elf64_swap_reginfo_in
- PARAMS ((bfd *, const Elf64_External_RegInfo *, Elf64_Internal_RegInfo *));
+ (bfd *, const Elf64_External_RegInfo *, Elf64_Internal_RegInfo *);
extern void bfd_mips_elf64_swap_reginfo_out
- PARAMS ((bfd *, const Elf64_Internal_RegInfo *, Elf64_External_RegInfo *));
+ (bfd *, const Elf64_Internal_RegInfo *, Elf64_External_RegInfo *);
/* Masks for the info work of an ODK_EXCEPTIONS descriptor. */
#define OEX_FPU_MIN 0x1f /* FPEs which must be enabled. */
#define OEX_FPU_MAX 0x1f00 /* FPEs which may be enabled. */
#define OEX_PAGE0 0x10000 /* Page zero must be mapped. */
#define OEX_SMM 0x20000 /* Force sequential memory mode. */
-#define OEX_FPDBUG 0x40000 /* Force floating-point debug mode. */
+#define OEX_FPDBUG 0x40000 /* Force precise floating-point
+ exceptions (debug mode). */
#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults. */
/* Masks of the FP exceptions for OEX_FPU_MIN and OEX_FPU_MAX. */
#define OPAD_SYMBOL 0x04
/* Masks for the info word of an ODK_HWPATCH descriptor. */
-#define OHW_R4KEOP 0x01 /* R4000 end-of-page patch. */
-#define OHW_R8KPFETCH 0x02 /* May need R8000 prefetch patch. */
-#define OHW_R5KEOP 0x04 /* R5000 end-of-page patch. */
-#define OHW_R5KCVTL 0x08 /* R5000 cvt.[ds].l bug (clean == 1). */
+#define OHW_R4KEOP 0x00000001 /* R4000 end-of-page patch. */
+#define OHW_R8KPFETCH 0x00000002 /* May need R8000 prefetch patch. */
+#define OHW_R5KEOP 0x00000004 /* R5000 end-of-page patch. */
+#define OHW_R5KCVTL 0x00000008 /* R5000 cvt.[ds].l bug
+ (clean == 1). */
+#define OHW_R10KLDL 0x00000010 /* Needs R10K misaligned
+ load patch. */
/* Masks for the info word of an ODK_IDENT/ODK_GP_GROUP descriptor. */
#define OGP_GROUP 0x0000ffff /* GP group number. */
#define OHWA0_R4KEOP_CLEAN 0x00000002
\f
+/* Object attribute tags. */
+enum
+{
+ /* 0-3 are generic. */
+ Tag_GNU_MIPS_ABI_FP = 4, /* Value 1 for hard-float -mdouble-float, 2
+ for hard-float -msingle-float, 3 for
+ soft-float, 4 for -mips32r2 -mfp64; 0 for
+ not tagged or not using any ABIs affected
+ by the differences. */
+};
+
#endif /* _ELF_MIPS_H */