public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: Mark Harmstone <mark@harmstone.com>, binutils@sourceware.org
Subject: Re: [PATCH] ld: Write globals stream in PDB
Date: Tue, 6 Dec 2022 17:07:32 +0000	[thread overview]
Message-ID: <767534e1-60ef-9f21-46ad-ebf9411ab6e9@redhat.com> (raw)
In-Reply-To: <20221205015347.25781-1-mark@harmstone.com>

Hi Mark,

> Parses the .debug$S sections of object files for DEBUG_S_SYMBOLS
> subsections, creating a globals stream based on the records we find.
> These also get copied into the module stream for each object file.

A few comments on the patch ...

> +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...


> +/* 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.


> +/* Remap a type reference within a CodeView symbol.  */
> +static bool remap_symbol_type (void *data, struct type_entry **map,
> +			       uint32_t num_types)

Formatting - please put the function name at the start of the next line.


> +      switch (type)
> +	{
> +	case S_GPROC32:
> +	case S_LPROC32:
> +	  scope_level++;
> +	  break;
> +
> +	case S_END:
> +	case S_PROC_ID_END:
> +	  scope_level--;
> +
> +	  if (scope_level == 0)
> +	    return data;
> +
> +	  break;
> +	}

Please can you add a default case for this switch.  Probably with
an error result of some kind, unless other types are expected and
can be ignored.  (There are several other switch statements like
this too).


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

Cheers
   Nick


  parent reply	other threads:[~2022-12-06 17:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25  2:53 [PATCH v2] ld: Generate PDB string table Mark Harmstone
2022-11-25  2:54 ` [PATCH] ld: Write DEBUG_S_FILECHKSMS entries in PDBs Mark Harmstone
2022-11-27  2:38   ` [PATCH] ld: Fix segfault in populate_publics_stream Mark Harmstone
2022-11-27  2:38     ` [PATCH] ld: Write DEBUG_S_LINES entries in PDB file Mark Harmstone
2022-11-29  0:10       ` [PATCH] ld: Write types into TPI stream of PDB Mark Harmstone
2022-11-29  0:10         ` [PATCH] ld: Write types into IPI " Mark Harmstone
2022-11-29  0:10         ` [PATCH] ld: Parse LF_UDT_SRC_LINE records when creating PDB file Mark Harmstone
2022-12-05  1:53           ` [PATCH] ld: Write globals stream in PDB Mark Harmstone
2022-12-05  1:53             ` [PATCH] ld: Copy other symbols into PDB file Mark Harmstone
2022-12-05  1:53             ` [PATCH] ld: Write linker symbols in PDB Mark Harmstone
2022-12-06 17:07             ` Nick Clifton [this message]
2022-12-06 17:52               ` [PATCH] ld: Write globals stream " Mark Harmstone
2022-12-08 11:00                 ` Nick Clifton
2022-12-09  1:11               ` Mark Harmstone
2022-11-28 14:54     ` [PATCH] ld: Fix segfault in populate_publics_stream Jan Beulich
2022-11-28 17:53       ` Mark Harmstone
2022-11-29  9:00         ` Jan Beulich
2022-11-29 17:47           ` Mark Harmstone
2022-11-30  7:00             ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=767534e1-60ef-9f21-46ad-ebf9411ab6e9@redhat.com \
    --to=nickc@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=mark@harmstone.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).