diff options
Diffstat (limited to 'bfd/peicode.h')
-rw-r--r-- | bfd/peicode.h | 50 |
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 |