This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Use GCC LTO wrapper to get real symbols from LTO IR objects
On Mon, Feb 10, 2020 at 6:31 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Mon, Feb 10, 2020 at 05:22:24PM -0800, H.J. Lu wrote:
> > + if (lto_symbol_found)
> > + {
> > + current_plugin->real_nsyms = real_nsyms;
> > + current_plugin->real_syms = real_syms;
> > + /* NB: We can't close RBFD which own the real symbol info. */
> > + current_plugin->real_bfd = rbfd;
> > + }
> > + else
> > + bfd_close (rbfd);
>
> I think you might want to free real_syms here on else branch. OK with
> that fix.
I am checking in this patch to avoid uninitialized memory.
--
H.J.
From 04fe3341b310980507380118c0eb03537850f738 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 11 Feb 2020 04:09:32 -0800
Subject: [PATCH] Clear plugin_data memory
Clear plugin_data memory since it may be uninitialized.
* plugin.c (add_symbols): Clear plugin_data memory.
---
bfd/plugin.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/bfd/plugin.c b/bfd/plugin.c
index 1edcb57bf3a..5681a6a2913 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -448,6 +448,8 @@ add_symbols (void * handle,
size_t sym_info_size, name_length;
int i;
+ memset (plugin_data, 0, sizeof (*plugin_data));
+
abfd->tdata.plugin_data = plugin_data;
/* NB: LTO symbols are owned by LTO plugin. Create a copy so
--
2.24.1