[PATCH] ld: Write globals stream in PDB

Mark Harmstone mark@harmstone.com
Tue Dec 6 17:52:10 GMT 2022
Thanks Nick.

On 6/12/22 17:07, Nick Clifton wrote:
 >
 >> +struct global
 >> +{
 >> +  struct global *next;
 >> +  uint32_t offset;
 >> +  uint32_t hash;
 >> +  uint32_t refcount;
 >> +  unsigned int index;
 >> +  uint8_t data[];
 >> +};
 >
 > I dislike variable length arrays, espcially ones that do not have an
 > associated length field for bounds checking.  I understand the need,
 > but I would definitely advise being more paranoid...

There is bounds-checking, it's just not immediately obvious. It ends
with a CodeView record, so the first two bytes of "data" are a little-
endian uint16_t of how many bytes follow.

 >> +/* Compare an entry in the string table with a string.  */
 >> +static int
 >> +eq_string_table_entry (const void *a, const void *b)
 >
 > Is this really an "int" function ?  It looks like it returns a bool
 > to me.

It's a htab_eq, as seen in include/hashtab.h. It's old, it looks like it was
written before _Bool was standardized.

 > I also found that the patch no longer applies to today's sources, so if you
 > could rebase it that would be great.

Sorry, that's because it's part of a larger set of patches, starting with
"[PATCH v2] ld: Generate PDB string table" at
https://sourceware.org/pipermail/binutils/2022-November/thread.html ... I seem
to have confused Jan Beulich with this too.

I think the easiest way is probably if you let me know which (if any) patches
you're happy with, and I'll resubmit the rest as a job lot. I think this patch
series is complete now.

Thanks

Mark


More information about the Binutils mailing list