aboutsummaryrefslogtreecommitdiff
path: root/bfd/peicode.h
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>1999-05-11 21:05:44 +0000
committerDJ Delorie <dj@redhat.com>1999-05-11 21:05:44 +0000
commitec0ef80e9f48ae59958cfe0ff8a998881833ca12 (patch)
tree49e5eabeda00d3d94f7b8658e6154502d69a066f /bfd/peicode.h
parent69f868fa5d9e1847c9d73b92da32eec8d8821650 (diff)
downloadgdb-ec0ef80e9f48ae59958cfe0ff8a998881833ca12.zip
gdb-ec0ef80e9f48ae59958cfe0ff8a998881833ca12.tar.gz
gdb-ec0ef80e9f48ae59958cfe0ff8a998881833ca12.tar.bz2
* 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 79d16e5..f15e0ec 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