aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-02-26 18:25:23 +0000
committerIan Lance Taylor <ian@airs.com>1994-02-26 18:25:23 +0000
commit68241b2b3f91c517b33a1d234ade7ed834f31f54 (patch)
tree41b3201d99fe49def28b99f908a7519b74f1deaf /bfd/elf32-i386.c
parent3d51f02f4c683aa29fb45e9083ddddd1a1b9ce97 (diff)
downloadgdb-68241b2b3f91c517b33a1d234ade7ed834f31f54.zip
gdb-68241b2b3f91c517b33a1d234ade7ed834f31f54.tar.gz
gdb-68241b2b3f91c517b33a1d234ade7ed834f31f54.tar.bz2
* aoutx.h, archive.c: Add casts to avoid warnings from SVR4 cc.
* ecoff.c, ecofflink.c, ecoffswap.h, srec.c: Likewise. * elf32-i386.c: Likewise. * elfcode.h (bfd_section_from_shdr): Make i unsigned; remove old #if 0 code. (elf_write_phdrs): Make i unsigned. (map_program_segments): Make i and n_left unsigned. (assign_file_positions_except_relocs): Make i unsigned. (write_shdrs_and_ehdr): Make count unsigned. (assign_file_positions_for_relocs): Make i unsigned. (NAME(bfd,elf_write_object_contents)): Make count unsigned. (section_from_elf_index): Make index argument unsigned.
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r--bfd/elf32-i386.c84
1 files changed, 64 insertions, 20 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 9ead8bf..f5a1e48 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -17,10 +17,6 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
-/*
- * This file contains changes from the Open Software Foundation.
- */
-
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
@@ -31,12 +27,16 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
enum reloc_type
{
R_386_NONE = 0,
- R_386_32, R_386_PC32,
- R_386_GOT32, R_386_PLT32,
+ R_386_32,
+ R_386_PC32,
+ R_386_GOT32,
+ R_386_PLT32,
R_386_COPY,
- R_386_GLOB_DAT, R_386_JUMP_SLOT,
+ R_386_GLOB_DAT,
+ R_386_JUMP_SLOT,
R_386_RELATIVE,
- R_386_GOTOFF, R_386_GOTPC,
+ R_386_GOTOFF,
+ R_386_GOTPC,
R_386_max
};
@@ -44,22 +44,32 @@ enum reloc_type
static CONST char *CONST reloc_type_names[] =
{
"R_386_NONE",
- "R_386_32", "R_386_PC32",
- "R_386_GOT32", "R_386_PLT32",
+ "R_386_32",
+ "R_386_PC32",
+ "R_386_GOT32",
+ "R_386_PLT32",
"R_386_COPY",
- "R_386_GLOB_DAT", "R_386_JUMP_SLOT",
+ "R_386_GLOB_DAT",
+ "R_386_JUMP_SLOT",
"R_386_RELATIVE",
- "R_386_GOTOFF", "R_386_GOTPC",
+ "R_386_GOTOFF",
+ "R_386_GOTPC",
};
#endif
-
static reloc_howto_type elf_howto_table[]=
{
- HOWTO(R_386_NONE, 0,0, 0,false,0, complain_overflow_dont, 0,"R_386_NONE", false,0x00000000,0x00000000,false),
- HOWTO(R_386_32, 0,2,32,false,0, complain_overflow_bitfield, 0,"R_386_32", false,0xffffffff,0xffffffff,false),
- HOWTO(R_386_PC32, 0,2,32,true, 0, complain_overflow_signed, 0,"R_386_PC32", false,0xffffffff,0xffffffff,false),
- HOWTO(R_386_GOT32, 0,2,32,false,0, complain_overflow_bitfield, 0,"R_386_GOT32",false,0xffffffff,0xffffffff,false)
+ HOWTO(R_386_NONE, 0,0, 0,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_NONE", true,0x00000000,0x00000000,false),
+ HOWTO(R_386_32, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_32", true,0xffffffff,0xffffffff,false),
+ HOWTO(R_386_PC32, 0,2,32,true, 0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_PC32", true,0xffffffff,0xffffffff,true),
+ HOWTO(R_386_GOT32, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOT32", true,0xffffffff,0xffffffff,false),
+ HOWTO(R_386_PLT32, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_PLT32", true,0xffffffff,0xffffffff,false),
+ HOWTO(R_386_COPY, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_COPY", true,0xffffffff,0xffffffff,false),
+ HOWTO(R_386_GLOB_DAT, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GLOB_DAT", true,0xffffffff,0xffffffff,false),
+ HOWTO(R_386_JUMP_SLOT, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_JUMP_SLOT",true,0xffffffff,0xffffffff,false),
+ HOWTO(R_386_RELATIVE, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_RELATIVE", true,0xffffffff,0xffffffff,false),
+ HOWTO(R_386_GOTOFF, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOTOFF", true,0xffffffff,0xffffffff,false),
+ HOWTO(R_386_GOTPC, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOTPC", true,0xffffffff,0xffffffff,false),
};
#ifdef DEBUG_GEN_RELOC
@@ -87,8 +97,40 @@ DEFUN (elf_i386_reloc_type_lookup, (abfd, code),
TRACE ("BFD_RELOC_PC32");
return &elf_howto_table[ (int)R_386_PC32 ];
+ case BFD_RELOC_386_GOT32:
+ TRACE ("BFD_RELOC_386_GOT32");
+ return &elf_howto_table[ (int)R_386_GOT32 ];
+
+ case BFD_RELOC_386_PLT32:
+ TRACE ("BFD_RELOC_386_PLT32");
+ return &elf_howto_table[ (int)R_386_PLT32 ];
+
+ case BFD_RELOC_386_COPY:
+ TRACE ("BFD_RELOC_386_COPY");
+ return &elf_howto_table[ (int)R_386_COPY ];
+
+ case BFD_RELOC_386_GLOB_DAT:
+ TRACE ("BFD_RELOC_386_GLOB_DAT");
+ return &elf_howto_table[ (int)R_386_GLOB_DAT ];
+
+ case BFD_RELOC_386_JUMP_SLOT:
+ TRACE ("BFD_RELOC_386_JUMP_SLOT");
+ return &elf_howto_table[ (int)R_386_JUMP_SLOT ];
+
+ case BFD_RELOC_386_RELATIVE:
+ TRACE ("BFD_RELOC_386_RELATIVE");
+ return &elf_howto_table[ (int)R_386_RELATIVE ];
+
+ case BFD_RELOC_386_GOTOFF:
+ TRACE ("BFD_RELOC_386_GOTOFF");
+ return &elf_howto_table[ (int)R_386_GOTOFF ];
+
+ case BFD_RELOC_386_GOTPC:
+ TRACE ("BFD_RELOC_386_GOTPC");
+ return &elf_howto_table[ (int)R_386_GOTPC ];
+
default:
- abort ();
+ break;
}
TRACE ("Unknown");
@@ -101,7 +143,7 @@ DEFUN(elf_i386_info_to_howto, (abfd, cache_ptr, dst),
arelent *cache_ptr AND
Elf32_Internal_Rela *dst)
{
- BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < R_386_GOT32);
+ BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_386_max);
cache_ptr->howto = &elf_howto_table[ELF32_R_TYPE(dst->r_info)];
}
@@ -112,7 +154,7 @@ DEFUN(elf_i386_info_to_howto_rel, (abfd, cache_ptr, dst),
arelent *cache_ptr AND
Elf32_Internal_Rel *dst)
{
- BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < R_386_GOT32);
+ BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_386_max);
cache_ptr->howto = &elf_howto_table[ELF32_R_TYPE(dst->r_info)];
}
@@ -120,8 +162,10 @@ DEFUN(elf_i386_info_to_howto_rel, (abfd, cache_ptr, dst),
#define TARGET_LITTLE_SYM bfd_elf32_i386_vec
#define TARGET_LITTLE_NAME "elf32-i386"
#define ELF_ARCH bfd_arch_i386
+#define ELF_MACHINE_CODE EM_386
#define elf_info_to_howto elf_i386_info_to_howto
#define elf_info_to_howto_rel elf_i386_info_to_howto_rel
#define bfd_elf32_bfd_reloc_type_lookup elf_i386_reloc_type_lookup
+#define ELF_MAXPAGESIZE 0x1000
#include "elf32-target.h"