Add a testcase for PR ld/17973
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 14 Feb 2015 13:45:08 +0000 (05:45 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 14 Feb 2015 14:26:20 +0000 (06:26 -0800)
ld/

PR ld/17973
* testplug2.c (allsymbolsread_silent): New.
(set_register_hook): Handle allsymbolsreadsilent.
(onall_symbols_read): Skip a message if allsymbolsread_silent is
TRUE.

ld/testsuite/

PR ld/17973
* ld-plugin/plugin.exp (regassilent): New.
Compile tmpdir/dummy.s and ld-plugin/pr17973.s.
(plugin_tests): Add a test for PR ld/17973.
* ld-plugin/pr17973.d: New file.
* ld-plugin/pr17973.s: Likewise.

ld/ChangeLog
ld/testplug2.c
ld/testsuite/ChangeLog
ld/testsuite/ld-plugin/plugin.exp
ld/testsuite/ld-plugin/pr17973.d [new file with mode: 0644]
ld/testsuite/ld-plugin/pr17973.s [new file with mode: 0644]

index 4803ec3ba7e64d180efa9b52dc02c20709d246a6..43cf4e8c27565a72a5556126e2be6af8ff362552 100644 (file)
@@ -1,3 +1,11 @@
+2015-02-14  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/17973
+       * testplug2.c (allsymbolsread_silent): New.
+       (set_register_hook): Handle allsymbolsreadsilent.
+       (onall_symbols_read): Skip a message if allsymbolsread_silent is
+       TRUE.
+
 2015-02-14  Alan Modra  <amodra@gmail.com>
 
        PR ld/17973
index 10f0efba6ccca3c91fe47bed1118ccde81626e6d..9b93dd8cae558964eb804873d98ce49246783d74 100644 (file)
@@ -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
@@ -573,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;
index af5b544373a24c011d2ef7ce5b0525d3c8b3f5d4..42ed4921c244927fcb610be26327c98507d6dc20 100644 (file)
@@ -1,3 +1,12 @@
+2015-02-14  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/17973
+       * ld-plugin/plugin.exp (regassilent): New.
+       Compile tmpdir/dummy.s and ld-plugin/pr17973.s.
+       (plugin_tests): Add a test for PR ld/17973.
+       * ld-plugin/pr17973.d: New file.
+       * ld-plugin/pr17973.s: Likewise.
+
 2015-02-12  H.J. Lu  <hongjiu.lu@intel.com>
 
        * ld-i386/i386.exp: Replace elf_i386 with elf_i386_nacl for nacl.
index 35b7bbe5298c8a48e0280ed488d8fc11781b4b03..b6007ebd20ed46ac17c78f48738961ce4372073b 100644 (file)
@@ -66,6 +66,7 @@ verbose "Full plugin3 path $plugin3_path" 2
 
 set regclm "-plugin-opt registerclaimfile"
 set regas "-plugin-opt registerallsymbolsread"
+set regassilent "-plugin-opt registerallsymbolsreadsilent"
 set regcln "-plugin-opt registercleanup"
 
 if { [istarget m681*-*-*] || [istarget m68hc1*-*-*] || [istarget m9s12x*-*-*] } {
@@ -85,7 +86,9 @@ set plugin_nm_output ""
 if { $can_compile && \
        (![ld_compile "$CC $CFLAGS" $srcdir/$subdir/main.c tmpdir/main.o] \
        || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/func.c tmpdir/func.o] \
-       || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/text.c tmpdir/text.o]) } {
+       || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/text.c tmpdir/text.o] \
+       || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/dummy.s tmpdir/dummy.o] \
+       || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/pr17973.s tmpdir/pr17973.o]) } {
     # Defer fail until we have list of tests set.
     set failed_compile 1
 }
@@ -174,6 +177,9 @@ set plugin_tests [list \
     $testobjfiles $libs" "" "" "" {{ld plugin-28.d}} "main.x" ] \
     [list "plugin warning" "-plugin $plugin2_path -plugin-opt warning \
     $testobjfiles $libs" "" "" "" {{ld plugin-29.d}} "main.x" ] \
+    [list "PR ld/17973" "-plugin $plugin2_path -shared $regassilent \
+                       -plugin-opt add:tmpdir/pr17973.o \
+    tmpdir/dummy.o" "" "" "" {{readelf -sW pr17973.d}} "main.x" ] \
 ]
 
 set plugin_lib_tests [list \
diff --git a/ld/testsuite/ld-plugin/pr17973.d b/ld/testsuite/ld-plugin/pr17973.d
new file mode 100644 (file)
index 0000000..85c849a
--- /dev/null
@@ -0,0 +1,4 @@
+#failif
+#...
+.*0+ +FILE +LOCAL +DEFAULT +ABS tmpdir/pr17973.o
+#...
diff --git a/ld/testsuite/ld-plugin/pr17973.s b/ld/testsuite/ld-plugin/pr17973.s
new file mode 100644 (file)
index 0000000..77c5c8a
--- /dev/null
@@ -0,0 +1,3 @@
+       .data
+foo:
+       .dc.a bar
This page took 0.02981 seconds and 4 git commands to generate.