#include "hashtab.h"
#include "filenames.h"
#include "bfdlink.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin.h"
-#endif
#ifndef errno
extern int errno;
long src_count;
if (bfd_get_lto_type (current) == lto_slim_ir_object
-#if BFD_SUPPORTS_PLUGINS
&& !bfd_plugin_target_p (current->xvec)
-#endif
&& report_plugin_err)
{
report_plugin_err = false;
if (bfd_lto_slim_symbol_p (current,
syms[src_count]->name)
-#if BFD_SUPPORTS_PLUGINS
&& !bfd_plugin_target_p (current->xvec)
-#endif
&& report_plugin_err)
{
report_plugin_err = false;
return strncmp (str, prefix, strlen (prefix)) == 0;
}
+/* Return true if plugin is enabled. */
+
+static inline bool
+bfd_plugin_enabled (void)
+{
+ return BFD_SUPPORTS_PLUGINS != 0;
+}
+
return strncmp (str, prefix, strlen (prefix)) == 0;
}
+/* Return true if plugin is enabled. */
+
+static inline bool
+bfd_plugin_enabled (void)
+{
+ return BFD_SUPPORTS_PLUGINS != 0;
+}
+
/* Extracted from libbfd.c. */
void *bfd_alloc (bfd *abfd, bfd_size_type wanted);
#include "safe-ctype.h"
#include "libiberty.h"
#include "objalloc.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin.h"
-#endif
#include <limits.h>
#ifndef CHAR_BIT
get the correct symbol table. */
if (abfd->plugin_format == bfd_plugin_yes
|| abfd->plugin_format == bfd_plugin_yes_unused
-#if BFD_SUPPORTS_PLUGINS
|| (abfd->plugin_format == bfd_plugin_unknown
- && bfd_link_plugin_object_p (abfd))
-#endif
- )
+ && bfd_link_plugin_object_p (abfd)))
{
/* Use the IR symbol table if the object has been claimed by
plugin. */
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin.h"
-#endif
/* IMPORT from targets.c. */
extern const size_t _bfd_target_vector_entries;
/* Set lto_type in ABFD. */
static void
-bfd_set_lto_type (bfd *abfd ATTRIBUTE_UNUSED)
+bfd_set_lto_type (bfd *abfd)
{
-#if BFD_SUPPORTS_PLUGINS
if (abfd->format == bfd_object
&& abfd->lto_type == lto_non_object
&& (abfd->flags
abfd->lto_type = type;
}
-#endif
}
/*
have target_defaulted false. Failing that, bfd_find_target will
have chosen a default target, and target_defaulted will be true. */
fail_targ = NULL;
-#if BFD_SUPPORTS_PLUGINS
- if (abfd->format == bfd_object
+ if (bfd_plugin_enabled ()
+ && abfd->format == bfd_object
&& abfd->target_defaulted
&& !abfd->is_linker_input
&& abfd->plugin_format != bfd_plugin_no)
{
- extern const bfd_target plugin_vec;
-
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
goto err_ret;
- BFD_ASSERT (save_targ != &plugin_vec);
- abfd->xvec = &plugin_vec;
+ BFD_ASSERT (save_targ != bfd_plugin_vec ());
+ abfd->xvec = bfd_plugin_vec ();
bfd_set_error (bfd_error_no_error);
cleanup = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
if (cleanup)
The test can be removed if desired. */
if (!(abfd->plugin_format == bfd_plugin_no
&& bfd_plugin_target_p (save_targ)))
-#endif
{
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
goto err_ret;
bfd_plugin_get_symbols_in_object_only.) */
if (*target == &binary_vec
|| *target == fail_targ
-#if BFD_SUPPORTS_PLUGINS
|| (((abfd->is_linker_input && match_count != 0)
|| abfd->plugin_format == bfd_plugin_no)
- && bfd_plugin_target_p (*target))
-#endif
- )
+ && bfd_plugin_target_p (*target)))
continue;
/* If we already tried a match, the bfd is modified and may
return false;
}
-extern const bfd_target plugin_vec;
-
-/* Return TRUE if TARGET is a pointer to plugin_vec. */
-
-bool
-bfd_plugin_target_p (const bfd_target *target)
-{
- return target == &plugin_vec;
-}
-
/* Register OBJECT_P to be used by bfd_plugin_object_p. */
void
struct ld_plugin_input_file;
+#if BFD_SUPPORTS_PLUGINS
void bfd_plugin_set_program_name (const char *);
int bfd_plugin_open_input (bfd *, struct ld_plugin_input_file *);
void bfd_plugin_set_plugin (const char *);
-bool bfd_plugin_target_p (const bfd_target *);
bool bfd_link_plugin_object_p (bfd *);
void register_ld_plugin_object_p (bfd_cleanup (*object_p) (bfd *, bool));
void bfd_plugin_close_file_descriptor (bfd *, int);
+static inline const bfd_target *
+bfd_plugin_vec (void)
+{
+ extern const bfd_target plugin_vec;
+ return &plugin_vec;
+}
+
+static inline bool
+bfd_plugin_target_p (const bfd_target *target)
+{
+ return target == bfd_plugin_vec ();
+}
+#else
+static inline void
+bfd_plugin_set_program_name (const char *name ATTRIBUTE_UNUSED)
+{
+}
+
+static inline int
+bfd_plugin_open_input (bfd *ibfd ATTRIBUTE_UNUSED,
+ struct ld_plugin_input_file *file ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static inline void
+bfd_plugin_set_plugin (const char *p ATTRIBUTE_UNUSED)
+{
+}
+
+static inline bool
+bfd_link_plugin_object_p (bfd *abfd ATTRIBUTE_UNUSED)
+{
+ return false;
+}
+
+static inline void
+register_ld_plugin_object_p
+ (bfd_cleanup (*object_p) (bfd *, bool) ATTRIBUTE_UNUSED)
+{
+}
+
+static inline void
+bfd_plugin_close_file_descriptor (bfd *abfd ATTRIBUTE_UNUSED,
+ int fd ATTRIBUTE_UNUSED)
+{
+}
+
+static inline const bfd_target *
+bfd_plugin_vec (void)
+{
+ return NULL;
+}
+
+static inline bool
+bfd_plugin_target_p (const bfd_target *target ATTRIBUTE_UNUSED)
+{
+ return false;
+}
+#endif
+
#endif
const void *no_name_def ATTRIBUTE_UNUSED)
{
static int init;
-#if BFD_SUPPORTS_PLUGINS
- static void *handle;
- void *p;
-
- if (!init)
+ if (bfd_plugin_enabled ())
{
- const char *path = getenv (CONFIG_ENV_NAME);
+ static void *handle;
+ void *p;
- init = 1;
- if (!path)
- return no_plugin_def;
- handle = dlopen (path, RTLD_LAZY);
- if (!handle)
+ if (!init)
{
- _bfd_error_handler (_("%s is defined but could not be loaded: %s"),
- CONFIG_ENV_NAME, dlerror ());
- abort ();
+ const char *path = getenv (CONFIG_ENV_NAME);
+
+ init = 1;
+ if (!path)
+ return no_plugin_def;
+ handle = dlopen (path, RTLD_LAZY);
+ if (!handle)
+ {
+ _bfd_error_handler (_("%s is defined but could not be loaded: %s"),
+ CONFIG_ENV_NAME, dlerror ());
+ abort ();
+ }
+ }
+ else if (!handle)
+ {
+ return no_plugin_def;
}
- }
- else if (!handle)
- {
- return no_plugin_def;
- }
- p = dlsym (handle, name);
- if (!p)
- {
- if (no_name_def)
- return no_name_def;
+ p = dlsym (handle, name);
+ if (!p)
+ {
+ if (no_name_def)
+ return no_name_def;
- _bfd_error_handler (_("%s is loaded but symbol \"%s\" is not found: %s"),
- CONFIG_ENV_NAME, name, dlerror ());
- abort ();
+ _bfd_error_handler (_("%s is loaded but symbol \"%s\" is not found: %s"),
+ CONFIG_ENV_NAME, name, dlerror ());
+ abort ();
+ }
+ return p;
}
- return p;
-#else
- if (!init)
+ else if (!init)
{
const char *path = getenv (CONFIG_ENV_NAME);
}
}
return no_plugin_def;
-#endif
}
XTENSA_CONFIG_INSTANCE_LIST;
#include "arsup.h"
#include "filenames.h"
#include "binemul.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin.h"
-#endif
#ifdef __GO32___
#define EXT_NAME_LEN 3 /* Bufflen of addition to name if it's MS-DOS. */
{
FILE *s;
-#if BFD_SUPPORTS_PLUGINS
- /* xgettext:c-format */
- const char *command_line
- = _("Usage: %s [emulation options] [-]{dmpqrstx}[abcDfilMNoOPsSTuvV]"
- " [--plugin <name>] [member-name] [count] archive-file file...\n");
+ const char *command_line;
+ if (bfd_plugin_enabled ())
+ /* xgettext:c-format */
+ command_line
+ = _("Usage: %s [emulation options] [-]{dmpqrstx}[abcDfilMNoOPsSTuvV]"
+ " [--plugin <name>] [member-name] [count] archive-file file...\n");
+ else
+ /* xgettext:c-format */
+ command_line
+ = _("Usage: %s [emulation options] [-]{dmpqrstx}[abcDfilMNoOPsSTuvV]"
+ " [member-name] [count] archive-file file...\n");
-#else
- /* xgettext:c-format */
- const char *command_line
- = _("Usage: %s [emulation options] [-]{dmpqrstx}[abcDfilMNoOPsSTuvV]"
- " [member-name] [count] archive-file file...\n");
-#endif
s = help ? stdout : stderr;
fprintf (s, command_line, program_name);
fprintf (s, _(" --output=DIRNAME - specify the output directory for extraction operations\n"));
fprintf (s, _(" --record-libdeps=<text> - specify the dependencies of this library\n"));
fprintf (s, _(" --thin - make a thin archive\n"));
-#if BFD_SUPPORTS_PLUGINS
- fprintf (s, _(" optional:\n"));
- fprintf (s, _(" --plugin <p> - load the specified plugin\n"));
-#endif
+ if (bfd_plugin_enabled ())
+ {
+ fprintf (s, _(" optional:\n"));
+ fprintf (s, _(" --plugin <p> - load the specified plugin\n"));
+ }
ar_emul_usage (s);
fprintf (s, _(" Generate an index to speed access to archives\n"));
fprintf (s, _(" The options are:\n\
@<file> Read options from <file>\n"));
-#if BFD_SUPPORTS_PLUGINS
- fprintf (s, _("\
+ if (bfd_plugin_enabled ())
+ fprintf (s, _("\
--plugin <name> Load the specified plugin\n"));
-#endif
if (DEFAULT_AR_DETERMINISTIC)
fprintf (s, _("\
-D Use zero for symbol map timestamp (default)\n\
deterministic = false;
break;
case OPTION_PLUGIN:
-#if BFD_SUPPORTS_PLUGINS
+ if (!bfd_plugin_enabled ())
+ fatal (_("sorry - this program has been built without plugin support\n"));
bfd_plugin_set_plugin (optarg);
-#else
- fprintf (stderr, _("sorry - this program has been built without plugin support\n"));
- xexit (1);
-#endif
break;
case OPTION_TARGET:
target = optarg;
/* PR binutils/13493: Support plugins. */
case OPTION_PLUGIN:
-#if BFD_SUPPORTS_PLUGINS
+ if (!bfd_plugin_enabled ())
+ fatal (_("sorry - this program has been built without plugin support\n"));
bfd_plugin_set_plugin (optarg);
-#else
- fprintf (stderr, _("sorry - this program has been built without plugin support\n"));
- xexit (1);
-#endif
break;
}
}
program_name = argv[0];
xmalloc_set_program_name (program_name);
bfd_set_error_program_name (program_name);
-#if BFD_SUPPORTS_PLUGINS
bfd_plugin_set_program_name (program_name);
-#endif
expandargv (&argc, &argv);
#include "bucomm.h"
#include "demanguse.h"
#include "safe-ctype.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin.h"
-#endif
#ifndef streq
#define streq(a,b) (strcmp ((a),(b)) == 0)
-P, --portability Same as --format=posix\n"));
fprintf (stream, _("\
-r, --reverse-sort Reverse the sense of the sort\n"));
-#if BFD_SUPPORTS_PLUGINS
- fprintf (stream, _("\
+ if (bfd_plugin_enabled ())
+ fprintf (stream, _("\
--plugin NAME Load the specified plugin\n"));
-#endif
fprintf (stream, _("\
-S, --print-size Print size of defined symbols\n"));
fprintf (stream, _("\
continue;
if (bfd_lto_slim_symbol_p (abfd, sym->name)
-#if BFD_SUPPORTS_PLUGINS
&& !bfd_plugin_target_p (abfd->xvec)
-#endif
&& report_plugin_err)
{
report_plugin_err = false;
/* lto_type is set to lto_non_ir_object when a bfd is loaded with a
compiler LTO plugin. */
if (bfd_get_lto_type (abfd) == lto_slim_ir_object
-#if BFD_SUPPORTS_PLUGINS
- && !bfd_plugin_target_p (abfd->xvec)
-#endif
- )
+ && !bfd_plugin_target_p (abfd->xvec))
{
report_plugin_err = false;
non_fatal (_("%s: plugin needed to handle lto object"),
program_name = *argv;
xmalloc_set_program_name (program_name);
bfd_set_error_program_name (program_name);
-#if BFD_SUPPORTS_PLUGINS
bfd_plugin_set_program_name (program_name);
-#endif
expandargv (&argc, &argv);
break;
case OPTION_PLUGIN: /* --plugin */
-#if BFD_SUPPORTS_PLUGINS
+ if (!bfd_plugin_enabled ())
+ fatal (_("sorry - this program has been built without plugin support\n"));
bfd_plugin_set_plugin (optarg);
-#else
- fatal (_("sorry - this program has been built without plugin support\n"));
-#endif
break;
case OPTION_IFUNC_CHARS:
#include "coff/internal.h"
#include "libcoff.h"
#include "safe-ctype.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin.h"
-#endif
/* FIXME: See bfd/peXXigen.c for why we include an architecture specific
header in generic PE code. */
--info List object formats & architectures supported\n\
-o <file> Place stripped output into <file>\n\
"));
-#if BFD_SUPPORTS_PLUGINS
- fprintf (stream, _("\
+ if (bfd_plugin_enabled ())
+ fprintf (stream, _("\
--plugin NAME Load the specified plugin\n"));
-#endif
list_supported_targets (program_name, stream);
if (REPORT_BUGS_TO[0] && exit_status == 0)
goto cleanup_and_exit;
}
-#if BFD_SUPPORTS_PLUGINS
/* Copy slim LTO IR file as unknown object. */
if (this_element->lto_type == lto_slim_ir_object)
ok_object = false;
-#endif
if (ok_object)
{
ok = copy_object (this_element, output_element, input_arch,
free (obj_matching);
obj_error = bfd_error_no_error;
}
-#if BFD_SUPPORTS_PLUGINS
- else
+ else if (bfd_plugin_enabled ())
{
/* This is for LLVM bytecode files, which are not ELF objects.
Since objcopy/strip does nothing with these files except
ibfd->plugin_format = bfd_plugin_unknown;
ok_plugin = bfd_check_format (ibfd, bfd_object);
}
-#endif
}
if (obj_error == bfd_error_file_ambiguously_recognized)
return;
}
-#if BFD_SUPPORTS_PLUGINS
/* Copy slim LTO IR file as unknown file. */
if (ibfd->lto_type == lto_slim_ir_object)
ok_object = false;
-#endif
if (ok_object
? !copy_object (ibfd, obfd, input_arch, target_defaulted)
: !copy_unknown_file (ibfd, obfd,
char *output_file = NULL;
bool merge_notes_set = false;
-#if BFD_SUPPORTS_PLUGINS
bfd_plugin_set_program_name (argv[0]);
-#endif
while ((c = getopt_long (argc, argv, "I:O:F:K:MN:R:o:sSpdgxXHhVvwDU",
strip_options, (int *) 0)) != EOF)
keep_section_symbols = true;
break;
case OPTION_PLUGIN: /* --plugin */
-#if BFD_SUPPORTS_PLUGINS
+ if (!bfd_plugin_enabled ())
+ fatal (_("sorry - this program has been built without plugin support\n"));
bfd_plugin_set_plugin (optarg);
-#else
- fatal (_("sorry - this program has been built without plugin support\n"));
-#endif
break;
case 0:
/* We've been given a long option. */
if (output_target == NULL)
output_target = input_target;
-#if BFD_SUPPORTS_PLUGINS
/* Check if all GCC LTO sections should be removed, assuming all LTO
sections will be removed with -R .gnu.lto_.*. Remove .gnu.lto_.*
sections will also remove .gnu.debuglto_.* sections.
debug sections. */
if (!find_section_list (".gnu.lto_.*", false, SECTION_CONTEXT_REMOVE))
find_section_list (".gnu.debuglto_*", true, SECTION_CONTEXT_KEEP);
-#endif
i = optind;
if (i == argc
#include "filenames.h"
#include <fnmatch.h>
#include "same-inode.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin.h"
-#endif /* BFD_SUPPORTS_PLUGINS */
bool ldfile_assumed_script = false;
const char *ldfile_output_machine_name = "";
}
/* PR 30568: Do not track lto generated temporary object files. */
-#if BFD_SUPPORTS_PLUGINS
if (!entry->flags.lto_output)
-#endif
track_dependency_files (attempt);
/* Linker needs to decompress sections. */
/* This is a linker input BFD. */
entry->the_bfd->is_linker_input = 1;
-#if BFD_SUPPORTS_PLUGINS
if (entry->flags.lto_output)
entry->the_bfd->lto_output = 1;
-#endif
/* If we are searching for this file, see if the architecture is
compatible with the output file. If it isn't, keep searching.
}
}
success:
-#if BFD_SUPPORTS_PLUGINS
/* If plugins are active, they get first chance to claim
any successfully-opened input file. We skip archives
here; the plugin wants us to offer it the individual
plugin_maybe_claim (entry);
else
cmdline_check_object_only_section (entry->the_bfd, false);
-#endif /* BFD_SUPPORTS_PLUGINS */
/* It opened OK, the format checked out, and the plugins have had
their chance to claim it, so this is success. */
#include "elf-bfd.h"
#include "bfdver.h"
#include <errno.h>
-#if BFD_SUPPORTS_PLUGINS
#include "plugin.h"
-#endif
#ifndef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) & (((TYPE*) 0)->MEMBER))
OPEN_BFD_FORCE = 1,
OPEN_BFD_RESCAN = 2
};
-#if BFD_SUPPORTS_PLUGINS
static lang_input_statement_type *plugin_insert = NULL;
static struct bfd_link_hash_entry *plugin_undefs = NULL;
-#endif
static void
open_input_bfds (lang_statement_union_type *s,
case lang_group_statement_enum:
{
struct bfd_link_hash_entry *undefs;
-#if BFD_SUPPORTS_PLUGINS
lang_input_statement_type *plugin_insert_save;
-#endif
/* We must continually search the entries in the group
until no new symbols are added to the list of undefined
do
{
-#if BFD_SUPPORTS_PLUGINS
plugin_insert_save = plugin_insert;
-#endif
undefs = link_info.hash->undefs_tail;
open_input_bfds (s->group_statement.children.head, os,
mode | OPEN_BFD_FORCE,
nested_group_count_p);
}
while (undefs != link_info.hash->undefs_tail
-#if BFD_SUPPORTS_PLUGINS
/* Objects inserted by a plugin, which are loaded
before we hit this loop, may have added new
undefs. */
- || (plugin_insert != plugin_insert_save && plugin_undefs)
-#endif
- );
+ || (plugin_insert != plugin_insert_save && plugin_undefs));
--*nested_group_count_p;
}
has been loaded already. Do the same for a rescan.
Likewise reload --as-needed shared libs. */
if (mode != OPEN_BFD_NORMAL
-#if BFD_SUPPORTS_PLUGINS
&& ((mode & OPEN_BFD_RESCAN) == 0
|| plugin_insert == NULL)
-#endif
&& s->input_statement.flags.loaded
&& (abfd = s->input_statement.the_bfd) != NULL
&& ((bfd_get_format (abfd) == bfd_archive
}
}
}
-#if BFD_SUPPORTS_PLUGINS
/* If we have found the point at which a plugin added new
files, clear plugin_insert to enable archive rescan. */
if (&s->input_statement == plugin_insert)
plugin_insert = NULL;
-#endif
break;
case lang_assignment_statement_enum:
if (s->assignment_statement.exp->type.node_class != etree_assert)
file != NULL;
file = file->next)
{
-#if BFD_SUPPORTS_PLUGINS
/* Don't check format of files claimed by plugin. */
if (file->flags.claimed)
continue;
-#endif /* BFD_SUPPORTS_PLUGINS */
input_bfd = file->the_bfd;
compatible
= bfd_arch_get_compatible (input_bfd, link_info.output_bfd,
LANG_FOR_EACH_INPUT_STATEMENT (f)
{
asection *sec;
-#if BFD_SUPPORTS_PLUGINS
if (f->flags.claimed)
continue;
-#endif
for (sec = f->the_bfd->sections; sec != NULL; sec = sec->next)
if ((sec->flags & SEC_DEBUGGING) == 0
|| strcmp (sec->name, ".stabstr") != 0)
}
}
-#if BFD_SUPPORTS_PLUGINS
/* Find the insert point for the plugin's replacement files. We
place them after the first claimed real object file, or if the
first claimed object is an archive member, after the last real
}
return s;
}
-#endif /* BFD_SUPPORTS_PLUGINS */
/* Insert SRCLIST into DESTLIST after given element by chaining
on FIELD as the next-pointer. (Counterintuitively does not need
ldemul_before_plugin_all_symbols_read ();
-#if BFD_SUPPORTS_PLUGINS
if (link_info.lto_plugin_active)
{
lang_statement_list_type added;
}
}
}
- else
-#endif /* BFD_SUPPORTS_PLUGINS */
- if (bfd_link_relocatable (&link_info))
+ else if (bfd_link_relocatable (&link_info))
{
/* Check if .gnu_object_only section should be created. */
bfd *p;
/* Set if reloading an archive or --as-needed lib. */
unsigned int reload : 1;
-#if BFD_SUPPORTS_PLUGINS
/* Set if the file was claimed by a plugin. */
unsigned int claimed : 1;
/* Set if added by the lto plugin add_input_file callback. */
unsigned int lto_output : 1;
-#endif /* BFD_SUPPORTS_PLUGINS */
/* Head of list of pushed flags. */
struct lang_input_statement_flags *pushed;
OPTION_WARN_ALTERNATE_EM,
OPTION_REDUCE_MEMORY_OVERHEADS,
OPTION_MAX_CACHE_SIZE,
-#if BFD_SUPPORTS_PLUGINS
OPTION_PLUGIN,
OPTION_PLUGIN_OPT,
OPTION_PLUGIN_SAVE_TEMPS,
-#endif /* BFD_SUPPORTS_PLUGINS */
OPTION_DEFAULT_SCRIPT,
OPTION_PRINT_OUTPUT_FORMAT,
OPTION_PRINT_SYSROOT,
#include "ldfile.h"
#include "ldemul.h"
#include "ldctor.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin.h"
-#endif /* BFD_SUPPORTS_PLUGINS */
/* Somewhere above, sys/stat.h got included. */
#if !defined(S_ISDIR) && defined(S_IFDIR)
inext = ibfd->link.next;
bfd_close_all_done (ibfd);
}
-#if BFD_SUPPORTS_PLUGINS
/* Note - we do not call ld_plugin_start (PHASE_PLUGINS) here as this
function is only called when the linker is exiting - ie after any
stats may have been reported, and potentially in the middle of a
phase where we have already started recording plugin stats. */
plugin_call_cleanup ();
-#endif
if (output_filename && delete_output_file_on_failure)
unlink_if_ordinary (output_filename);
}
ld_stop_phase (PHASE_PARSE);
-#if BFD_SUPPORTS_PLUGINS
ld_start_phase (PHASE_PLUGINS);
/* Now all the plugin arguments have been gathered, we can load them. */
plugin_load_plugins ();
ld_stop_phase (PHASE_PLUGINS);
-#endif /* BFD_SUPPORTS_PLUGINS */
ld_start_phase (PHASE_PARSE);
(if enabled) may possibly alter it to point to a replacement
BFD, but we still want to output the original BFD filename. */
orig_input = *input;
-#if BFD_SUPPORTS_PLUGINS
/* Don't claim a fat IR object if no IR object should be claimed. */
if (link_info.lto_plugin_active
&& (!no_more_claiming
}
else
cmdline_check_object_only_section (input->the_bfd, false);
-#endif /* BFD_SUPPORTS_PLUGINS */
if (link_info.input_bfds_tail == &input->the_bfd->link.next
|| input->the_bfd->link.next != NULL)
#include "ldver.h"
#include "ldemul.h"
#include "demangle.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin.h"
-#endif /* BFD_SUPPORTS_PLUGINS */
#ifndef PATH_SEPARATOR
#if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN32__))
'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 },
-#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},
{ {"flto-partition=", required_argument, NULL, OPTION_IGNORE},
'\0', NULL, N_("Ignored for GCC LTO option compatibility"),
ONE_DASH },
-#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 },
case OPTION_PRINT_OUTPUT_FORMAT:
command_line.print_output_format = true;
break;
-#if BFD_SUPPORTS_PLUGINS
case OPTION_PLUGIN:
- plugin_opt_plugin (optarg);
+ if (bfd_plugin_enabled ())
+ plugin_opt_plugin (optarg);
break;
case OPTION_PLUGIN_OPT:
- if (plugin_opt_plugin_arg (optarg))
+ if (bfd_plugin_enabled ()
+ && plugin_opt_plugin_arg (optarg))
fatal (_("%P: bad -plugin-opt option\n"));
break;
case OPTION_PLUGIN_SAVE_TEMPS:
config.plugin_save_temps = true;
break;
-#endif /* BFD_SUPPORTS_PLUGINS */
case 'q':
link_info.emitrelocations = true;
break;
int level ATTRIBUTE_UNUSED = strtoul (optarg, &end, 0);
if (*end)
fatal (_("%P: invalid number `%s'\n"), optarg);
-#if BFD_SUPPORTS_PLUGINS
report_plugin_symbols = level > 1;
-#endif /* BFD_SUPPORTS_PLUGINS */
}
break;
case 'v':
for (; len < 30; len++)
putchar (' ');
- printf ("%s\n", _(ld_options[i].doc));
+ printf ("%s", _(ld_options[i].doc));
+ if ((ld_options[i].opt.val == OPTION_PLUGIN
+ || ld_options[i].opt.val == OPTION_PLUGIN_OPT)
+ && !bfd_plugin_enabled ())
+ puts (_(" (ignored)"));
+ else
+ putchar ('\n');
}
}
printf (_(" @FILE"));
#include "sysdep.h"
#include "bfd.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin-api.h"
#include <ctype.h> /* For isspace. */
fflush (NULL);
return LDPS_OK;
}
-#endif /* BFD_SUPPORTS_PLUGINS */
#include "sysdep.h"
#include "libiberty.h"
#include "bfd.h"
-#if BFD_SUPPORTS_PLUGINS
#include "bfdlink.h"
#include "bfdver.h"
#include "ctf-api.h"
abfd, section, value, flags);
return true;
}
-#endif /* BFD_SUPPORTS_PLUGINS */
#include "sysdep.h"
#include "bfd.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin-api.h"
/* For ARRAY_SIZE macro only - we don't link the library itself. */
#include "libiberty.h"
fflush (NULL);
return cleanup_ret;
}
-#endif /* BFD_SUPPORTS_PLUGINS */
#include "sysdep.h"
#include "bfd.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin-api.h"
#include "filenames.h"
/* For ARRAY_SIZE macro only - we don't link the library itself. */
fflush (NULL);
return cleanup_ret;
}
-#endif /* BFD_SUPPORTS_PLUGINS */
#include "sysdep.h"
#include "bfd.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin-api.h"
#include "filenames.h"
/* For ARRAY_SIZE macro only - we don't link the library itself. */
fflush (NULL);
return cleanup_ret;
}
-#endif /* BFD_SUPPORTS_PLUGINS */
#include "sysdep.h"
#include "bfd.h"
-#if BFD_SUPPORTS_PLUGINS
#include "plugin-api.h"
#include "filenames.h"
/* For ARRAY_SIZE macro only - we don't link the library itself. */
fflush (NULL);
return cleanup_ret;
}
-#endif /* BFD_SUPPORTS_PLUGINS */