* coff-h8500.c (rtype2howto): Do an fprintf to stderr rather than

using printf.
	* coff-z8k.c (rtype2howto): Likewise.
	* coffcode.h (dummy_reloc16_extra_cases): Likewise.
	* elf32-i386.c (TRACE): Likewise.
	* hp300hpux.c (convert_sym_type, swap_std_reloc_in): Likewise.
	* rs6000-core.c (rs6000coff_get_section_contents): Likewise.
	* coffgen.c (coff_print_symbol): Do an fprintf to the file
	argument rather than using printf.
This commit is contained in:
Ian Lance Taylor 1993-08-04 16:36:10 +00:00
parent eea92b2442
commit e4b6b3e71b
4 changed files with 152 additions and 12 deletions

View File

@ -1,3 +1,15 @@
Wed Aug 4 08:33:55 1993 Ian Lance Taylor (ian@cygnus.com)
* coff-h8500.c (rtype2howto): Do an fprintf to stderr rather than
using printf.
* coff-z8k.c (rtype2howto): Likewise.
* coffcode.h (dummy_reloc16_extra_cases): Likewise.
* elf32-i386.c (TRACE): Likewise.
* hp300hpux.c (convert_sym_type, swap_std_reloc_in): Likewise.
* rs6000-core.c (rs6000coff_get_section_contents): Likewise.
* coffgen.c (coff_print_symbol): Do an fprintf to the file
argument rather than using printf.
Tue Aug 3 18:17:25 1993 Ian Lance Taylor (ian@cygnus.com)
* coffswap.h: Added macros used when accessing several fields;

View File

@ -818,9 +818,9 @@ coff_set_arch_mach_hook(abfd, filehdr)
switch (internal_f->f_magic) {
#ifdef I386MAGIC
case I386MAGIC:
#ifdef I386AIXMAGIC
case I386PTXMAGIC:
case I386AIXMAGIC: /* Danbury PS/2 AIX C Compiler */
#endif
case I386LYNXMAGIC:
arch = bfd_arch_i386;
machine = 0;
break;
@ -2079,8 +2079,9 @@ SUBSUBSECTION
#ifndef CALC_ADDEND
#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
if (ptr && bfd_asymbol_bfd(ptr) == abfd \
&& ((ptr->flags & BSF_OLD_COMMON)== 0)) \
if (ptr && bfd_asymbol_bfd(ptr) == abfd \
&& !bfd_is_com_section(ptr->section) \
&& !(ptr->flags & BSF_OLD_COMMON)) \
{ \
cache_ptr->addend = -(ptr->section->vma + ptr->value); \
} \
@ -2251,7 +2252,7 @@ dummy_reloc16_extra_cases (abfd, seclet, reloc, data, src_ptr, dst_ptr)
unsigned int *src_ptr;
unsigned int *dst_ptr;
{
printf("%s\n", reloc->howto->name);
fprintf(stderr, "%s\n", reloc->howto->name);
abort ();
}
#endif

View File

@ -1173,12 +1173,12 @@ bfd *abfd)
}
internal_ptr->u.syment._n._n_n._n_offset =
(int) (string_table - 4 +
(long) (string_table - 4 +
(internal_ptr+1)->u.auxent.x_file.x_n.x_offset);
}
else {
/* ordinary short filename, put into memory anyway */
internal_ptr->u.syment._n._n_n._n_offset = (int)
internal_ptr->u.syment._n._n_n._n_offset = (long)
copy_name(abfd, (internal_ptr+1)->u.auxent.x_file.x_fname,
FILNMLEN);
}
@ -1203,7 +1203,7 @@ bfd *abfd)
} /* on error */
memset(newstring, 0, i);
strncpy(newstring, internal_ptr->u.syment._n._n_name, i-1);
internal_ptr->u.syment._n._n_n._n_offset = (int) newstring;
internal_ptr->u.syment._n._n_n._n_offset = (long int) newstring;
internal_ptr->u.syment._n._n_n._n_zeroes = 0;
}
else if (!bfd_coff_symname_in_debug(abfd, &internal_ptr->u.syment)) {
@ -1211,7 +1211,7 @@ bfd *abfd)
if (string_table == NULL) {
string_table = build_string_table(abfd);
}
internal_ptr->u.syment._n._n_n._n_offset = (int)
internal_ptr->u.syment._n._n_n._n_offset = (long int)
(string_table - 4 + internal_ptr->u.syment._n._n_n._n_offset);
}
else {
@ -1219,7 +1219,7 @@ bfd *abfd)
if (debug_section == NULL) {
debug_section = build_debug_section(abfd);
}
internal_ptr->u.syment._n._n_n._n_offset = (int)
internal_ptr->u.syment._n._n_n._n_offset = (long int)
(debug_section + internal_ptr->u.syment._n._n_n._n_offset);
}
}
@ -1363,11 +1363,11 @@ coff_print_symbol (abfd, filep, symbol, how)
if (l)
{
printf ("\n%s :", l->u.sym->name);
fprintf (file, "\n%s :", l->u.sym->name);
l++;
while (l->line_number)
{
printf ("\n%4d : 0x%x",
fprintf (file, "\n%4d : 0x%x",
l->line_number,
l->u.offset);
l++;

127
bfd/elf32-i386.c Normal file
View File

@ -0,0 +1,127 @@
/* Intel 80386/80486-specific support for 32-bit ELF
Copyright 1993 Free Software Foundation, Inc.
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., 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"
#include "libelf.h"
#define USE_REL 1 /* 386 uses REL relocations instead of RELA */
enum reloc_type
{
R_386_NONE = 0,
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_RELATIVE,
R_386_GOTOFF, R_386_GOTPC,
R_386_max
};
#if 0
static CONST char *CONST reloc_type_names[] =
{
"R_386_NONE",
"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_RELATIVE",
"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)
};
#ifdef DEBUG_GEN_RELOC
#define TRACE(str) fprintf (stderr, "i386 bfd reloc lookup %d (%s)\n", code, str)
#else
#define TRACE(str)
#endif
static CONST struct reloc_howto_struct *
DEFUN (elf_i386_reloc_type_lookup, (abfd, code),
bfd *abfd AND
bfd_reloc_code_real_type code)
{
switch (code)
{
case BFD_RELOC_NONE:
TRACE ("BFD_RELOC_NONE");
return &elf_howto_table[ (int)R_386_NONE ];
case BFD_RELOC_32:
TRACE ("BFD_RELOC_32");
return &elf_howto_table[ (int)R_386_32 ];
case BFD_RELOC_32_PCREL:
TRACE ("BFD_RELOC_PC32");
return &elf_howto_table[ (int)R_386_PC32 ];
default:
abort ();
}
TRACE ("Unknown");
return 0;
}
static void
DEFUN(elf_i386_info_to_howto, (abfd, cache_ptr, dst),
bfd *abfd AND
arelent *cache_ptr AND
Elf32_Internal_Rela *dst)
{
BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < R_386_GOT32);
cache_ptr->howto = &elf_howto_table[ELF32_R_TYPE(dst->r_info)];
}
static void
DEFUN(elf_i386_info_to_howto_rel, (abfd, cache_ptr, dst),
bfd *abfd AND
arelent *cache_ptr AND
Elf32_Internal_Rel *dst)
{
BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < R_386_GOT32);
cache_ptr->howto = &elf_howto_table[ELF32_R_TYPE(dst->r_info)];
}
#define TARGET_LITTLE_SYM bfd_elf32_i386_vec
#define TARGET_LITTLE_NAME "elf32-i386"
#define ELF_ARCH bfd_arch_i386
#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
#include "elf32-target.h"