X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=ld%2Ftestplug2.c;h=5a210f84685e50203ad4a4a88ddefa8ff634a846;hb=ae2e4d4035f511543d12f74b3b7fdb1ba0daab16;hp=27553d07813b8e291caed595399b155c0e6ba94a;hpb=c02d66610b3b79f6fb5052e8890969bc7185b7be;p=binutils-gdb.git diff --git a/ld/testplug2.c b/ld/testplug2.c index 27553d07813..5a210f84685 100644 --- a/ld/testplug2.c +++ b/ld/testplug2.c @@ -1,6 +1,6 @@ /* Test plugin for the GNU linker. Check non-object IR file as well as get_input_file, get_view and release_input_file interfaces. - Copyright (C) 2015-2020 Free Software Foundation, Inc. + Copyright (C) 2015-2022 Free Software Foundation, Inc. This file is part of the GNU Binutils. @@ -21,6 +21,7 @@ #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. */ @@ -40,7 +41,7 @@ typedef struct claim_file { struct claim_file *next; struct ld_plugin_input_file file; - bfd_boolean claimed; + bool claimed; struct ld_plugin_symbol *symbols; int n_syms_allocated; int n_syms_used; @@ -121,11 +122,11 @@ static enum ld_plugin_status onload_ret = LDPS_OK; static enum ld_plugin_status claim_file_ret = LDPS_OK; static enum ld_plugin_status all_symbols_read_ret = LDPS_OK; static enum ld_plugin_status cleanup_ret = LDPS_OK; -static bfd_boolean register_claimfile_hook = TRUE; -static bfd_boolean register_allsymbolsread_hook = FALSE; -static bfd_boolean register_cleanup_hook = FALSE; -static bfd_boolean dumpresolutions = FALSE; -static bfd_boolean allsymbolsread_silent = FALSE; +static bool register_claimfile_hook = true; +static bool register_allsymbolsread_hook = false; +static bool register_cleanup_hook = false; +static bool dumpresolutions = false; +static bool allsymbolsread_silent = false; /* The master list of all claimable/claimed files. */ static claim_file_t *claimfiles_list = NULL; @@ -305,7 +306,7 @@ set_ret_val (const char *whichval, enum ld_plugin_status retval) /* Records hooks which should be registered. */ static enum ld_plugin_status -set_register_hook (const char *whichhook, bfd_boolean yesno) +set_register_hook (const char *whichhook, bool yesno) { if (!strcmp ("claimfile", whichhook)) register_claimfile_hook = yesno; @@ -314,7 +315,7 @@ set_register_hook (const char *whichhook, bfd_boolean yesno) else if (!strcmp ("allsymbolsreadsilent", whichhook)) { register_allsymbolsread_hook = yesno; - allsymbolsread_silent = TRUE; + allsymbolsread_silent = true; } else if (!strcmp ("cleanup", whichhook)) register_cleanup_hook = yesno; @@ -347,9 +348,9 @@ parse_option (const char *opt) else if (!strncmp ("pass", opt, 4)) return set_ret_val (opt + 4, LDPS_OK); else if (!strncmp ("register", opt, 8)) - return set_register_hook (opt + 8, TRUE); + return set_register_hook (opt + 8, true); else if (!strncmp ("noregister", opt, 10)) - return set_register_hook (opt + 10, FALSE); + return set_register_hook (opt + 10, false); else if (!strncmp ("claim:", opt, 6)) return record_claim_file (opt + 6, 0); else if (!strncmp ("sym:", opt, 4)) @@ -361,7 +362,7 @@ parse_option (const char *opt) else if (!strncmp ("dir:", opt, 4)) return record_add_file (opt + 4, ADD_DIR); else if (!strcmp ("dumpresolutions", opt)) - dumpresolutions = TRUE; + dumpresolutions = true; else return LDPS_ERR; return LDPS_OK; @@ -517,7 +518,7 @@ onclaim_file (const struct ld_plugin_input_file *file, int *claimed) size_t len = strlen (file->name); char *name = xstrdup (file->name); char *p = name + len; - bfd_boolean islib; + bool islib; /* Only match the file name without the directory part. */ islib = *p == 'a' && *(p - 1) == '.'; @@ -546,7 +547,7 @@ onclaim_file (const struct ld_plugin_input_file *file, int *claimed) *claimed = (claimfile != 0); if (claimfile) { - claimfile->claimed = TRUE; + claimfile->claimed = true; claimfile->file = *file; if (claimfile->n_syms_used && !tv_add_symbols) return LDPS_ERR; @@ -669,3 +670,4 @@ oncleanup (void) fflush (NULL); return cleanup_ret; } +#endif /* BFD_SUPPORTS_PLUGINS */