Re: [PATCH 6/7] gdb: select "Cygwin" OS ABI for Cygwin binaries

Simon Marchi
2020-03-16T21:01:03Z

On 2020-03-16 3:03 p.m., Jon Turney wrote:
>> +bool
>> +is_linked_with_cygwin_dll (bfd *abfd)
>> +{
>> + /* The list of DLLs a PE is linked to is in the .idata section. See:
>> +
>> + https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#the-idata-section
>> + */
>> + asection *idata_section = bfd_get_section_by_name (abfd, ".idata");
>> + if (idata_section == nullptr)
>> + return false;
>
> I'm fine with this as-is, but FTR I think this only happens to work
> because binutils ld (which is probably the only way to currently build a
> cygwin executable) puts the import table in the .idata section.
>
> The strictly correct way to locate the import table is to use the data
> directory (as pe_print_idata() does)
>
> (See
> https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#optional-header-data-directories-image-only)
>
> (Notwithstanding the MS documentation you linked, I believe MS tools can
> put the import table in .rdata)
>

After clarification with Jon on IRC, the current code is sufficient for the
moment.

I've pushed the series, thanks.

Simon