public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: [PATCH] Update include/plugin-api.h
Date: Fri, 20 Mar 2020 13:03:00 +1030	[thread overview]
Message-ID: <20200320023300.GJ4583@bubble.grove.modra.org> (raw)
In-Reply-To: <CAMe9rOocin7TuBe7DL+8+T6qKJzeKMqxBvmEztq-LDTiGK2vXA@mail.gmail.com>

On Thu, Mar 19, 2020 at 09:09:00AM -0700, H.J. Lu via Binutils wrote:
> On Wed, Mar 18, 2020 at 5:06 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > From: Martin Liska <mliska@suse.cz>
> >
> > 2020-03-12  Martin Liska  <mliska@suse.cz>
> >
> >         PR binutils/25640
> >         * plugin-api.h (struct ld_plugin_symbol): Split
> >         int def into 4 char fields.
> >         (enum ld_plugin_symbol_type): New.
> >         (enum ld_plugin_symbol_section_flags): New.
> >         (enum ld_plugin_tag): Add LDPT_ADD_SYMBOLS_V2 and
> >         LDPT_GET_SYMBOLS_V4.
> 
> I am checking in this patch to sync with GCC.

Silence warnings due to plugin API change.

	* testplug.c (parse_symdefstr): Use %hhi to read sym->def, and
	clear new fields.
	* testplug2.c (parse_symdefstr): Likewise.
	* testplug3.c (parse_symdefstr): Likewise.
	* testplug4.c (parse_symdefstr): Likewise.

diff --git a/ld/testplug.c b/ld/testplug.c
index 9dd0b91e45..c126f03607 100644
--- a/ld/testplug.c
+++ b/ld/testplug.c
@@ -239,12 +239,15 @@ parse_symdefstr (const char *str, struct ld_plugin_symbol *sym)
   /* Finally we'll use sscanf to parse the numeric fields, then
      we'll split out the strings which we need to allocate separate
      storage for anyway so that we can add nul termination.  */
-  n = sscanf (colon2 + 1, "%i:%i:%lli", &sym->def, &sym->visibility, &size);
+  n = sscanf (colon2 + 1, "%hhi:%i:%lli", &sym->def, &sym->visibility, &size);
   if (n != 3)
     return LDPS_ERR;
 
   /* Parsed successfully, so allocate strings and fill out fields.  */
   sym->size = size;
+  sym->unused = 0;
+  sym->section_kind = 0;
+  sym->symbol_type = 0;
   sym->resolution = LDPR_UNKNOWN;
   sym->name = malloc (colon1 - str + 1);
   if (!sym->name)
diff --git a/ld/testplug2.c b/ld/testplug2.c
index ecd9a44d73..27553d0781 100644
--- a/ld/testplug2.c
+++ b/ld/testplug2.c
@@ -218,12 +218,15 @@ parse_symdefstr (const char *str, struct ld_plugin_symbol *sym)
   /* Finally we'll use sscanf to parse the numeric fields, then
      we'll split out the strings which we need to allocate separate
      storage for anyway so that we can add nul termination.  */
-  n = sscanf (colon2 + 1, "%i:%i:%lli", &sym->def, &sym->visibility, &size);
+  n = sscanf (colon2 + 1, "%hhi:%i:%lli", &sym->def, &sym->visibility, &size);
   if (n != 3)
     return LDPS_ERR;
 
   /* Parsed successfully, so allocate strings and fill out fields.  */
   sym->size = size;
+  sym->unused = 0;
+  sym->section_kind = 0;
+  sym->symbol_type = 0;
   sym->resolution = LDPR_UNKNOWN;
   sym->name = malloc (colon1 - str + 1);
   if (!sym->name)
diff --git a/ld/testplug3.c b/ld/testplug3.c
index 05fdca02e2..928f4d6842 100644
--- a/ld/testplug3.c
+++ b/ld/testplug3.c
@@ -217,12 +217,15 @@ parse_symdefstr (const char *str, struct ld_plugin_symbol *sym)
   /* Finally we'll use sscanf to parse the numeric fields, then
      we'll split out the strings which we need to allocate separate
      storage for anyway so that we can add nul termination.  */
-  n = sscanf (colon2 + 1, "%i:%i:%lli", &sym->def, &sym->visibility, &size);
+  n = sscanf (colon2 + 1, "%hhi:%i:%lli", &sym->def, &sym->visibility, &size);
   if (n != 3)
     return LDPS_ERR;
 
   /* Parsed successfully, so allocate strings and fill out fields.  */
   sym->size = size;
+  sym->unused = 0;
+  sym->section_kind = 0;
+  sym->symbol_type = 0;
   sym->resolution = LDPR_UNKNOWN;
   sym->name = malloc (colon1 - str + 1);
   if (!sym->name)
diff --git a/ld/testplug4.c b/ld/testplug4.c
index adaedf47c3..ca899b11da 100644
--- a/ld/testplug4.c
+++ b/ld/testplug4.c
@@ -218,12 +218,15 @@ parse_symdefstr (const char *str, struct ld_plugin_symbol *sym)
   /* Finally we'll use sscanf to parse the numeric fields, then
      we'll split out the strings which we need to allocate separate
      storage for anyway so that we can add nul termination.  */
-  n = sscanf (colon2 + 1, "%i:%i:%lli", &sym->def, &sym->visibility, &size);
+  n = sscanf (colon2 + 1, "%hhi:%i:%lli", &sym->def, &sym->visibility, &size);
   if (n != 3)
     return LDPS_ERR;
 
   /* Parsed successfully, so allocate strings and fill out fields.  */
   sym->size = size;
+  sym->unused = 0;
+  sym->section_kind = 0;
+  sym->symbol_type = 0;
   sym->resolution = LDPR_UNKNOWN;
   sym->name = malloc (colon1 - str + 1);
   if (!sym->name)



-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2020-03-20  2:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18 12:06 RFC [PATCH 0/2] Use ld_plugin_symbol_type and ld_plugin_symbol_section_flags H.J. Lu
2020-03-18 12:06 ` RFC [PATCH 1/2] Update include/plugin-api.h H.J. Lu
2020-03-19 16:09   ` [PATCH] " H.J. Lu
2020-03-20  2:33     ` Alan Modra [this message]
2020-03-18 12:06 ` RFC [PATCH 2/2] Use ld_plugin_symbol_type and ld_plugin_symbol_section_flags H.J. Lu

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=20200320023300.GJ4583@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.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).