Subversion Repositories Kolibri OS

Rev

Rev 5191 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5191 Rev 6324
Line 1... Line 1...
1
/* MIPS ELF support for BFD.
1
/* MIPS ELF support for BFD.
2
   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-
 
3
   2003, 2004, 2005, 2008, 2009, 2010, 2013
-
 
4
   Free Software Foundation, Inc.
2
   Copyright (C) 1993-2015 Free Software Foundation, Inc.
Line 5... Line 3...
5
 
3
 
6
   By Ian Lance Taylor, Cygnus Support, , from
4
   By Ian Lance Taylor, Cygnus Support, , from
7
   information in the System V Application Binary Interface, MIPS
5
   information in the System V Application Binary Interface, MIPS
Line 87... Line 85...
87
  RELOC_NUMBER (R_MIPS_TLS_TPREL32, 47)
85
  RELOC_NUMBER (R_MIPS_TLS_TPREL32, 47)
88
  RELOC_NUMBER (R_MIPS_TLS_TPREL64, 48)
86
  RELOC_NUMBER (R_MIPS_TLS_TPREL64, 48)
89
  RELOC_NUMBER (R_MIPS_TLS_TPREL_HI16, 49)
87
  RELOC_NUMBER (R_MIPS_TLS_TPREL_HI16, 49)
90
  RELOC_NUMBER (R_MIPS_TLS_TPREL_LO16, 50)
88
  RELOC_NUMBER (R_MIPS_TLS_TPREL_LO16, 50)
91
  RELOC_NUMBER (R_MIPS_GLOB_DAT, 51)
89
  RELOC_NUMBER (R_MIPS_GLOB_DAT, 51)
-
 
90
  /* Space to grow */
-
 
91
  RELOC_NUMBER (R_MIPS_PC21_S2, 60)
-
 
92
  RELOC_NUMBER (R_MIPS_PC26_S2, 61)
-
 
93
  RELOC_NUMBER (R_MIPS_PC18_S3, 62)
-
 
94
  RELOC_NUMBER (R_MIPS_PC19_S2, 63)
-
 
95
  RELOC_NUMBER (R_MIPS_PCHI16, 64)
-
 
96
  RELOC_NUMBER (R_MIPS_PCLO16, 65)
92
  FAKE_RELOC (R_MIPS_max, 52)
97
  FAKE_RELOC (R_MIPS_max, 66)
93
  /* These relocs are used for the mips16.  */
98
  /* These relocs are used for the mips16.  */
94
  FAKE_RELOC (R_MIPS16_min, 100)
99
  FAKE_RELOC (R_MIPS16_min, 100)
95
  RELOC_NUMBER (R_MIPS16_26, 100)
100
  RELOC_NUMBER (R_MIPS16_26, 100)
96
  RELOC_NUMBER (R_MIPS16_GPREL, 101)
101
  RELOC_NUMBER (R_MIPS16_GPREL, 101)
97
  RELOC_NUMBER (R_MIPS16_GOT16, 102)
102
  RELOC_NUMBER (R_MIPS16_GOT16, 102)
Line 237... Line 242...
237
#define E_MIPS_ARCH_32R2        0x70000000
242
#define E_MIPS_ARCH_32R2        0x70000000
Line 238... Line 243...
238
 
243
 
239
/* -mips64r2 code.  */
244
/* -mips64r2 code.  */
Line -... Line 245...
-
 
245
#define E_MIPS_ARCH_64R2        0x80000000
-
 
246
 
-
 
247
/* -mips32r6 code.  */
-
 
248
#define E_MIPS_ARCH_32R6        0x90000000
-
 
249
 
-
 
250
/* -mips64r6 code.  */
240
#define E_MIPS_ARCH_64R2        0x80000000
251
#define E_MIPS_ARCH_64R6        0xa0000000
241
 
252
 
