* aoutx.h (NAME(aout,slurp_symbol_table)): Don't return an error
if there are no symbols. * coffgen.c (coff_get_normalized_symtab): Likewise. * hp300hpux.c (MY(slurp_symbol_table)): Likewise.
This commit is contained in:
parent
fa52d491eb
commit
7494246592
|
@ -1,3 +1,10 @@
|
||||||
|
Wed Oct 19 01:26:39 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||||
|
|
||||||
|
* aoutx.h (NAME(aout,slurp_symbol_table)): Don't return an error
|
||||||
|
if there are no symbols.
|
||||||
|
* coffgen.c (coff_get_normalized_symtab): Likewise.
|
||||||
|
* hp300hpux.c (MY(slurp_symbol_table)): Likewise.
|
||||||
|
|
||||||
Tue Oct 18 12:56:43 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
|
Tue Oct 18 12:56:43 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
|
||||||
|
|
||||||
* aout-target.h (MY_bfd_copy_private_section_data): Only copy
|
* aout-target.h (MY_bfd_copy_private_section_data): Only copy
|
||||||
|
|
114
bfd/aoutx.h
114
bfd/aoutx.h
|
@ -794,6 +794,11 @@ adjust_o_magic (abfd, execp)
|
||||||
|
|
||||||
/* Text. */
|
/* Text. */
|
||||||
obj_textsec(abfd)->filepos = pos;
|
obj_textsec(abfd)->filepos = pos;
|
||||||
|
if (!obj_textsec(abfd)->user_set_vma)
|
||||||
|
obj_textsec(abfd)->vma = vma;
|
||||||
|
else
|
||||||
|
vma = obj_textsec(abfd)->vma;
|
||||||
|
|
||||||
pos += obj_textsec(abfd)->_raw_size;
|
pos += obj_textsec(abfd)->_raw_size;
|
||||||
vma += obj_textsec(abfd)->_raw_size;
|
vma += obj_textsec(abfd)->_raw_size;
|
||||||
|
|
||||||
|
@ -1664,7 +1669,7 @@ NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic)
|
||||||
in->desc = bfd_h_get_16 (abfd, ext->e_desc);
|
in->desc = bfd_h_get_16 (abfd, ext->e_desc);
|
||||||
in->other = bfd_h_get_8 (abfd, ext->e_other);
|
in->other = bfd_h_get_8 (abfd, ext->e_other);
|
||||||
in->type = bfd_h_get_8 (abfd, ext->e_type);
|
in->type = bfd_h_get_8 (abfd, ext->e_type);
|
||||||
in->symbol.udata = 0;
|
in->symbol.udata.p = NULL;
|
||||||
|
|
||||||
if (! translate_from_native_sym_flags (abfd, in))
|
if (! translate_from_native_sym_flags (abfd, in))
|
||||||
return false;
|
return false;
|
||||||
|
@ -1697,21 +1702,16 @@ NAME(aout,slurp_symbol_table) (abfd)
|
||||||
if (! aout_get_external_symbols (abfd))
|
if (! aout_get_external_symbols (abfd))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj_aout_external_sym_count (abfd) == 0)
|
|
||||||
{
|
|
||||||
bfd_set_error (bfd_error_no_symbols);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
cached_size = (obj_aout_external_sym_count (abfd)
|
cached_size = (obj_aout_external_sym_count (abfd)
|
||||||
* sizeof (aout_symbol_type));
|
* sizeof (aout_symbol_type));
|
||||||
cached = (aout_symbol_type *) malloc (cached_size);
|
cached = (aout_symbol_type *) malloc (cached_size);
|
||||||
if (cached == NULL)
|
if (cached == NULL && cached_size != 0)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
bfd_set_error (bfd_error_no_memory);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
memset (cached, 0, cached_size);
|
if (cached_size != 0)
|
||||||
|
memset (cached, 0, cached_size);
|
||||||
|
|
||||||
/* Convert from external symbol information to internal. */
|
/* Convert from external symbol information to internal. */
|
||||||
if (! (NAME(aout,translate_symbol_table)
|
if (! (NAME(aout,translate_symbol_table)
|
||||||
|
@ -3980,10 +3980,12 @@ aout_link_write_other_symbol (h, data)
|
||||||
|
|
||||||
h->written = true;
|
h->written = true;
|
||||||
|
|
||||||
if (finfo->info->strip == strip_all
|
/* An indx of -2 means the symbol must be written. */
|
||||||
|| (finfo->info->strip == strip_some
|
if (h->indx != -2
|
||||||
&& bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string,
|
&& (finfo->info->strip == strip_all
|
||||||
false, false) == NULL))
|
|| (finfo->info->strip == strip_some
|
||||||
|
&& bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string,
|
||||||
|
false, false) == NULL)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
switch (h->root.type)
|
switch (h->root.type)
|
||||||
|
@ -4308,15 +4310,35 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
|
||||||
|
|
||||||
if (r_index == -1)
|
if (r_index == -1)
|
||||||
{
|
{
|
||||||
const char *name;
|
if (h != NULL)
|
||||||
|
{
|
||||||
|
/* We decided to strip this symbol, but it
|
||||||
|
turns out that we can't. Note that we
|
||||||
|
lose the other and desc information here.
|
||||||
|
I don't think that will ever matter for a
|
||||||
|
global symbol. */
|
||||||
|
if (h->indx < 0)
|
||||||
|
{
|
||||||
|
h->indx = -2;
|
||||||
|
h->written = false;
|
||||||
|
if (! aout_link_write_other_symbol (h,
|
||||||
|
(PTR) finfo))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
r_index = h->indx;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
|
||||||
name = strings + GET_WORD (input_bfd,
|
name = strings + GET_WORD (input_bfd,
|
||||||
syms[r_index].e_strx);
|
syms[r_index].e_strx);
|
||||||
if (! ((*finfo->info->callbacks->unattached_reloc)
|
if (! ((*finfo->info->callbacks->unattached_reloc)
|
||||||
(finfo->info, name, input_bfd, input_section,
|
(finfo->info, name, input_bfd, input_section,
|
||||||
r_addr)))
|
r_addr)))
|
||||||
return false;
|
return false;
|
||||||
r_index = 0;
|
r_index = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
relocation = 0;
|
relocation = 0;
|
||||||
|
@ -4597,15 +4619,35 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
|
||||||
|
|
||||||
if (r_index == -1)
|
if (r_index == -1)
|
||||||
{
|
{
|
||||||
const char *name;
|
if (h != NULL)
|
||||||
|
{
|
||||||
|
/* We decided to strip this symbol, but it
|
||||||
|
turns out that we can't. Note that we
|
||||||
|
lose the other and desc information here.
|
||||||
|
I don't think that will ever matter for a
|
||||||
|
global symbol. */
|
||||||
|
if (h->indx < 0)
|
||||||
|
{
|
||||||
|
h->indx = -2;
|
||||||
|
h->written = false;
|
||||||
|
if (! aout_link_write_other_symbol (h,
|
||||||
|
(PTR) finfo))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
r_index = h->indx;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
|
||||||
name = (strings
|
name = strings + GET_WORD (input_bfd,
|
||||||
+ GET_WORD (input_bfd, syms[r_index].e_strx));
|
syms[r_index].e_strx);
|
||||||
if (! ((*finfo->info->callbacks->unattached_reloc)
|
if (! ((*finfo->info->callbacks->unattached_reloc)
|
||||||
(finfo->info, name, input_bfd, input_section,
|
(finfo->info, name, input_bfd, input_section,
|
||||||
r_addr)))
|
r_addr)))
|
||||||
return false;
|
return false;
|
||||||
r_index = 0;
|
r_index = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
relocation = 0;
|
relocation = 0;
|
||||||
|
@ -4827,8 +4869,20 @@ aout_link_reloc_link_order (finfo, o, p)
|
||||||
h = aout_link_hash_lookup (aout_hash_table (finfo->info),
|
h = aout_link_hash_lookup (aout_hash_table (finfo->info),
|
||||||
pr->u.name, false, false, true);
|
pr->u.name, false, false, true);
|
||||||
if (h != (struct aout_link_hash_entry *) NULL
|
if (h != (struct aout_link_hash_entry *) NULL
|
||||||
&& h->indx == -1)
|
&& h->indx >= 0)
|
||||||
r_index = h->indx;
|
r_index = h->indx;
|
||||||
|
else if (h != NULL)
|
||||||
|
{
|
||||||
|
/* We decided to strip this symbol, but it turns out that we
|
||||||
|
can't. Note that we lose the other and desc information
|
||||||
|
here. I don't think that will ever matter for a global
|
||||||
|
symbol. */
|
||||||
|
h->indx = -2;
|
||||||
|
h->written = false;
|
||||||
|
if (! aout_link_write_other_symbol (h, (PTR) finfo))
|
||||||
|
return false;
|
||||||
|
r_index = h->indx;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (! ((*finfo->info->callbacks->unattached_reloc)
|
if (! ((*finfo->info->callbacks->unattached_reloc)
|
||||||
|
|
|
@ -305,35 +305,24 @@ bfd *abfd;
|
||||||
|
|
||||||
long
|
long
|
||||||
coff_get_symtab (abfd, alocation)
|
coff_get_symtab (abfd, alocation)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
asymbol **alocation;
|
asymbol **alocation;
|
||||||
{
|
{
|
||||||
unsigned int counter = 0;
|
unsigned int counter;
|
||||||
coff_symbol_type *symbase;
|
coff_symbol_type *symbase;
|
||||||
coff_symbol_type **location = (coff_symbol_type **) (alocation);
|
coff_symbol_type **location = (coff_symbol_type **) alocation;
|
||||||
if (!bfd_coff_slurp_symbol_table(abfd))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
symbase = obj_symbols(abfd);
|
if (! bfd_coff_slurp_symbol_table (abfd))
|
||||||
while (counter < bfd_get_symcount(abfd))
|
return -1;
|
||||||
{
|
|
||||||
/* This nasty code looks at the symbol to decide whether or
|
symbase = obj_symbols (abfd);
|
||||||
not it is descibes a constructor/destructor entry point. It
|
counter = bfd_get_symcount (abfd);
|
||||||
is structured this way to (hopefully) speed non matches */
|
while (counter-- > 0)
|
||||||
#if 0
|
*location++ = symbase++;
|
||||||
if (0 && symbase->symbol.name[9] == '$')
|
|
||||||
{
|
*location = NULL;
|
||||||
bfd_constructor_entry(abfd,
|
|
||||||
(asymbol **)location,
|
return bfd_get_symcount (abfd);
|
||||||
symbase->symbol.name[10] == 'I' ?
|
|
||||||
"CTOR" : "DTOR");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
*(location++) = symbase++;
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
*location++ = 0;
|
|
||||||
return bfd_get_symcount(abfd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set lineno_count for the output sections of a COFF file. */
|
/* Set lineno_count for the output sections of a COFF file. */
|
||||||
|
@ -676,7 +665,7 @@ coff_fix_symbol_name (abfd, symbol, native)
|
||||||
the relocs we can get the index for a symbol. This method is a
|
the relocs we can get the index for a symbol. This method is a
|
||||||
hack. FIXME. */
|
hack. FIXME. */
|
||||||
|
|
||||||
#define set_index(symbol, idx) ((symbol)->udata = (PTR) (idx))
|
#define set_index(symbol, idx) ((symbol)->udata.i = (idx))
|
||||||
|
|
||||||
/* Write a symbol out to a COFF file. */
|
/* Write a symbol out to a COFF file. */
|
||||||
|
|
||||||
|
@ -928,6 +917,8 @@ coff_write_symbols (abfd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
obj_raw_syment_count (abfd) = written;
|
||||||
|
|
||||||
/* Now write out strings */
|
/* Now write out strings */
|
||||||
|
|
||||||
if (string_size != 0)
|
if (string_size != 0)
|
||||||
|
@ -1280,20 +1271,14 @@ coff_get_normalized_symtab (abfd)
|
||||||
char *string_table = NULL;
|
char *string_table = NULL;
|
||||||
char *debug_section = NULL;
|
char *debug_section = NULL;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
|
|
||||||
unsigned int raw_size;
|
unsigned int raw_size;
|
||||||
if (obj_raw_syments(abfd) != (combined_entry_type *)NULL) {
|
|
||||||
return obj_raw_syments(abfd);
|
|
||||||
}
|
|
||||||
size = obj_raw_syment_count (abfd) * sizeof (combined_entry_type);
|
|
||||||
if (size == 0)
|
|
||||||
{
|
|
||||||
bfd_set_error (bfd_error_no_symbols);
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal = (combined_entry_type *)bfd_alloc(abfd, size);
|
if (obj_raw_syments (abfd) != NULL)
|
||||||
if (!internal)
|
return obj_raw_syments (abfd);
|
||||||
|
|
||||||
|
size = obj_raw_syment_count (abfd) * sizeof (combined_entry_type);
|
||||||
|
internal = (combined_entry_type *) bfd_alloc (abfd, size);
|
||||||
|
if (internal == NULL && size != 0)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
bfd_set_error (bfd_error_no_memory);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1301,19 +1286,21 @@ coff_get_normalized_symtab (abfd)
|
||||||
internal_end = internal + obj_raw_syment_count (abfd);
|
internal_end = internal + obj_raw_syment_count (abfd);
|
||||||
|
|
||||||
symesz = bfd_coff_symesz (abfd);
|
symesz = bfd_coff_symesz (abfd);
|
||||||
raw_size = obj_raw_syment_count (abfd) * symesz;
|
raw_size = obj_raw_syment_count (abfd) * symesz;
|
||||||
raw = bfd_alloc(abfd,raw_size);
|
raw = bfd_alloc (abfd, raw_size);
|
||||||
if (!raw)
|
if (raw == NULL && raw_size != 0)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
bfd_set_error (bfd_error_no_memory);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bfd_seek(abfd, obj_sym_filepos(abfd), SEEK_SET) == -1
|
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) == -1
|
||||||
|| bfd_read(raw, raw_size, 1, abfd) != raw_size)
|
|| bfd_read (raw, raw_size, 1, abfd) != raw_size)
|
||||||
return (NULL);
|
return NULL;
|
||||||
|
|
||||||
/* mark the end of the symbols */
|
/* mark the end of the symbols */
|
||||||
raw_end = (char *) raw + obj_raw_syment_count (abfd) * symesz;
|
raw_end = (char *) raw + obj_raw_syment_count (abfd) * symesz;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
FIXME SOMEDAY. A string table size of zero is very weird, but
|
FIXME SOMEDAY. A string table size of zero is very weird, but
|
||||||
probably possible. If one shows up, it will probably kill us.
|
probably possible. If one shows up, it will probably kill us.
|
||||||
|
@ -1363,7 +1350,8 @@ coff_get_normalized_symtab (abfd)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free all the raw stuff */
|
/* Free all the raw stuff */
|
||||||
bfd_release(abfd, raw);
|
if (raw != NULL)
|
||||||
|
bfd_release (abfd, raw);
|
||||||
|
|
||||||
for (internal_ptr = internal; internal_ptr < internal_end;
|
for (internal_ptr = internal; internal_ptr < internal_end;
|
||||||
internal_ptr ++)
|
internal_ptr ++)
|
||||||
|
|
Loading…
Reference in New Issue