aboutsummaryrefslogtreecommitdiff
path: root/ld/testplug2.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-02-11 12:16:07 -0800
committerH.J. Lu <hjl.tools@gmail.com>2015-02-11 14:00:51 -0800
commit45e813544eb076dd52fefe7b36e28b088963207d (patch)
treea3954237e7a9dfcf3c529a82eb3007328868fb89 /ld/testplug2.c
parente3001fd92063282c55ad251d58f112b10a0cf7d6 (diff)
downloadgdb-45e813544eb076dd52fefe7b36e28b088963207d.zip
gdb-45e813544eb076dd52fefe7b36e28b088963207d.tar.gz
gdb-45e813544eb076dd52fefe7b36e28b088963207d.tar.bz2
Output "warning:" or "error:" in plugin messages
When plugin generates LDPL_WARNING, LDPL_FATAL and LDPL_ERROR messages, linker should display "warning:" or "error:" in plugin messages like regular linker messages. ld/ * plugin.c (message): Output "warning:" for LDPL_WARNING. Output "error:" for LDPL_FATAL and LDPL_ERROR. * testplug2.c (parse_option): Handle fatal, error and warning. ld/testsuite/ * ld-plugin/plugin-27.d: New. * ld-plugin/plugin-28.d: Likewise. * ld-plugin/plugin-29.d: Likewise. * plugin.exp (plugin_tests): Add tests for LDPL_FATAL, LDPL_ERROR and LDPL_WARNING.
Diffstat (limited to 'ld/testplug2.c')
-rw-r--r--ld/testplug2.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/ld/testplug2.c b/ld/testplug2.c
index 8cafc51..10f0efb 100644
--- a/ld/testplug2.c
+++ b/ld/testplug2.c
@@ -318,7 +318,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);