Line 242... Line 253...
242
/* The ABI of the file.  Also see EF_MIPS_ABI2 above. */
253
/* The ABI of the file.  Also see EF_MIPS_ABI2 above. */
243
#define EF_MIPS_ABI		0x0000F000
254
#define EF_MIPS_ABI		0x0000F000
Line 273... Line 284...
273
#define E_MIPS_MACH_4111	0x00880000
284
#define E_MIPS_MACH_4111	0x00880000
274
#define E_MIPS_MACH_SB1         0x008a0000
285
#define E_MIPS_MACH_SB1         0x008a0000
275
#define E_MIPS_MACH_OCTEON	0x008b0000
286
#define E_MIPS_MACH_OCTEON	0x008b0000
276
#define E_MIPS_MACH_XLR     	0x008c0000
287
#define E_MIPS_MACH_XLR     	0x008c0000
277
#define E_MIPS_MACH_OCTEON2	0x008d0000
288
#define E_MIPS_MACH_OCTEON2	0x008d0000
-
 
289
#define E_MIPS_MACH_OCTEON3	0x008e0000
278
#define E_MIPS_MACH_5400	0x00910000
290
#define E_MIPS_MACH_5400	0x00910000
279
#define E_MIPS_MACH_5900	0x00920000
291
#define E_MIPS_MACH_5900	0x00920000
280
#define E_MIPS_MACH_5500	0x00980000
292
#define E_MIPS_MACH_5500	0x00980000
281
#define E_MIPS_MACH_9000	0x00990000
293
#define E_MIPS_MACH_9000	0x00990000
282
#define E_MIPS_MACH_LS2E        0x00A00000
294
#define E_MIPS_MACH_LS2E        0x00A00000
Line 427... Line 439...
427
#define SHT_MIPS_XLATE_OLD	0x70000028
439
#define SHT_MIPS_XLATE_OLD	0x70000028
Line 428... Line 440...
428
 
440
 
429
/* Runtime procedure descriptor table exception information (ucode) ??? */
441
/* Runtime procedure descriptor table exception information (ucode) ??? */
Line -... Line 442...
-
 
442
#define SHT_MIPS_PDR_EXCEPTION	0x70000029
-
 
443
 
Line 430... Line 444...
430
#define SHT_MIPS_PDR_EXCEPTION	0x70000029
444
/* ABI related flags section.  */
431
 
445
#define SHT_MIPS_ABIFLAGS	0x7000002a
432
 
446
 
433
/* A section of type SHT_MIPS_LIBLIST contains an array of the
447
/* A section of type SHT_MIPS_LIBLIST contains an array of the
Line 593... Line 607...
593
#define PT_MIPS_RTPROC		0x70000001
607
#define PT_MIPS_RTPROC		0x70000001
Line 594... Line 608...
594
 
608
 
595
/* .MIPS.options section.  */
609
/* .MIPS.options section.  */
596
#define PT_MIPS_OPTIONS		0x70000002
610
#define PT_MIPS_OPTIONS		0x70000002
-
 
611
 
-
 
612
/* Records ABI related flags.  */
-
 
613
#define PT_MIPS_ABIFLAGS	0x70000003
597

614

Line 598... Line 615...
598
/* Processor specific dynamic array tags.  */
615
/* Processor specific dynamic array tags.  */
599
 
616
 
Line 730... Line 747...
730
#define DT_MIPS_PLTGOT         0x70000032
747
#define DT_MIPS_PLTGOT         0x70000032
Line 731... Line 748...
731
 
748
 
732
/* Points to the base of a writable PLT.  */
749
/* Points to the base of a writable PLT.  */
733
#define DT_MIPS_RWPLT          0x70000034
750
#define DT_MIPS_RWPLT          0x70000034
-
 
751
 
-
 
752
/* Relative offset of run time loader map, used for debugging.  */
-
 
753
#define DT_MIPS_RLD_MAP_REL    0x70000035
734

754

Line 735... Line 755...
735
/* Flags which may appear in a DT_MIPS_FLAGS entry.  */
755
/* Flags which may appear in a DT_MIPS_FLAGS entry.  */
736
 
756
 
Line 1047... Line 1067...
1047
  unsigned long ri_cprmask[4];
1067
  unsigned long ri_cprmask[4];
1048
  /* GP register value for this object file.  */
1068
  /* GP register value for this object file.  */
1049
  bfd_vma ri_gp_value;
1069
  bfd_vma ri_gp_value;
1050
} Elf64_Internal_RegInfo;
1070
} Elf64_Internal_RegInfo;
Line -... Line 1071...
-
 
1071
 
-
 
1072
/* ABI Flags structure version 0.  */
-
 
1073
 
-
 
1074
typedef struct
-
 
