This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] New option --print-gc-sections
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: binutils at gcc dot gnu dot org, Arnaud Charlet <charlet at adacore dot com>
- Date: Wed, 29 Mar 2006 22:19:50 +0930
- Subject: Re: [PATCH] New option --print-gc-sections
- References: <200603281131.41402.ebotcazou@adacore.com>
On Tue, Mar 28, 2006 at 11:31:41AM +0200, Eric Botcazou wrote:
> We'd like to introduce a --print-gc-sections option
Actually, you can already glean this from a link map. GC'd sections
will be those that are shown with zero size. Perhaps you could instead
enhance ldlang.c:print_input_section a little to flag them as being
discarded, like the following (totally untested) patch.
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.213
diff -u -p -r1.213 ldlang.c
--- ld/ldlang.c 16 Mar 2006 12:20:16 -0000 1.213
+++ ld/ldlang.c 29 Mar 2006 12:47:51 -0000
@@ -3511,7 +3511,7 @@ print_input_section (lang_input_section_
minfo ("0x%V %W %B\n", addr, TO_ADDR (size), i->owner);
- if (size != i->rawsize && i->rawsize != 0)
+ if (size == 0 || (size != i->rawsize && i->rawsize != 0))
{
len = SECTION_NAME_MAP_LENGTH + 3;
#ifdef BFD64
@@ -3525,7 +3525,10 @@ print_input_section (lang_input_section_
--len;
}
- minfo (_("%W (size before relaxing)\n"), i->rawsize);
+ if (size == 0)
+ minfo (_("(discarded)\n"));
+ else
+ minfo (_("%W (size before relaxing)\n"), i->rawsize);
}
if (i->output_section != NULL && (i->flags & SEC_EXCLUDE) == 0)
--
Alan Modra
IBM OzLabs - Linux Technology Centre