[PATCH v3] bfd: fill in PE load config directory entry.

Jeremy Drake sourceware-bugzilla@jdrake.com
Thu Mar 20 18:22:26 GMT 2025


On Thu, 20 Mar 2025, Jan Beulich wrote:

> On 13.03.2025 18:14, Jeremy Drake wrote:
> > @@ -4573,6 +4575,48 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo)
> >  #endif
> >      }
> >
> > +  h1 = coff_link_hash_lookup (coff_hash_table (info),
> > +			      (bfd_get_symbol_leading_char (abfd) != 0
> > +			       ? "__load_config_used" : "_load_config_used"),
>
> Still assuming bfd_get_symbol_leading_char() can only ever return nil or '_'?

Yes:
> Nevertheless, because of the pre-existing similar code, I'm not going to
> insist that this be corrected right here.

> I wonder if we can indeed blindly use that value, with no sanity checking
> whatsoever.
>
> Furthermore, having checked two random executables each from two random VC
> installations, I find that the size in the data directory and the value at
> the start of the referenced RVA aren't the same: In all four cases the data
> directory says 0x40 while the 32-bit item at the indicated RVA is 0x48.

That's odd.  This matches what LLD does (though they do indeed do some
sanity checking):
https://github.com/llvm/llvm-project/blob/49f06075a6d298bd13564c9bffcf51281bed4962/lld/COFF/SymbolTable.cpp#L576


More information about the Binutils mailing list