1075
{
-
 
1076
  /* Version of flags structure.  */
-
 
1077
  unsigned char version[2];
-
 
1078
  /* The level of the ISA: 1-5, 32, 64.  */
-
 
1079
  unsigned char isa_level[1];
-
 
1080
  /* The revision of ISA: 0 for MIPS V and below, 1-n otherwise.  */
-
 
1081
  unsigned char isa_rev[1];
-
 
1082
  /* The size of general purpose registers.  */
-
 
1083
  unsigned char gpr_size[1];
-
 
1084
  /* The size of co-processor 1 registers.  */
-
 
1085
  unsigned char cpr1_size[1];
-
 
1086
  /* The size of co-processor 2 registers.  */
-
 
1087
  unsigned char cpr2_size[1];
-
 
1088
  /* The floating-point ABI.  */
-
 
1089
  unsigned char fp_abi[1];
-
 
1090
  /* Processor-specific extension.  */
-
 
1091
  unsigned char isa_ext[4];
-
 
1092
  /* Mask of ASEs used.  */
-
 
1093
  unsigned char ases[4];
-
 
1094
  /* Mask of general flags.  */
-
 
1095
  unsigned char flags1[4];
-
 
1096
  unsigned char flags2[4];
-
 
1097
} Elf_External_ABIFlags_v0;
-
 
1098
 
-
 
1099
typedef struct
-
 
1100
{
-
 
1101
  /* Version of flags structure.  */
-
 
1102
  unsigned short version;
-
 
1103
  /* The level of the ISA: 1-5, 32, 64.  */
-
 
1104
  unsigned char isa_level;
-
 
1105
  /* The revision of ISA: 0 for MIPS V and below, 1-n otherwise.  */
-
 
1106
  unsigned char isa_rev;
-
 
1107
  /* The size of general purpose registers.  */
-
 
1108
  unsigned char gpr_size;
-
 
1109
  /* The size of co-processor 1 registers.  */
-
 
1110
  unsigned char cpr1_size;
-
 
1111
  /* The size of co-processor 2 registers.  */
-
 
1112
  unsigned char cpr2_size;
-
 
1113
  /* The floating-point ABI.  */
-
 
1114
  unsigned char fp_abi;
-
 
1115
  /* Processor-specific extension.  */
-
 
1116
  unsigned long isa_ext;
-
 
1117
  /* Mask of ASEs used.  */
-
 
1118
  unsigned long ases;
-
 
1119
  /* Mask of general flags.  */
-
 
1120
  unsigned long flags1;
-
 
1121
  unsigned long flags2;
-
 
1122
} Elf_Internal_ABIFlags_v0;
1051
 
1123
 
