[PATCH] New option --print-gc-sections
Alan Modra
amodra@bigpond.net.au
Wed Mar 29 14:31:00 GMT 2006
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
More information about the Binutils
mailing list