/* Parse options for the GNU linker.
- Copyright (C) 1991-2014 Free Software Foundation, Inc.
+ Copyright (C) 1991-2015 Free Software Foundation, Inc.
This file is part of the GNU Binutils.
{ {"fuse-ld=", required_argument, NULL, OPTION_IGNORE},
'\0', NULL, N_("Ignored for GCC linker option compatibility"),
ONE_DASH },
+ { {"map-whole-files", optional_argument, NULL, OPTION_IGNORE},
+ '\0', NULL, N_("Ignored for gold option compatibility"),
+ TWO_DASHES },
+ { {"no-map-whole-files", optional_argument, NULL, OPTION_IGNORE},
+ '\0', NULL, N_("Ignored for gold option compatibility"),
+ TWO_DASHES },
{ {"Qy", no_argument, NULL, OPTION_IGNORE},
'\0', NULL, N_("Ignored for SVR4 compatibility"), ONE_DASH },
{ {"emit-relocs", no_argument, NULL, 'q'},
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,
'\0', NULL, N_("Warn if the multiple GP values are used"), TWO_DASHES },
{ {"warn-once", no_argument, NULL, OPTION_WARN_ONCE},
'\0', NULL, N_("Warn only once per undefined symbol"), TWO_DASHES },
+ { {"warn-orphan", no_argument, NULL, OPTION_WARN_ORPHAN},
+ '\0', NULL, N_("Warn if any orphan sections are encountered"), TWO_DASHES },
+ { {"no-warn-orphan", no_argument, NULL, OPTION_NO_WARN_ORPHAN},
+ '\0', NULL, N_("Do not warn if orphan sections are encountered (default)"), TWO_DASHES },
{ {"warn-section-align", no_argument, NULL, OPTION_WARN_SECTION_ALIGN},
'\0', NULL, N_("Warn if start of section changes due to alignment"),
TWO_DASHES },
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)
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;
an error message here. We cannot just make this a warning,
increment optind, and continue because getopt is too confused
and will seg-fault the next time around. */
- einfo(_("%P%F: bad -rpath option\n"));
+ einfo(_("%P%F: unrecognised option: %s\n"), argv[optind]);
link_info.relocatable = TRUE;
config.build_constructors = FALSE;
case OPTION_WARN_ONCE:
config.warn_once = TRUE;
break;
+ case OPTION_WARN_ORPHAN:
+ config.warn_orphan = TRUE;
+ break;
+ case OPTION_NO_WARN_ORPHAN:
+ config.warn_orphan = FALSE;
+ break;
case OPTION_WARN_SECTION_ALIGN:
config.warn_section_align = TRUE;
break;
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;
}
}
lang_section_start (section, exp_intop (val), seg);
}
+static void
+elf_shlib_list_options (FILE *file)
+{
+ fprintf (file, _("\
+ --audit=AUDITLIB Specify a library to use for auditing\n"));
+ fprintf (file, _("\
+ -Bgroup Selects group name lookup rules for DSO\n"));
+ fprintf (file, _("\
+ --disable-new-dtags Disable new dynamic tags\n"));
+ fprintf (file, _("\
+ --enable-new-dtags Enable new dynamic tags\n"));
+ fprintf (file, _("\
+ --eh-frame-hdr Create .eh_frame_hdr section\n"));
+ fprintf (file, _("\
+ --exclude-libs=LIBS Make all symbols in LIBS hidden\n"));
+ fprintf (file, _("\
+ --hash-style=STYLE Set hash style to sysv, gnu or both\n"));
+ fprintf (file, _("\
+ -P AUDITLIB, --depaudit=AUDITLIB\n" "\
+ Specify a library to use for auditing dependencies\n"));
+ fprintf (file, _("\
+ -z combreloc Merge dynamic relocs into one section and sort\n"));
+ fprintf (file, _("\
+ -z nocombreloc Don't merge dynamic relocs into one section\n"));
+ fprintf (file, _("\
+ -z global Make symbols in DSO available for subsequently\n\
+ loaded objects\n"));
+ fprintf (file, _("\
+ -z initfirst Mark DSO to be initialized first at runtime\n"));
+ fprintf (file, _("\
+ -z interpose Mark object to interpose all DSOs but executable\n"));
+ fprintf (file, _("\
+ -z lazy Mark object lazy runtime binding (default)\n"));
+ fprintf (file, _("\
+ -z loadfltr Mark object requiring immediate process\n"));
+ fprintf (file, _("\
+ -z nocopyreloc Don't create copy relocs\n"));
+ fprintf (file, _("\
+ -z nodefaultlib Mark object not to use default search paths\n"));
+ fprintf (file, _("\
+ -z nodelete Mark DSO non-deletable at runtime\n"));
+ fprintf (file, _("\
+ -z nodlopen Mark DSO not available to dlopen\n"));
+ fprintf (file, _("\
+ -z nodump Mark DSO not available to dldump\n"));
+ fprintf (file, _("\
+ -z now Mark object non-lazy runtime binding\n"));
+ fprintf (file, _("\
+ -z origin Mark object requiring immediate $ORIGIN\n\
+ processing at runtime\n"));
+ fprintf (file, _("\
+ -z relro Create RELRO program header\n"));
+ fprintf (file, _("\
+ -z norelro Don't create RELRO program header\n"));
+ fprintf (file, _("\
+ -z stacksize=SIZE Set size of stack segment\n"));
+ fprintf (file, _("\
+ -z text Treat DT_TEXTREL in shared object as error\n"));
+ fprintf (file, _("\
+ -z notext Don't treat DT_TEXTREL in shared object as error\n"));
+ fprintf (file, _("\
+ -z textoff Don't treat DT_TEXTREL in shared object as error\n"));
+}
+
+static void
+elf_static_list_options (FILE *file)
+{
+ fprintf (file, _("\
+ --build-id[=STYLE] Generate build ID note\n"));
+ fprintf (file, _("\
+ --compress-debug-sections=[none|zlib|zlib-gnu|zlib-gabi]\n\
+ Compress DWARF debug sections using zlib\n"));
+ fprintf (file, _("\
+ -z common-page-size=SIZE Set common page size to SIZE\n"));
+ fprintf (file, _("\
+ -z max-page-size=SIZE Set maximum page size to SIZE\n"));
+ fprintf (file, _("\
+ -z defs Report unresolved symbols in object files.\n"));
+ fprintf (file, _("\
+ -z muldefs Allow multiple definitions\n"));
+ fprintf (file, _("\
+ -z execstack Mark executable as requiring executable stack\n"));
+ fprintf (file, _("\
+ -z noexecstack Mark executable as not requiring executable stack\n"));
+}
+
+static void
+elf_plt_unwind_list_options (FILE *file)
+{
+ fprintf (file, _("\
+ --ld-generated-unwind-info Generate exception handling info for PLT\n\
+ --no-ld-generated-unwind-info\n\
+ Don't generate exception handling info for PLT\n"));
+}
+
+static void
+ld_list_options (FILE *file, bfd_boolean elf, bfd_boolean shlib,
+ bfd_boolean plt_unwind)
+{
+ if (!elf)
+ return;
+ printf (_("ELF emulations:\n"));
+ if (plt_unwind)
+ elf_plt_unwind_list_options (file);
+ elf_static_list_options (file);
+ if (shlib)
+ elf_shlib_list_options (file);
+}
+
\f
/* Print help messages for the options. */
/* xgettext:c-format */
printf (_("%s: emulation specific options:\n"), program_name);
+ ld_list_options (stdout, ELF_LIST_OPTIONS, ELF_SHLIB_LIST_OPTIONS,
+ ELF_PLT_UNWIND_LIST_OPTIONS);
ldemul_list_emulation_options (stdout);
printf ("\n");