[RFA-v2] Fix PR 16201: internal error on a cygwin program linked against a DLL with no .data section
Pedro Alves
palves@redhat.com
Mon Jan 6 18:34:00 GMT 2014
Hi Pierre,
Sorry for the slow reply. Been away on vacation.
On 12/22/2013 10:55 PM, Pierre Muller wrote:
> @@ -455,17 +458,34 @@ read_pe_exported_syms (struct objfile *objfile)
> unsigned long characteristics = pe_get32 (dll, secptr1 + 36);
> char sec_name[SCNNMLEN + 1];
> int sectix;
> + unsigned int bfd_section_index;
> + asection *section;
>
> bfd_seek (dll, (file_ptr) secptr1 + 0, SEEK_SET);
> bfd_bread (sec_name, (bfd_size_type) SCNNMLEN, dll);
> sec_name[SCNNMLEN] = '\0';
>
> sectix = read_pe_section_index (sec_name);
> + section = bfd_get_section_by_name (dll, sec_name);
Can't coff have sections with duplicate names? If so,
then it'd be better to match the section some other way,
I guess by address?
> + if (section)
> + bfd_section_index = section->index;
> + else
> + bfd_section_index = -1;
>
> if (sectix != PE_SECTION_INDEX_INVALID)
> {
> section_data[sectix].rva_start = vaddr;
> section_data[sectix].rva_end = vaddr + vsize;
> + /* For .text, .data and .bss section
> + set corresponding sect_index_XXX,
> + even if it was already set before. */
> + if (sectix == PE_SECTION_INDEX_TEXT)
> + objfile->sect_index_text = sectix;
> + if (sectix == PE_SECTION_INDEX_DATA)
> + objfile->sect_index_data = sectix;
> + if (sectix == PE_SECTION_INDEX_BSS)
> + objfile->sect_index_bss = sectix;
> + section_data[sectix].index = bfd_section_index;
Do you still need this part?
> }
--
Pedro Alves
More information about the Gdb-patches
mailing list