summaryrefslogtreecommitdiff
path: root/bfd/peicode.h
diff options
context:
space:
mode:
authorDJ Delorie <dj@delorie.com>1999-05-11 21:05:44 +0000
committerDJ Delorie <dj@delorie.com>1999-05-11 21:05:44 +0000
commit436e09cc959b8bbc222cd63ce7873ef25383b441 (patch)
tree8460106e5d5f40f913b827631d4c60d3bdd71958 /bfd/peicode.h
parentac5429cbc800b60040b8b230186493015596b8fa (diff)
downloadgdb-436e09cc959b8bbc222cd63ce7873ef25383b441.tar.gz
* 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
Diffstat (limited to 'bfd/peicode.h')
-rw-r--r--bfd/peicode.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/bfd/peicode.h b/bfd/peicode.h
index 79d16e5abe9..f15e0ec28ba 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -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