This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
start-group/end-group nesting
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sourceware dot org
- Date: Mon, 30 Nov 2009 10:58:32 +1030
- Subject: start-group/end-group nesting
This patch allows nesting of --start-group/--end-group so that a
simple wrapper script can provide the non-standard library search
behaviour requested. Made possible by my 2009-02-16 changes.
PR ld/11006
* lexsup.c (parse_args): Allow nested --start-group, --end-group.
Index: ld/lexsup.c
===================================================================
RCS file: /cvs/src/src/ld/lexsup.c,v
retrieving revision 1.117
diff -u -p -r1.117 lexsup.c
--- ld/lexsup.c 26 Nov 2009 13:45:25 -0000 1.117
+++ ld/lexsup.c 29 Nov 2009 23:01:37 -0000
@@ -1459,18 +1459,15 @@ parse_args (unsigned argc, char **argv)
command_line.accept_unknown_input_arch = FALSE;
break;
case '(':
- if (ingroup)
- einfo (_("%P%F: may not nest groups (--help for usage)\n"));
-
lang_enter_group ();
- ingroup = 1;
+ ingroup++;
break;
case ')':
if (! ingroup)
einfo (_("%P%F: group ended before it began (--help for usage)\n"));
lang_leave_group ();
- ingroup = 0;
+ ingroup--;
break;
case OPTION_INIT:
@@ -1501,8 +1498,11 @@ parse_args (unsigned argc, char **argv)
}
}
- if (ingroup)
- lang_leave_group ();
+ while (ingroup)
+ {
+ lang_leave_group ();
+ ingroup--;
+ }
if (default_dirlist != NULL)
{
--
Alan Modra
Australia Development Lab, IBM