* ecoff.c (_bfd_ecoff_write_armap): give the symtab element a

reasonable mode until "ar x" is smart enough to skip it (fixes
	gcc/libgcc.a builds on mips-ecoff targets
	* coffcode.h (styp_to_sec_flags): Explain how COMDATs are supposed
	to work.  Hack to support MS import libraries, which use different
	COMDAT types than GNU.
	(coff_slurp_symbol_table): C_SECTION symbols are local; they refer
	to implied zero-length sections (see peicode below)
	* coffgen.c (coff_get_normalized_symtab): Properly read long MS
	filename symbols, which use one *or more* auxents.
	* coffswap.h (coff_swap_aux_in): ditto
	* peicode.h (coff_swap_sym_in): Build the implied zero-length
	sections
This commit is contained in:
DJ Delorie 1999-05-11 21:05:44 +00:00
parent 69f868fa5d
commit ec0ef80e9f
6 changed files with 125 additions and 4 deletions

View file

@ -504,6 +504,7 @@ coff_swap_sym_in (abfd, ext1, in1)
{
in->n_value = 0x0;
#if 0
/* FIXME: This is clearly wrong. The problem seems to be that
undefined C_SECTION symbols appear in the first object of a
MS generated .lib file, and the symbols are not defined
@ -518,6 +519,55 @@ coff_swap_sym_in (abfd, ext1, in1)
/* in->n_scnum = 3; */
/* else */
/* in->n_scnum = 2; */
#else
/* Create synthetic empty sections as needed. DJ */
if (in->n_scnum == 0)
{
asection *sec;
for (sec=abfd->sections; sec; sec=sec->next)
{
if (strcmp (sec->name, in->n_name) == 0)
{
in->n_scnum = sec->target_index;
break;
}
}
}
if (in->n_scnum == 0)
{
int unused_section_number = 0;
asection *sec;
char *name;
for (sec=abfd->sections; sec; sec=sec->next)
if (unused_section_number <= sec->target_index)
unused_section_number = sec->target_index+1;
name = bfd_alloc (abfd, strlen (in->n_name) + 10);
if (name == NULL)
return;
strcpy (name, in->n_name);
sec = bfd_make_section_anyway (abfd, name);
sec->vma = 0;
sec->lma = 0;
sec->_cooked_size = 0;
sec->_raw_size = 0;
sec->filepos = 0;
sec->rel_filepos = 0;
sec->reloc_count = 0;
sec->line_filepos = 0;
sec->lineno_count = 0;
sec->userdata = NULL;
sec->next = (asection *) NULL;
sec->flags = 0;
sec->alignment_power = 2;
sec->flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD;
sec->target_index = unused_section_number;
in->n_scnum = unused_section_number;
}
#endif
}
#ifdef coff_swap_sym_in_hook