aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@bitrange.com>2014-10-17 13:06:56 +0200
committerHans-Peter Nilsson <hp@bitrange.com>2014-10-17 13:06:56 +0200
commitcb9322a80e3a92aceb7e325ab34f2a15edbae05a (patch)
tree72e1857a86b7a47fd64b5024347568594417a81c
parent32a8097ba5dd6ddb71c0fb2fccbac262c371846a (diff)
downloadgdb-cb9322a80e3a92aceb7e325ab34f2a15edbae05a.zip
gdb-cb9322a80e3a92aceb7e325ab34f2a15edbae05a.tar.gz
gdb-cb9322a80e3a92aceb7e325ab34f2a15edbae05a.tar.bz2
Implement --print-sysroot in ld.
* ldlex.h (enum option_values): Add entry OPTION_PRINT_SYSROOT. * lexsup.c (ld_options): Add entry for --print-sysroot. (parse_args) <OPTION_PRINT_SYSROOT>: Print sysroot and exit early.
-rw-r--r--ld/ldlex.h1
-rw-r--r--ld/lexsup.c7
2 files changed, 8 insertions, 0 deletions
diff --git a/ld/ldlex.h b/ld/ldlex.h
index 56cd121..e3e9b24 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -136,6 +136,7 @@ enum option_values
#endif /* ENABLE_PLUGINS */
OPTION_DEFAULT_SCRIPT,
OPTION_PRINT_OUTPUT_FORMAT,
+ OPTION_PRINT_SYSROOT,
OPTION_IGNORE_UNRESOLVED_SYMBOL,
OPTION_PUSH_STATE,
OPTION_POP_STATE,
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 3a1ea9e..4812c97 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -379,6 +379,8 @@ static const struct ld_option ld_options[] =
EXACTLY_TWO_DASHES },
{ {"print-output-format", no_argument, NULL, OPTION_PRINT_OUTPUT_FORMAT},
'\0', NULL, N_("Print default output format"), TWO_DASHES },
+ { {"print-sysroot", no_argument, NULL, OPTION_PRINT_SYSROOT},
+ '\0', NULL, N_("Print current sysroot"), TWO_DASHES },
{ {"qmagic", no_argument, NULL, OPTION_IGNORE},
'\0', NULL, N_("Ignored for Linux compatibility"), ONE_DASH },
{ {"reduce-memory-overheads", no_argument, NULL,
@@ -960,6 +962,11 @@ parse_args (unsigned argc, char **argv)
case OPTION_OFORMAT:
lang_add_output_format (optarg, NULL, NULL, 0);
break;
+ case OPTION_PRINT_SYSROOT:
+ if (*ld_sysroot)
+ puts (ld_sysroot);
+ xexit (0);
+ break;
case OPTION_PRINT_OUTPUT_FORMAT:
command_line.print_output_format = TRUE;
break;