From: Mark Wielaard <mark@klomp.org>
To: Josh Stone <jistone@redhat.com>
Cc: elfutils-devel@sourceware.org
Subject: Re: [PATCH] strip: Add --keep-section=SECTION and --remove-section=SECTION.
Date: Mon, 17 Jul 2017 11:37:00 -0000 [thread overview]
Message-ID: <1500291465.14595.339.camel@klomp.org> (raw)
In-Reply-To: <2d4f0400-9313-2d17-11d9-d79c8ee9216b@redhat.com>
On Fri, 2017-07-14 at 12:24 -0700, Josh Stone wrote:
> On 07/14/2017 08:28 AM, Mark Wielaard wrote:
> > Adds two new output options:
> >
> > --keep-section=SECTION Keep the named section. SECTION is an extended
> > wildcard pattern. May be given more than once.
>
> I tried this with rust libraries (eu-strip --keep-section=.rustc), and
> it seems to work as desired. Thanks!
Thanks for testing.
Also make distcheck found a memory leak.
We used to only cleanup extra debug section data if there were symbol
table changes (then the original file would get the small/stripped
symbol table, but the debug file would get the full one). But now
another reason might be that we explicitly keep a section in the
original file, but it is also needed by another section that is moved
into the .debug file. For example we keep a string table that is also
needed by a removed symbol table.
So just always cleanup, not just when there were any symbol table
changes:
diff --git a/src/strip.c b/src/strip.c
index 3aad92e..4a35ea1 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -2267,14 +2267,14 @@ while computing checksum for debug information"));
if (shdr_info != NULL)
{
/* For some sections we might have created an table to map symbol
- table indices. */
- if (any_symtab_changes)
- for (cnt = 1; cnt <= shdridx; ++cnt)
- {
- free (shdr_info[cnt].newsymidx);
- if (shdr_info[cnt].debug_data != NULL)
- free (shdr_info[cnt].debug_data->d_buf);
- }
+ table indices. Or we might kept (original) data around to put
+ into the .debug file. */
+ for (cnt = 1; cnt <= shdridx; ++cnt)
+ {
+ free (shdr_info[cnt].newsymidx);
+ if (shdr_info[cnt].debug_data != NULL)
+ free (shdr_info[cnt].debug_data->d_buf);
+ }
/* Free data we allocated for the .gnu_debuglink section. */
free (debuglink_buf);
Added to the patch and pushed to master.
Cheers,
Mark
prev parent reply other threads:[~2017-07-17 11:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-14 15:29 Mark Wielaard
2017-07-14 19:24 ` Josh Stone
2017-07-17 11:37 ` Mark Wielaard [this message]
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=1500291465.14595.339.camel@klomp.org \
--to=mark@klomp.org \
--cc=elfutils-devel@sourceware.org \
--cc=jistone@redhat.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).