X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=ld%2Ftestplug2.c;h=14e14a6c8ac04e34a0fa94e2f99982461fd521b7;hb=831bd6aa3b2d5e36c94b89756f58bb99f35026ca;hp=8cafc5160623f45a4bfc465751e8a09b4d60cbfa;hpb=e3001fd92063282c55ad251d58f112b10a0cf7d6;p=deliverable%2Fbinutils-gdb.git diff --git a/ld/testplug2.c b/ld/testplug2.c index 8cafc51606..14e14a6c8a 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 Free Software Foundation, Inc. + Copyright (C) 2015-2019 Free Software Foundation, Inc. This file is part of the GNU Binutils. @@ -125,6 +125,7 @@ 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; /* The master list of all claimable/claimed files. */ static claim_file_t *claimfiles_list = NULL; @@ -307,6 +308,11 @@ set_register_hook (const char *whichhook, bfd_boolean yesno) register_claimfile_hook = yesno; else if (!strcmp ("allsymbolsread", whichhook)) register_allsymbolsread_hook = yesno; + else if (!strcmp ("allsymbolsreadsilent", whichhook)) + { + register_allsymbolsread_hook = yesno; + allsymbolsread_silent = TRUE; + } else if (!strcmp ("cleanup", whichhook)) register_cleanup_hook = yesno; else @@ -318,7 +324,22 @@ set_register_hook (const char *whichhook, bfd_boolean yesno) static enum ld_plugin_status parse_option (const char *opt) { - if (!strncmp ("fail", opt, 4)) + if (!strncmp ("fatal", opt, 5)) + { + TV_MESSAGE (LDPL_FATAL, "Fatal error"); + fflush (NULL); + } + else if (!strncmp ("error", opt, 5)) + { + TV_MESSAGE (LDPL_ERROR, "Error"); + fflush (NULL); + } + else if (!strncmp ("warning", opt, 7)) + { + TV_MESSAGE (LDPL_WARNING, "Warning"); + fflush (NULL); + } + else if (!strncmp ("fail", opt, 4)) return set_ret_val (opt + 4, LDPS_ERR); else if (!strncmp ("pass", opt, 4)) return set_ret_val (opt + 4, LDPS_OK); @@ -558,7 +579,8 @@ onall_symbols_read (void) char buffer[30]; int fd; char *filename; - TV_MESSAGE (LDPL_INFO, "hook called: all symbols read."); + if (! allsymbolsread_silent) + TV_MESSAGE (LDPL_INFO, "hook called: all symbols read."); for ( ; claimfile; claimfile = claimfile->next) { enum ld_plugin_status rv; @@ -580,7 +602,7 @@ onall_symbols_read (void) #define EXPECTED_VIEW "/* The first line of this file must match the expectation of" #define EXPECTED_VIEW_LENGTH (sizeof (EXPECTED_VIEW) - 1) if (file.filesize != SIZE_OF_FUNC_C - || SIZE_OF_FUNC_C < sizeof EXPECTED_VIEW_LENGTH + || SIZE_OF_FUNC_C < EXPECTED_VIEW_LENGTH || memcmp (view, EXPECTED_VIEW, EXPECTED_VIEW_LENGTH) != 0) { char result[EXPECTED_VIEW_LENGTH + 1];