aboutsummaryrefslogtreecommitdiff
path: root/ld/lexsup.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2014-08-08 20:26:41 -0400
committerUlrich Drepper <drepper@gmail.com>2014-08-08 20:26:41 -0400
commit26278bb8717a16139b3a4da9ba1cd2aed435f1ee (patch)
tree8eede31c3d86f0e483c69163df79ea57009c185c /ld/lexsup.c
parent236bbb83885fbdf108e714fb0bcf9355d84dbd20 (diff)
downloadgdb-26278bb8717a16139b3a4da9ba1cd2aed435f1ee.zip
gdb-26278bb8717a16139b3a4da9ba1cd2aed435f1ee.tar.gz
gdb-26278bb8717a16139b3a4da9ba1cd2aed435f1ee.tar.bz2
* ldlang.h (struct lang_input_statement_flags): Add pushed
member. * ldlex.h (enum option_values): Add OPTION_PUSH_STATE and OPTION_POP_STATE. * lexsup.c (ld_options): Add entries for --push-state and --pop-state. (parse_args): Handle OPTION_PUSH_STATE and OPTION_POP_STATE. * ld.texinfo: Document --push-state and --pop-state.
Diffstat (limited to 'ld/lexsup.c')
-rw-r--r--ld/lexsup.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 52b4fdb..3a1ea9e 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -505,6 +505,12 @@ static const struct ld_option ld_options[] =
OPTION_IGNORE_UNRESOLVED_SYMBOL},
'\0', N_("SYMBOL"),
N_("Unresolved SYMBOL will not cause an error or warning"), TWO_DASHES },
+ { {"push-state", no_argument, NULL, OPTION_PUSH_STATE},
+ '\0', NULL, N_("Push state of flags governing input file handling"),
+ TWO_DASHES },
+ { {"pop-state", no_argument, NULL, OPTION_POP_STATE},
+ '\0', NULL, N_("Pop state of flags governing input file handling"),
+ TWO_DASHES },
};
#define OPTION_COUNT ARRAY_SIZE (ld_options)
@@ -1444,6 +1450,23 @@ parse_args (unsigned argc, char **argv)
einfo (_("%P%X: --hash-size needs a numeric argument\n"));
}
break;
+
+ case OPTION_PUSH_STATE:
+ input_flags.pushed = xmemdup (&input_flags,
+ sizeof (input_flags),
+ sizeof (input_flags));
+ break;
+
+ case OPTION_POP_STATE:
+ if (input_flags.pushed == NULL)
+ einfo (_("%P%F: no state pushed before popping\n"));
+ else
+ {
+ struct lang_input_statement_flags *oldp = input_flags.pushed;
+ memcpy (&input_flags, oldp, sizeof (input_flags));
+ free (oldp);
+ }
+ break;
}
}