mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 03:54:41 +08:00
2000-11-08 Kazu Hirata <kazu@hxi.com>
* coff-a29k.c: Fix formatting. * coff-alpha.c: Likewise. * coff-apollo.c: Likewise. * coff-aux.c: Likewise.
This commit is contained in:
parent
f44c642f36
commit
346ceb11ed
@ -12,6 +12,10 @@
|
||||
* bfd.c: Likewise.
|
||||
* binary.c: Likewise.
|
||||
* bout.c: Likewise.
|
||||
* coff-a29k.c: Likewise.
|
||||
* coff-alpha.c: Likewise.
|
||||
* coff-apollo.c: Likewise.
|
||||
* coff-aux.c: Likewise.
|
||||
|
||||
2000-11-07 Kazu Hirata <kazu@hxi.com>
|
||||
|
||||
|
103
bfd/coff-a29k.c
103
bfd/coff-a29k.c
@ -49,21 +49,21 @@ static boolean coff_a29k_adjust_symndx
|
||||
|
||||
/* Provided the symbol, returns the value reffed */
|
||||
static long
|
||||
get_symbol_value (symbol)
|
||||
get_symbol_value (symbol)
|
||||
asymbol *symbol;
|
||||
{
|
||||
{
|
||||
long relocation = 0;
|
||||
|
||||
if (bfd_is_com_section (symbol->section))
|
||||
{
|
||||
relocation = 0;
|
||||
relocation = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
{
|
||||
relocation = symbol->value +
|
||||
symbol->section->output_section->vma +
|
||||
symbol->section->output_offset;
|
||||
}
|
||||
}
|
||||
|
||||
return(relocation);
|
||||
}
|
||||
@ -94,7 +94,7 @@ a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
|
||||
|
||||
unsigned long addr = reloc_entry->address ; /*+ input_section->vma*/
|
||||
bfd_byte *hit_data =addr + (bfd_byte *)(data);
|
||||
|
||||
|
||||
r_type = reloc_entry->howto->type;
|
||||
|
||||
if (output_bfd) {
|
||||
@ -108,7 +108,7 @@ a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
|
||||
&& bfd_is_und_section (symbol_in->section))
|
||||
{
|
||||
/* Keep the state machine happy in case we're called again */
|
||||
if (r_type == R_IHIHALF)
|
||||
if (r_type == R_IHIHALF)
|
||||
{
|
||||
part1_consth_active = true;
|
||||
part1_consth_value = 0;
|
||||
@ -116,20 +116,19 @@ a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
|
||||
return(bfd_reloc_undefined);
|
||||
}
|
||||
|
||||
if ((part1_consth_active) && (r_type != R_IHCONST))
|
||||
if ((part1_consth_active) && (r_type != R_IHCONST))
|
||||
{
|
||||
part1_consth_active = false;
|
||||
*error_message = (char *) _("Missing IHCONST");
|
||||
return(bfd_reloc_dangerous);
|
||||
}
|
||||
|
||||
|
||||
sym_value = get_symbol_value(symbol_in);
|
||||
|
||||
switch (r_type)
|
||||
switch (r_type)
|
||||
{
|
||||
case R_IREL:
|
||||
insn = bfd_get_32(abfd, hit_data);
|
||||
case R_IREL:
|
||||
insn = bfd_get_32(abfd, hit_data);
|
||||
/* Take the value in the field and sign extend it */
|
||||
signed_value = EXTRACT_HWORD(insn);
|
||||
signed_value = SIGN_EXTEND_HWORD(signed_value);
|
||||
@ -144,39 +143,39 @@ a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
|
||||
{ /* Absolute jmp/call */
|
||||
insn |= (1<<24); /* Make it absolute */
|
||||
/* FIXME: Should we change r_type to R_IABS */
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Relative jmp/call, so subtract from the value the
|
||||
address of the place we're coming from */
|
||||
signed_value -= (reloc_entry->address
|
||||
+ input_section->output_section->vma
|
||||
+ input_section->output_offset);
|
||||
if (signed_value>0x1ffff || signed_value<-0x20000)
|
||||
if (signed_value>0x1ffff || signed_value<-0x20000)
|
||||
return(bfd_reloc_overflow);
|
||||
}
|
||||
signed_value >>= 2;
|
||||
insn = INSERT_HWORD(insn, signed_value);
|
||||
bfd_put_32(abfd, insn ,hit_data);
|
||||
bfd_put_32(abfd, insn ,hit_data);
|
||||
break;
|
||||
case R_ILOHALF:
|
||||
insn = bfd_get_32(abfd, hit_data);
|
||||
case R_ILOHALF:
|
||||
insn = bfd_get_32(abfd, hit_data);
|
||||
unsigned_value = EXTRACT_HWORD(insn);
|
||||
unsigned_value += sym_value + reloc_entry->addend;
|
||||
insn = INSERT_HWORD(insn, unsigned_value);
|
||||
bfd_put_32(abfd, insn, hit_data);
|
||||
bfd_put_32(abfd, insn, hit_data);
|
||||
break;
|
||||
case R_IHIHALF:
|
||||
insn = bfd_get_32(abfd, hit_data);
|
||||
/* consth, part 1
|
||||
insn = bfd_get_32(abfd, hit_data);
|
||||
/* consth, part 1
|
||||
Just get the symbol value that is referenced */
|
||||
part1_consth_active = true;
|
||||
part1_consth_value = sym_value + reloc_entry->addend;
|
||||
/* Don't modify insn until R_IHCONST */
|
||||
break;
|
||||
case R_IHCONST:
|
||||
insn = bfd_get_32(abfd, hit_data);
|
||||
/* consth, part 2
|
||||
case R_IHCONST:
|
||||
insn = bfd_get_32(abfd, hit_data);
|
||||
/* consth, part 2
|
||||
Now relocate the reference */
|
||||
if (part1_consth_active == false) {
|
||||
*error_message = (char *) _("Missing IHIHALF");
|
||||
@ -189,25 +188,25 @@ a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
|
||||
unsigned_value = unsigned_value >> 16;
|
||||
insn = INSERT_HWORD(insn, unsigned_value);
|
||||
part1_consth_active = false;
|
||||
bfd_put_32(abfd, insn, hit_data);
|
||||
bfd_put_32(abfd, insn, hit_data);
|
||||
break;
|
||||
case R_BYTE:
|
||||
insn = bfd_get_8(abfd, hit_data);
|
||||
unsigned_value = insn + sym_value + reloc_entry->addend;
|
||||
insn = bfd_get_8(abfd, hit_data);
|
||||
unsigned_value = insn + sym_value + reloc_entry->addend;
|
||||
if (unsigned_value & 0xffffff00)
|
||||
return(bfd_reloc_overflow);
|
||||
bfd_put_8(abfd, unsigned_value, hit_data);
|
||||
bfd_put_8(abfd, unsigned_value, hit_data);
|
||||
break;
|
||||
case R_HWORD:
|
||||
insn = bfd_get_16(abfd, hit_data);
|
||||
unsigned_value = insn + sym_value + reloc_entry->addend;
|
||||
insn = bfd_get_16(abfd, hit_data);
|
||||
unsigned_value = insn + sym_value + reloc_entry->addend;
|
||||
if (unsigned_value & 0xffff0000)
|
||||
return(bfd_reloc_overflow);
|
||||
bfd_put_16(abfd, insn, hit_data);
|
||||
bfd_put_16(abfd, insn, hit_data);
|
||||
break;
|
||||
case R_WORD:
|
||||
insn = bfd_get_32(abfd, hit_data);
|
||||
insn += sym_value + reloc_entry->addend;
|
||||
insn = bfd_get_32(abfd, hit_data);
|
||||
insn += sym_value + reloc_entry->addend;
|
||||
bfd_put_32(abfd, insn, hit_data);
|
||||
break;
|
||||
default:
|
||||
@ -215,8 +214,7 @@ a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
|
||||
return (bfd_reloc_dangerous);
|
||||
}
|
||||
|
||||
|
||||
return(bfd_reloc_ok);
|
||||
return(bfd_reloc_ok);
|
||||
}
|
||||
|
||||
/* type rightshift
|
||||
@ -228,12 +226,12 @@ a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
|
||||
complain_on_overflow
|
||||
special_function
|
||||
relocation name
|
||||
partial_inplace
|
||||
partial_inplace
|
||||
src_mask
|
||||
*/
|
||||
|
||||
/*FIXME: I'm not real sure about this table */
|
||||
static reloc_howto_type howto_table[] =
|
||||
static reloc_howto_type howto_table[] =
|
||||
{
|
||||
{R_ABS, 0, 3, 32, false, 0, complain_overflow_bitfield,a29k_reloc,"ABS", true, 0xffffffff,0xffffffff, false},
|
||||
EMPTY_HOWTO (1),
|
||||
@ -284,10 +282,10 @@ reloc_processing (relent,reloc, symbols, abfd, section)
|
||||
{
|
||||
static bfd_vma ihihalf_vaddr = (bfd_vma) -1;
|
||||
|
||||
relent->address = reloc->r_vaddr;
|
||||
relent->address = reloc->r_vaddr;
|
||||
relent->howto = howto_table + reloc->r_type;
|
||||
if (reloc->r_type == R_IHCONST)
|
||||
{
|
||||
if (reloc->r_type == R_IHCONST)
|
||||
{
|
||||
/* The address of an R_IHCONST should always be the address of
|
||||
the immediately preceding R_IHIHALF. relocs generated by gas
|
||||
are correct, but relocs generated by High C are different (I
|
||||
@ -298,27 +296,27 @@ reloc_processing (relent,reloc, symbols, abfd, section)
|
||||
abort ();
|
||||
relent->address = ihihalf_vaddr;
|
||||
ihihalf_vaddr = (bfd_vma) -1;
|
||||
relent->addend = reloc->r_symndx;
|
||||
relent->addend = reloc->r_symndx;
|
||||
relent->sym_ptr_ptr= bfd_abs_section_ptr->symbol_ptr_ptr;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
asymbol *ptr;
|
||||
relent->sym_ptr_ptr = symbols + obj_convert(abfd)[reloc->r_symndx];
|
||||
|
||||
ptr = *(relent->sym_ptr_ptr);
|
||||
|
||||
if (ptr
|
||||
&& bfd_asymbol_bfd(ptr) == abfd
|
||||
if (ptr
|
||||
&& bfd_asymbol_bfd(ptr) == abfd
|
||||
|
||||
&& ((ptr->flags & BSF_OLD_COMMON)== 0))
|
||||
{
|
||||
&& ((ptr->flags & BSF_OLD_COMMON)== 0))
|
||||
{
|
||||
relent->addend = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
relent->addend = 0;
|
||||
}
|
||||
{
|
||||
relent->addend = 0;
|
||||
}
|
||||
relent->address-= section->vma;
|
||||
if (reloc->r_type == R_IHIHALF)
|
||||
ihihalf_vaddr = relent->address;
|
||||
@ -570,7 +568,7 @@ coff_a29k_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
rel->r_vaddr - input_section->vma)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -580,7 +578,6 @@ coff_a29k_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
/* We don't want to change the symndx of a R_IHCONST reloc, since it
|
||||
is actually an addend, not a symbol index at all. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
static boolean
|
||||
coff_a29k_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
|
||||
bfd *obfd ATTRIBUTE_UNUSED;
|
||||
|
@ -924,7 +924,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
|
||||
does not cause anything to happen, itself. */
|
||||
rel->address += input_section->output_offset;
|
||||
break;
|
||||
|
||||
|
||||
case ALPHA_R_GPDISP:
|
||||
/* This marks the ldah of an ldah/lda pair which loads the
|
||||
gp register with the difference of the gp value and the
|
||||
@ -980,7 +980,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
|
||||
rel->address += input_section->output_offset;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ALPHA_R_OP_PUSH:
|
||||
/* Push a value on the reloc evaluation stack. */
|
||||
{
|
||||
@ -1106,7 +1106,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
|
||||
stack[tos - 1] >>= relocation;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ALPHA_R_GPVALUE:
|
||||
/* I really don't know if this does the right thing. */
|
||||
gp = rel->addend;
|
||||
@ -1126,7 +1126,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
|
||||
os->reloc_count++;
|
||||
}
|
||||
|
||||
if (r != bfd_reloc_ok)
|
||||
if (r != bfd_reloc_ok)
|
||||
{
|
||||
switch (r)
|
||||
{
|
||||
@ -1136,7 +1136,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
|
||||
input_bfd, input_section, rel->address, true)))
|
||||
goto error_return;
|
||||
break;
|
||||
case bfd_reloc_dangerous:
|
||||
case bfd_reloc_dangerous:
|
||||
if (! ((*link_info->callbacks->reloc_dangerous)
|
||||
(link_info, err, input_bfd, input_section,
|
||||
rel->address)))
|
||||
@ -1332,7 +1332,7 @@ alpha_convert_external_reloc (output_bfd, info, input_bfd, ext_rel, h)
|
||||
r_symndx = RELOC_SECTION_XDATA;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (r_symndx == -1)
|
||||
abort ();
|
||||
|
||||
@ -1437,7 +1437,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
pointer. To support large programs, we need to allow multiple
|
||||
global pointers. This works as long as each input .lita section
|
||||
is <64KB big. This implies that when producing relocatable
|
||||
output, the .lita section is limited to 64KB. . */
|
||||
output, the .lita section is limited to 64KB. . */
|
||||
|
||||
lita_sec = symndx_to_section[RELOC_SECTION_LITA];
|
||||
gp = _bfd_get_gp_value (output_bfd);
|
||||
@ -1619,7 +1619,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
/* See ALPHA_R_LITERAL above for the uses of this reloc. It
|
||||
does not cause anything to happen, itself. */
|
||||
break;
|
||||
|
||||
|
||||
case ALPHA_R_GPDISP:
|
||||
/* This marks the ldah of an ldah/lda pair which loads the
|
||||
gp register with the difference of the gp value and the
|
||||
@ -1679,7 +1679,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
gp_usedp = true;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ALPHA_R_OP_PUSH:
|
||||
case ALPHA_R_OP_PSUB:
|
||||
case ALPHA_R_OP_PRSHIFT:
|
||||
@ -2008,7 +2008,6 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
/* Do final adjustments to the filehdr and the aouthdr. This routine
|
||||
sets the dynamic bits in the file header. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
static boolean
|
||||
alpha_adjust_headers (abfd, fhdr, ahdr)
|
||||
bfd *abfd;
|
||||
@ -2136,7 +2135,7 @@ alpha_ecoff_get_elt_at_filepos (archive, filepos)
|
||||
|
||||
left = size;
|
||||
|
||||
/* I don't know what the next eight bytes are for. */
|
||||
/* I don't know what the next eight bytes are for. */
|
||||
if (bfd_read (ab, 1, 8, nbfd) != 8)
|
||||
goto error_return;
|
||||
|
||||
@ -2201,7 +2200,7 @@ alpha_ecoff_get_elt_at_filepos (archive, filepos)
|
||||
error_return:
|
||||
if (nbfd != NULL)
|
||||
bfd_close (nbfd);
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Open the next archived file. */
|
||||
@ -2229,7 +2228,7 @@ alpha_ecoff_openr_next_archived_file (archive, last_file)
|
||||
|
||||
/* Pad to an even boundary...
|
||||
Note that last_file->origin can be odd in the case of
|
||||
BSD-4.4-style element with a long odd size. */
|
||||
BSD-4.4-style element with a long odd size. */
|
||||
filestart = last_file->origin + size;
|
||||
filestart += filestart % 2;
|
||||
}
|
||||
@ -2400,6 +2399,6 @@ const bfd_target ecoffalpha_little_vec =
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
NULL,
|
||||
|
||||
|
||||
(PTR) &alpha_ecoff_backend_data
|
||||
};
|
||||
|
@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#ifdef ONLY_DECLARE_RELOCS
|
||||
extern reloc_howto_type apollocoff_howto_table[];
|
||||
#else
|
||||
reloc_howto_type apollocoff_howto_table[] =
|
||||
reloc_howto_type apollocoff_howto_table[] =
|
||||
{
|
||||
HOWTO(R_RELBYTE, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "8", true, 0x000000ff,0x000000ff, false),
|
||||
HOWTO(R_RELWORD, 0, 1, 16, false, 0, complain_overflow_bitfield, 0, "16", true, 0x0000ffff,0x0000ffff, false),
|
||||
@ -59,7 +59,7 @@ apollo_rtype2howto(internal, relocentry)
|
||||
arelent *internal;
|
||||
int relocentry;
|
||||
{
|
||||
switch (relocentry)
|
||||
switch (relocentry)
|
||||
{
|
||||
case R_RELBYTE: internal->howto = apollocoff_howto_table + 0; break;
|
||||
case R_RELWORD: internal->howto = apollocoff_howto_table + 1; break;
|
||||
@ -71,13 +71,13 @@ apollo_rtype2howto(internal, relocentry)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
apollo_howto2rtype (internal)
|
||||
reloc_howto_type *internal;
|
||||
{
|
||||
if (internal->pc_relative)
|
||||
if (internal->pc_relative)
|
||||
{
|
||||
switch (internal->bitsize)
|
||||
switch (internal->bitsize)
|
||||
{
|
||||
case 32: return R_PCRLONG;
|
||||
case 16: return R_PCRWORD;
|
||||
@ -93,7 +93,7 @@ apollo_howto2rtype (internal)
|
||||
case 8: return R_RELBYTE;
|
||||
}
|
||||
}
|
||||
return R_RELLONG;
|
||||
return R_RELLONG;
|
||||
}
|
||||
#endif /* not ONLY_DECLARE_RELOCS */
|
||||
|
||||
|
@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
/* 4k pages */
|
||||
#define COFF_PAGE_SIZE 0x1000
|
||||
|
||||
/* On AUX, a STYP_NOLOAD|STYP_BSS section is part of a shared library. */
|
||||
/* On AUX, a STYP_NOLOAD|STYP_BSS section is part of a shared library. */
|
||||
#define BSS_NOLOAD_IS_SHARED_LIBRARY
|
||||
|
||||
#define STATIC_RELOCS
|
||||
@ -41,8 +41,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "sysdep.h"
|
||||
|
||||
static boolean coff_m68k_aux_link_add_one_symbol
|
||||
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
|
||||
asection *, bfd_vma, const char *, boolean, boolean,
|
||||
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
|
||||
asection *, bfd_vma, const char *, boolean, boolean,
|
||||
struct bfd_link_hash_entry **));
|
||||
|
||||
#define coff_link_add_one_symbol coff_m68k_aux_link_add_one_symbol
|
||||
@ -54,7 +54,7 @@ static boolean coff_m68k_aux_link_add_one_symbol
|
||||
mirrors Apple's "solution" to let a static library symbol override
|
||||
a shared library symbol. On the whole not a good thing, given how
|
||||
shared libraries work here, but can work if you are careful with
|
||||
what you include in the shared object. */
|
||||
what you include in the shared object. */
|
||||
|
||||
static boolean
|
||||
coff_m68k_aux_link_add_one_symbol (info, abfd, name, flags, section, value,
|
||||
|
Loading…
Reference in New Issue
Block a user