1052
typedef struct
1124
typedef struct
1053
{
1125
{
1054
  /* The hash value computed from the name of the corresponding
1126
  /* The hash value computed from the name of the corresponding
1055
     dynamic symbol.  */
1127
     dynamic symbol.  */
Line 1087... Line 1159...
1087
extern void bfd_mips_elf64_swap_reginfo_in
1159
extern void bfd_mips_elf64_swap_reginfo_in
1088
  (bfd *, const Elf64_External_RegInfo *, Elf64_Internal_RegInfo *);
1160
  (bfd *, const Elf64_External_RegInfo *, Elf64_Internal_RegInfo *);
1089
extern void bfd_mips_elf64_swap_reginfo_out
1161
extern void bfd_mips_elf64_swap_reginfo_out
1090
  (bfd *, const Elf64_Internal_RegInfo *, Elf64_External_RegInfo *);
1162
  (bfd *, const Elf64_Internal_RegInfo *, Elf64_External_RegInfo *);
Line -... Line 1163...
-
 
1163
 
-
 
1164
/* MIPS ELF flags swapping routines.  */
-
 
1165
extern void bfd_mips_elf_swap_abiflags_v0_in
-
 
1166
  (bfd *, const Elf_External_ABIFlags_v0 *, Elf_Internal_ABIFlags_v0 *);
-
 
1167
extern void bfd_mips_elf_swap_abiflags_v0_out
-
 
1168
  (bfd *, const Elf_Internal_ABIFlags_v0 *, Elf_External_ABIFlags_v0 *);
1091
 
1169
 
1092
/* Masks for the info work of an ODK_EXCEPTIONS descriptor.  */
1170
/* Masks for the info work of an ODK_EXCEPTIONS descriptor.  */
1093
#define OEX_FPU_MIN	0x1f	/* FPEs which must be enabled.  */
1171
#define OEX_FPU_MIN	0x1f	/* FPEs which must be enabled.  */
1094
#define OEX_FPU_MAX	0x1f00	/* FPEs which may be enabled.  */
1172
#define OEX_FPU_MAX	0x1f00	/* FPEs which may be enabled.  */
1095
#define OEX_PAGE0	0x10000	/* Page zero must be mapped.  */
1173
#define OEX_PAGE0	0x10000	/* Page zero must be mapped.  */
Line 1125... Line 1203...
1125
 
1203
 
1126
/* Masks for the info word of an ODK_HWAND/ODK_HWOR descriptor.  */
1204
/* Masks for the info word of an ODK_HWAND/ODK_HWOR descriptor.  */
1127
#define OHWA0_R4KEOP_CHECKED	0x00000001
1205
#define OHWA0_R4KEOP_CHECKED	0x00000001
1128
#define OHWA0_R4KEOP_CLEAN	0x00000002
1206
#define OHWA0_R4KEOP_CLEAN	0x00000002
-
 
1207
 
-
 
1208
/* Values for the xxx_size bytes of an ABI flags structure.  */
-
 
1209
 
-
 
1210
#define AFL_REG_NONE	     0x00	/* No registers.  */
-
 
1211
#define AFL_REG_32	     0x01	/* 32-bit registers.  */
-
 
1212
#define AFL_REG_64	     0x02	/* 64-bit registers.  */
-
 
1213
#define AFL_REG_128	     0x03	/* 128-bit registers.  */
-
 
1214
 
-
 
1215
/* Masks for the ases word of an ABI flags structure.  */
-
 
1216
 
-
 
1217
#define AFL_ASE_DSP          0x00000001 /* DSP ASE.  */
-
 
1218
#define AFL_ASE_DSPR2        0x00000002 /* DSP R2 ASE.  */
-
 
1219
#define AFL_ASE_EVA          0x00000004 /* Enhanced VA Scheme.  */
-
 
1220
#define AFL_ASE_MCU          0x00000008 /* MCU (MicroController) ASE.  */
-
 
1221
#define AFL_ASE_MDMX         0x00000010 /* MDMX ASE.  */
-
 
1222
#define AFL_ASE_MIPS3D       0x00000020 /* MIPS-3D ASE.  */
-
 
1223
#define AFL_ASE_MT           0x00000040 /* MT ASE.  */
-
 
1224
#define AFL_ASE_SMARTMIPS    0x00000080 /* SmartMIPS ASE.  */
-
 
1225
#define AFL_ASE_VIRT         0x00000100 /* VZ ASE.  */
-
 
1226
#define AFL_ASE_MSA          0x00000200 /* MSA ASE.  */
-
 
1227
#define AFL_ASE_MIPS16       0x00000400 /* MIPS16 ASE.  */
-
 
1228
#define AFL_ASE_MICROMIPS    0x00000800 /* MICROMIPS ASE.  */
-
 
1229
#define AFL_ASE_XPA          0x00001000 /* XPA ASE.  */
-
 
1230
#define AFL_ASE_MASK         0x00001fff /* All ASEs.  */
-
 
1231
 
-
 
1232
/* Values for the isa_ext word of an ABI flags structure.  */
-
 
1233
 
-
 
1234
#define AFL_EXT_XLR           1  /* RMI Xlr instruction.  */
-
 
1235
#define AFL_EXT_OCTEON2       2  /* Cavium Networks Octeon2.  */
-
 
1236
#define AFL_EXT_OCTEONP       3  /* Cavium Networks OcteonP.  */
-
 
1237
#define AFL_EXT_LOONGSON_3A   4  /* Loongson 3A.  */
-
 
1238
#define AFL_EXT_OCTEON        5  /* Cavium Networks Octeon.  */
-
 
1239
#define AFL_EXT_5900          6  /* MIPS R5900 instruction.  */
-
 
1240
#define AFL_EXT_4650          7  /* MIPS R4650 instruction.  */
-
 
1241
#define AFL_EXT_4010          8  /* LSI R4010 instruction.  */
-
 
1242
#define AFL_EXT_4100          9  /* NEC VR4100 instruction.  */
-
 
1243
#define AFL_EXT_3900         10  /* Toshiba R3900 instruction.  */
-
 
1244
#define AFL_EXT_10000        11  /* MIPS R10000 instruction.  */
-
 
1245
#define AFL_EXT_SB1          12  /* Broadcom SB-1 instruction.  */
-
 
1246
#define AFL_EXT_4111         13  /* NEC VR4111/VR4181 instruction.  */
-
 
1247
#define AFL_EXT_4120         14  /* NEC VR4120 instruction.  */
-
 
1248
#define AFL_EXT_5400         15  /* NEC VR5400 instruction.  */
-
 
1249
#define AFL_EXT_5500         16  /* NEC VR5500 instruction.  */
-
 
1250
#define AFL_EXT_LOONGSON_2E  17  /* ST Microelectronics Loongson 2E.  */
-
 
1251
#define AFL_EXT_LOONGSON_2F  18  /* ST Microelectronics Loongson 2F.  */
-
 
1252
#define AFL_EXT_OCTEON3      19  /* Cavium Networks Octeon3.  */
-
 
1253
 
-
 
1254
/* Masks for the flags1 word of an ABI flags structure.  */
-
 
1255
#define AFL_FLAGS1_ODDSPREG   1	 /* Uses odd single-precision registers.  */
-
 
1256
 
-
 
1257
extern unsigned int bfd_mips_isa_ext (bfd *);
Line 1129... Line 1258...
1129

1258

1130
 
1259
 
1131
/* Object attribute tags.  */
1260
/* Object attribute tags.  */
1132
enum
1261
enum
Line 1133... Line 1262...
1133
{
1262
{
1134
  /* 0-3 are generic.  */
1263
  /* 0-3 are generic.  */
-
 
1264
 
-
 
1265
  /* Floating-point ABI used by this object file.  */
-
 
1266
  Tag_GNU_MIPS_ABI_FP = 4,
1135
 
1267
 
Line 1136... Line 1268...
1136
  /* Floating-point ABI used by this object file.  */
1268
  /* MSA ABI used by this object file.  */
1137
  Tag_GNU_MIPS_ABI_FP = 4,
1269
  Tag_GNU_MIPS_ABI_MSA = 8,
1138
};
1270
};
Line 1153... Line 1285...
1153
 
1285
 
1154
  /* Using soft-float.  */
1286
  /* Using soft-float.  */
Line 1155... Line 1287...
1155
  Val_GNU_MIPS_ABI_FP_SOFT = 3,
1287
  Val_GNU_MIPS_ABI_FP_SOFT = 3,
-
 
1288
 
-
 
1289
  /* Using -mips32r2 -mfp64.  */
-
 
1290
  Val_GNU_MIPS_ABI_FP_OLD_64 = 4,
-
 
1291
 
-
 
1292
  /* Using -mfpxx */
-
 
1293
  Val_GNU_MIPS_ABI_FP_XX = 5,
1156
 
1294
 
-
 
1295
  /* Using -mips32r2 -mfp64.  */
-
 
1296
  Val_GNU_MIPS_ABI_FP_64 = 6,
-
 
1297
 
-
 
1298
  /* Using -mips32r2 -mfp64 -mno-odd-spreg.  */
-
 
1299
  Val_GNU_MIPS_ABI_FP_64A = 7,
-
 
1300
 
-
 
1301
  /* This is reserved for backward-compatibility with an earlier
-
 
1302
     implementation of the MIPS NaN2008 functionality.  */
-
 
1303
  Val_GNU_MIPS_ABI_FP_NAN2008 = 8,
-
 
1304
 
-
 
1305
  /* Values defined for Tag_GNU_MIPS_ABI_MSA.  */
-
 
1306
 
-
 
1307
  /* Not tagged or not using any ABIs affected by the differences.  */
-
 
1308
  Val_GNU_MIPS_ABI_MSA_ANY = 0,
-
 
1309
 
1157
  /* Using -mips32r2 -mfp64.  */
1310
  /* Using 128-bit MSA.  */
Line 1158... Line 1311...
1158
  Val_GNU_MIPS_ABI_FP_64 = 4,
1311
  Val_GNU_MIPS_ABI_MSA_128 = 1,