From ec0ef80e9f48ae59958cfe0ff8a998881833ca12 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Tue, 11 May 1999 21:05:44 +0000 Subject: * 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 --- bfd/coffcode.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'bfd/coffcode.h') diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 383719c..bee6b66 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -588,6 +588,12 @@ styp_to_sec_flags (abfd, hdr, name) can't call slurp_symtab, because the linker doesn't want the swapped symbols. */ + /* COMDAT sections are special. The first symbol is the section + symbol, which tells what kind of COMDAT section it is. The + *second* symbol is the "comdat symbol" - the one with the + unique name. GNU uses the section symbol for the unique + name; MS uses ".text" for every comdat section. Sigh. - DJ */ + if (_bfd_coff_get_external_symbols (abfd)) { bfd_byte *esym, *esymend; @@ -629,10 +635,23 @@ styp_to_sec_flags (abfd, hdr, name) isym.n_type, isym.n_sclass, 0, isym.n_numaux, (PTR) &aux); + /* FIXME: Microsoft uses NODUPLICATES and + ASSOCIATIVE, but gnu uses ANY and SAME_SIZE. + Unfortunately, gnu doesn't do the comdat + symbols right. So, until we can fix it to do + the right thing, we are temporarily disabling + comdats for the MS types (they're used in + DLLs and C++, but we don't support *their* + C++ libraries anyway - DJ */ + switch (aux.x_scn.x_comdat) { case IMAGE_COMDAT_SELECT_NODUPLICATES: +#if 0 sec_flags |= SEC_LINK_DUPLICATES_ONE_ONLY; +#else + sec_flags &= ~SEC_LINK_ONCE; +#endif break; default: @@ -649,8 +668,12 @@ styp_to_sec_flags (abfd, hdr, name) break; case IMAGE_COMDAT_SELECT_ASSOCIATIVE: +#if 0 /* FIXME: This is not currently implemented. */ sec_flags |= SEC_LINK_DUPLICATES_DISCARD; +#else + sec_flags &= ~SEC_LINK_ONCE; +#endif break; } @@ -3581,6 +3604,11 @@ coff_slurp_symbol_table (abfd) #ifdef COFF_WITH_PE if (src->u.syment.n_sclass == C_NT_WEAK) dst->symbol.flags = BSF_WEAK; + if (src->u.syment.n_sclass == C_SECTION + && src->u.syment.n_scnum > 0) + { + dst->symbol.flags = BSF_LOCAL; + } #endif if (src->u.syment.n_sclass == C_WEAKEXT) -- cgit v1.1