]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - ld/lexsup.c
PR 22843: ld, gold: Add --dependency-file option.
[thirdparty/binutils-gdb.git] / ld / lexsup.c
index 4808f7443d146b5409aa8fb2374f016b7408fef1..48c6eca99fd47e49f9538bdd49bb3ff13e8a4f5b 100644 (file)
@@ -39,9 +39,9 @@
 #include "ldver.h"
 #include "ldemul.h"
 #include "demangle.h"
-#ifdef ENABLE_PLUGINS
+#if BFD_SUPPORTS_PLUGINS
 #include "plugin.h"
-#endif /* ENABLE_PLUGINS */
+#endif /* BFD_SUPPORTS_PLUGINS */
 
 #ifndef PATH_SEPARATOR
 #if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN32__))
@@ -111,6 +111,8 @@ static const struct ld_option ld_options[] =
     'c', N_("FILE"), N_("Read MRI format linker script"), TWO_DASHES },
   { {"dc", no_argument, NULL, 'd'},
     'd', NULL, N_("Force common symbols to be defined"), ONE_DASH },
+  { {"dependency-file", required_argument, NULL, OPTION_DEPENDENCY_FILE},
+    '\0', N_("FILE"), N_("Write dependency file"), TWO_DASHES },
   { {"dp", no_argument, NULL, 'd'},
     '\0', NULL, NULL, ONE_DASH },
   { {"force-group-allocation", no_argument, NULL,
@@ -174,7 +176,7 @@ static const struct ld_option ld_options[] =
     'O', NULL, N_("Optimize output file"), ONE_DASH },
   { {"out-implib", required_argument, NULL, OPTION_OUT_IMPLIB},
     '\0', N_("FILE"), N_("Generate import library"), TWO_DASHES },
-#ifdef ENABLE_PLUGINS
+#if BFD_SUPPORTS_PLUGINS
   { {"plugin", required_argument, NULL, OPTION_PLUGIN},
     '\0', N_("PLUGIN"), N_("Load named plugin"), ONE_DASH },
   { {"plugin-opt", required_argument, NULL, OPTION_PLUGIN_OPT},
@@ -185,7 +187,12 @@ static const struct ld_option ld_options[] =
   { {"flto-partition=", required_argument, NULL, OPTION_IGNORE},
     '\0', NULL, N_("Ignored for GCC LTO option compatibility"),
     ONE_DASH },
-#endif /* ENABLE_PLUGINS */
+#else
+  { {"plugin", required_argument, NULL, OPTION_IGNORE},
+    '\0', N_("PLUGIN"), N_("Load named plugin (ignored)"), ONE_DASH },
+  { {"plugin-opt", required_argument, NULL, OPTION_IGNORE},
+    '\0', N_("ARG"), N_("Send arg to last-loaded plugin (ignored)"), ONE_DASH },
+#endif /* BFD_SUPPORTS_PLUGINS */
   { {"fuse-ld=", required_argument, NULL, OPTION_IGNORE},
     '\0', NULL, N_("Ignored for GCC linker option compatibility"),
     ONE_DASH },
@@ -1061,7 +1068,7 @@ parse_args (unsigned argc, char **argv)
        case OPTION_PRINT_OUTPUT_FORMAT:
          command_line.print_output_format = TRUE;
          break;
-#ifdef ENABLE_PLUGINS
+#if BFD_SUPPORTS_PLUGINS
        case OPTION_PLUGIN:
          plugin_opt_plugin (optarg);
          break;
@@ -1069,7 +1076,7 @@ parse_args (unsigned argc, char **argv)
          if (plugin_opt_plugin_arg (optarg))
            einfo (_("%F%P: bad -plugin-opt option\n"));
          break;
-#endif /* ENABLE_PLUGINS */
+#endif /* BFD_SUPPORTS_PLUGINS */
        case 'q':
          link_info.emitrelocations = TRUE;
          break;
@@ -1363,9 +1370,9 @@ parse_args (unsigned argc, char **argv)
              int level ATTRIBUTE_UNUSED = strtoul (optarg, &end, 0);
              if (*end)
                einfo (_("%F%P: invalid number `%s'\n"), optarg);
-#ifdef ENABLE_PLUGINS
+#if BFD_SUPPORTS_PLUGINS
              report_plugin_symbols = level > 1;
-#endif /* ENABLE_PLUGINS */
+#endif /* BFD_SUPPORTS_PLUGINS */
            }
          break;
        case 'v':
@@ -1436,7 +1443,7 @@ parse_args (unsigned argc, char **argv)
              = lang_new_vers_pattern (NULL, xstrdup (optarg), NULL,
                                       FALSE);
            lang_append_dynamic_list (&export_list, expr);
-          }
+         }
          break;
        case OPTION_EXPORT_DYNAMIC_SYMBOL_LIST:
          /* This option indicates a small script that only specifies
@@ -1626,6 +1633,10 @@ parse_args (unsigned argc, char **argv)
        case OPTION_PRINT_MAP_DISCARDED:
          config.print_map_discarded = TRUE;
          break;
+
+       case OPTION_DEPENDENCY_FILE:
+         config.dependency_file = optarg;
+         break;
        }
     }
 
@@ -1901,14 +1912,14 @@ elf_shlib_list_options (FILE *file)
     }
   fprintf (file, _("\
   -P AUDITLIB, --depaudit=AUDITLIB\n" "\
-                              Specify a library to use for auditing dependencies\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"));
+                              loaded objects\n"));
   fprintf (file, _("\
   -z initfirst                Mark DSO to be initialized first at runtime\n"));
   fprintf (file, _("\
@@ -1931,7 +1942,7 @@ elf_shlib_list_options (FILE *file)
   -z now                      Mark object non-lazy runtime binding\n"));
   fprintf (file, _("\
   -z origin                   Mark object requiring immediate $ORIGIN\n\
-                                processing at runtime\n"));
+                               processing at runtime\n"));
 #if DEFAULT_LD_Z_RELRO
   fprintf (file, _("\
   -z relro                    Create RELRO program header (default)\n"));
@@ -1989,13 +2000,13 @@ elf_static_list_options (FILE *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"));
+                             Compress DWARF debug sections using zlib\n"));
 #ifdef DEFAULT_FLAG_COMPRESS_DEBUG
   fprintf (file, _("\
-                               Default: zlib-gabi\n"));
+                              Default: zlib-gabi\n"));
 #else
   fprintf (file, _("\
-                               Default: none\n"));
+                              Default: none\n"));
 #endif
   fprintf (file, _("\
   -z common-page-size=SIZE    Set common page size to SIZE\n"));
@@ -2020,7 +2031,7 @@ elf_plt_unwind_list_options (FILE *file)
   --ld-generated-unwind-info  Generate exception handling info for PLT\n"));
   fprintf (file, _("\
   --no-ld-generated-unwind-info\n\
-                              Don't generate exception handling info for PLT\n"));
+                             Don't generate exception handling info for PLT\n"));
 }
 
 static void