]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Prune BFD warnings for unknown GNU properties
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 23 Aug 2018 13:12:37 +0000 (06:12 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 23 Aug 2018 13:12:50 +0000 (06:12 -0700)
When glibc is enabled with the new GNU_PROPERTY_X86_XXX bits:

https://groups.google.com/forum/#!topic/x86-64-abi/-D05GQ3kWrA

BFD will issue an unknown GNU property warning like

warning: tmpdir/ld1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001

and ignore such GNU properties.  This patch adds prune_warnings_extra to
prune such warnings on release branches and updates prune_warnings to
call prune_warnings_extra.

binutils/

PR ld/23536
* Makefile.am (development.exp): New target.
(EXTRA_DEJAGNU_SITE_CONFIG): New.
(DISTCLEANFILES): Add development.exp.
* Makefile.in: Regenerated.
* testsuite/binutils-all/objcopy.exp (strip_test): Call
prune_warnings to prune BFD output.
(strip_test_with_saving_a_symbol): Likewise.
(objcopy_test_without_global_symbol): Likewise.
* testsuite/lib/binutils-common.exp (prune_warnings_extra):
New proc.
(prune_warnings): Likewise.

gas/

PR ld/23536
* Makefile.am (development.exp): New target.
(EXTRA_DEJAGNU_SITE_CONFIG): New.
(DISTCLEANFILES): Add development.exp.
* Makefile.in: Regenerated.

ld/

PR ld/23536
* Makefile.am (development.exp): New target.
(EXTRA_DEJAGNU_SITE_CONFIG): New.
(DISTCLEANFILES): Add development.exp.
* Makefile.in: Regenerated.
* testsuite/ld-bootstrap/bootstrap.exp: Call prune_warnings to
prune BFD output.
* testsuite/ld-plugin/lto.exp: Likewise.
* testsuite/lib/ld-lib.exp (prune_warnings): Removed.
* testsuite/ld-elf/shared.exp: Allow "\n" in linker warnings.

15 files changed:
binutils/ChangeLog
binutils/Makefile.am
binutils/Makefile.in
binutils/testsuite/binutils-all/objcopy.exp
binutils/testsuite/lib/binutils-common.exp
gas/ChangeLog
gas/Makefile.am
gas/Makefile.in
ld/ChangeLog
ld/Makefile.am
ld/Makefile.in
ld/testsuite/ld-bootstrap/bootstrap.exp
ld/testsuite/ld-elf/shared.exp
ld/testsuite/ld-plugin/lto.exp
ld/testsuite/lib/ld-lib.exp

index 09f599bcee4e0d26aedd7343c80fe2b66773dd5b..600f326769c7df12b8a69db1f5295695a2626554 100644 (file)
@@ -1,3 +1,18 @@
+2018-08-23  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/23536
+       * Makefile.am (development.exp): New target.
+       (EXTRA_DEJAGNU_SITE_CONFIG): New.
+       (DISTCLEANFILES): Add development.exp.
+       * Makefile.in: Regenerated.
+       * testsuite/binutils-all/objcopy.exp (strip_test): Call
+       prune_warnings to prune BFD output.
+       (strip_test_with_saving_a_symbol): Likewise.
+       (objcopy_test_without_global_symbol): Likewise.
+       * testsuite/lib/binutils-common.exp (prune_warnings_extra):
+       New proc.
+       (prune_warnings): Likewise.
+
 2018-08-23  H.J. Lu  <hongjiu.lu@intel.com>
 
        * README-how-to-make-a-release: Document setting "experimental"
index d827d9ecfbf896fe0f38c70efd7604a3ccc3676d..e68e1cd2defbce5070576017ebe0f48c59f625cc 100644 (file)
@@ -200,6 +200,10 @@ check-DEJAGNU: site.exp
        else echo "WARNING: could not find \`runtest'" 1>&2; :;\
        fi
 
+development.exp: $(BFDDIR)/development.sh
+       $(EGREP) "[development|experimental]=" $(BFDDIR)/development.sh  \
+         | $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@
+
 installcheck-local:
        /bin/sh $(srcdir)/sanity.sh $(bindir)
 
@@ -491,7 +495,10 @@ all: info
 # development.sh is used to determine -Werror default.
 CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/development.sh
 
-DISTCLEANFILES = sysroff.c sysroff.h site.exp site.bak embedspu
+EXTRA_DEJAGNU_SITE_CONFIG = development.exp
+
+DISTCLEANFILES = sysroff.c sysroff.h site.exp development.exp \
+  site.bak embedspu
 
 MOSTLYCLEANFILES = sysinfo$(EXEEXT_FOR_BUILD) bin2c$(EXEEXT_FOR_BUILD) \
   binutils.log binutils.sum abcdefgh*
index bdf09551dad6e7a98ed752f84d5ecc2077a28aa0..7ab72b3ae42f13412b7d67ae12f3a9ead1e79b6e 100644 (file)
@@ -737,7 +737,10 @@ EXTRA_DIST = arparse.c arparse.h arlex.c sysinfo.c sysinfo.h \
 
 # development.sh is used to determine -Werror default.
 CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/development.sh
-DISTCLEANFILES = sysroff.c sysroff.h site.exp site.bak embedspu
+EXTRA_DEJAGNU_SITE_CONFIG = development.exp
+DISTCLEANFILES = sysroff.c sysroff.h site.exp development.exp \
+  site.bak embedspu
+
 MOSTLYCLEANFILES = sysinfo$(EXEEXT_FOR_BUILD) bin2c$(EXEEXT_FOR_BUILD) \
   binutils.log binutils.sum abcdefgh*
 
@@ -1399,6 +1402,10 @@ check-DEJAGNU: site.exp
        else echo "WARNING: could not find \`runtest'" 1>&2; :;\
        fi
 
+development.exp: $(BFDDIR)/development.sh
+       $(EGREP) "[development|experimental]=" $(BFDDIR)/development.sh  \
+         | $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@
+
 installcheck-local:
        /bin/sh $(srcdir)/sanity.sh $(bindir)
 
index 342585f36280df34bbba87f91135db011ae990b0..d979648758cda6b937982a1d36d1541a5544d435 100644 (file)
@@ -440,6 +440,7 @@ proc strip_test { } {
     remote_file build delete tmpdir/libstrip.a
 
     set exec_output [binutils_run $AR "rc $archive ${objfile}"]
+    set exec_output [prune_warnings $exec_output]
     if ![string equal "" $exec_output] {
        fail $test
        unresolved "$test preserving OS/ABI"
@@ -447,6 +448,7 @@ proc strip_test { } {
     }
 
     set exec_output [binutils_run $STRIP "-g $archive"]
+    set exec_output [prune_warnings $exec_output]
     if ![string equal "" $exec_output] {
        fail $test
        unresolved "$test preserving OS/ABI"
@@ -454,6 +456,7 @@ proc strip_test { } {
     }
 
     set exec_output [binutils_run $STRIP "$STRIPFLAGS $archive"]
+    set exec_output [prune_warnings $exec_output]
     if ![string equal "" $exec_output] {
        fail $test
        unresolved "$test preserving OS/ABI"
@@ -488,12 +491,14 @@ proc strip_test { } {
     }
 
     set exec_output [binutils_run $STRIP "$STRIPFLAGS $objfile"]
+    set exec_output [prune_warnings $exec_output]
     if ![string equal "" $exec_output] {
        fail $test
        return
     }
 
     set exec_output [binutils_run $NM "-a $NMFLAGS $objfile"]
+    set exec_output [prune_warnings $exec_output]
     if ![string match "*: no symbols*" $exec_output] {
        fail $test
        return
@@ -529,12 +534,14 @@ proc strip_test_with_saving_a_symbol { } {
     }
 
     set exec_output [binutils_run $STRIP "$STRIPFLAGS -K main -K _main $objfile"]
+    set exec_output [prune_warnings $exec_output]
     if ![string equal "" $exec_output] {
        fail $test
        return
     }
 
     set exec_output [binutils_run $NM "$NMFLAGS $objfile"]
+    set exec_output [prune_warnings $exec_output]
     if {![regexp {^([0-9a-fA-F]+)?[ ]+[TD] main} $exec_output] \
          && ![regexp {^([0-9a-fA-F]+)?[ ]+T _main} $exec_output]} {
        fail $test
@@ -1195,12 +1202,14 @@ proc objcopy_test_without_global_symbol { } {
     }
 
     set exec_output [binutils_run $OBJCOPY "$OBJCOPYFLAGS --strip-unneeded $objfile"]
+    set exec_output [prune_warnings $exec_output]
     if ![string equal "" $exec_output] {
        fail $test
        return
     }
 
     set exec_output [binutils_run $OBJDUMP "$OBJDUMPFLAGS -t $objfile"]
+    set exec_output [prune_warnings $exec_output]
     if {![regexp "no symbols" $exec_output]} {
        fail $test
        return
index b1ede4cdf60607c09b62862e0e280565023a5acc..bac140774b02cf86189280f03d4ea936e55b0dbf 100644 (file)
@@ -397,3 +397,50 @@ proc regexp_diff { file_1 file_2 args } {
 
     return $differences
 }
+
+# prune_warnings_extra -- delete extra warnings from TEXT.
+#
+# An example is:
+# ld: warning: /lib64/ld-linux-x86-64.so.2: unsupported GNU_PROPERTY_TYPE (5) type : 0xc0010001
+proc prune_warnings_extra { text } {
+    global experimental
+    # Warnings are only pruned from non-experimental code (ie code not
+    # on a release branch).  For experimental code we want the warnings
+    # as they indicate that the sources need to be updated to recognise
+    # the new properties.
+    if { "$experimental" == "false" } {
+       # The "\\1" is to try to preserve a "\n" but only if necessary.
+       regsub -all "(^|\n)(\[^\n\]*: warning:\[^\n\]*unsupported GNU_PROPERTY_TYPE\[^\n\]*\n?)+" $text "\\1" text
+    }
+    return $text
+}
+
+# This definition is taken from an unreleased version of DejaGnu.  Once
+# that version gets released, and has been out in the world for a few
+# months at least, it may be safe to delete this copy.
+if ![string length [info proc prune_warnings]] {
+    #
+    # prune_warnings -- delete various system verbosities from TEXT
+    #
+    # An example is:
+    # ld.so: warning: /usr/lib/libc.so.1.8.1 has older revision than expected 9
+    #
+    # Sites with particular verbose os's may wish to override this in site.exp.
+    #
+    proc prune_warnings { text } {
+       # This is from sun4's.  Do it for all machines for now.
+       # The "\\1" is to try to preserve a "\n" but only if necessary.
+       regsub -all "(^|\n)(ld.so: warning:\[^\n\]*\n?)+" $text "\\1" text
+       # It might be tempting to get carried away and delete blank lines, etc.
+       # Just delete *exactly* what we're ask to, and that's it.
+       set text [prune_warnings_extra $text]
+       return $text
+    }
+} elseif { [info procs saved-prune_warnings] == [list] } {
+    rename prune_warnings saved-prune_warnings
+    proc prune_warnings { text } {
+       set text [saved-prune_warnings $text]
+       set text [prune_warnings_extra $text]
+       return $text
+    }
+}
index f86ab289f494b950c8d940356a962d4cc0d4c86f..a9325fb814cd4d1900a23162bf599a5e17971d40 100644 (file)
@@ -1,3 +1,11 @@
+2018-08-23  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/23536
+       * Makefile.am (development.exp): New target.
+       (EXTRA_DEJAGNU_SITE_CONFIG): New.
+       (DISTCLEANFILES): Add development.exp.
+       * Makefile.in: Regenerated.
+
 2018-08-22  Alan Modra  <amodra@gmail.com>
 
        * dw2gencfi.c (emit_expr_encoded, output_fde): Warning fixes.
index 8f520d3cce6968d02ec7789e29d8d30939ea5fef..9b3d32f56db5d36f1410be0f14cacb5a6a09ceb6 100644 (file)
@@ -432,6 +432,10 @@ check-DEJAGNU: site.exp
        else echo "WARNING: could not find \`runtest'" 1>&2; :;\
        fi
 
+development.exp: $(BFDDIR)/development.sh
+       $(EGREP) "[development|experimental]=" $(BFDDIR)/development.sh  \
+         | $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@
+
 # The m68k operand parser.
 
 EXTRA_as_new_SOURCES += config/m68k-parse.y
@@ -591,7 +595,7 @@ cgen.@OBJEXT@: cgen.c cgen.h cgen-desc.h subsegs.h \
 
 MOSTLYCLEANFILES = $(STAGESTUFF) core \
        testsuite/*.@OBJEXT@ testsuite/*.out testsuite/gas.log testsuite/gas.sum \
-       testsuite/site.exp site.bak site.exp stage stage1 stage2
+       testsuite/site.exp site.bak site.exp development.exp stage stage1 stage2
 
 .PHONY: install-exec-local install-data-local
 .PHONY: install-exec-bindir install-exec-tooldir
@@ -692,3 +696,5 @@ de-stage3:
 # Reconfigure if configure.tgt changes.
 # development.sh is used to determine -Werror default.
 CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.tgt $(BFDDIR)/development.sh
+
+EXTRA_DEJAGNU_SITE_CONFIG = development.exp
index 862f9488ca1b2a865ded83a22f4c1b19cfef7146..07bb7f054bc8a3247bbd570f7c0e1f2ceac17208 100644 (file)
@@ -803,13 +803,14 @@ CGEN_CPU_PREFIX = @cgen_cpu_prefix@
 # Remake the info files.
 MOSTLYCLEANFILES = $(STAGESTUFF) core \
        testsuite/*.@OBJEXT@ testsuite/*.out testsuite/gas.log testsuite/gas.sum \
-       testsuite/site.exp site.bak site.exp stage stage1 stage2
+       testsuite/site.exp site.bak site.exp development.exp stage stage1 stage2
 
 against = stage2
 
 # Reconfigure if configure.tgt changes.
 # development.sh is used to determine -Werror default.
 CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.tgt $(BFDDIR)/development.sh
+EXTRA_DEJAGNU_SITE_CONFIG = development.exp
 all: config.h
        $(MAKE) $(AM_MAKEFLAGS) all-recursive
 
@@ -1563,6 +1564,10 @@ check-DEJAGNU: site.exp
        else echo "WARNING: could not find \`runtest'" 1>&2; :;\
        fi
 
+development.exp: $(BFDDIR)/development.sh
+       $(EGREP) "[development|experimental]=" $(BFDDIR)/development.sh  \
+         | $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@
+
 # If m68k-parse.y is in a different directory, then ylwrap will use an
 # absolute path when it invokes yacc, which will cause yacc to put the
 # absolute path into the generated file.  That's a pain when it comes
index 39f76aa3a11771e80f2a5ced8cb7dd49e3cdaccb..66f890cbd0c9ff2e920fd8624e606da1f8914dd9 100644 (file)
@@ -1,3 +1,16 @@
+2018-08-23  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/23536
+       * Makefile.am (development.exp): New target.
+       (EXTRA_DEJAGNU_SITE_CONFIG): New.
+       (DISTCLEANFILES): Add development.exp.
+       * Makefile.in: Regenerated.
+       * testsuite/ld-bootstrap/bootstrap.exp: Call prune_warnings to
+       prune BFD output.
+       * testsuite/ld-plugin/lto.exp: Likewise.
+       * testsuite/lib/ld-lib.exp (prune_warnings): Removed.
+       * testsuite/ld-elf/shared.exp: Allow "\n" in linker warnings.
+
 2018-08-21  Nick Clifton  <nickc@redhat.com>
 
        PR 23426
index 7ae1c53353af57b7dc5a304c95ac5796744bdf18..9884110d26e8ec8550747e4e97db7b5fd295e4b4 100644 (file)
@@ -1905,6 +1905,10 @@ check-DEJAGNU: site.exp
        else echo "WARNING: could not find \`runtest'" 1>&2; :;\
        fi
 
+development.exp: $(BFDDIR)/development.sh
+       $(EGREP) "[development|experimental]=" $(BFDDIR)/development.sh  \
+         | $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@
+#
 #
 # Build a dummy plugin using libtool.
 #
@@ -1952,6 +1956,8 @@ MAINTAINERCLEANFILES = configdoc.texi ld.1
 CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.host $(srcdir)/configure.tgt \
        $(BFDDIR)/development.sh
 
+EXTRA_DEJAGNU_SITE_CONFIG = development.exp
+
 MOSTLYCLEANFILES = $(STAGESTUFF) ld1$(EXEEXT) ld2$(EXEEXT) ld3$(EXEEXT) \
        ldemul-list.h crtbegin.@OBJEXT@ crtend.@OBJEXT@ ld.log ld.sum
 mostlyclean-local:
@@ -1997,7 +2003,7 @@ diststuff: info $(EXTRA_DIST)
 # ld.1 to support parallel build.
 info-recursive: ld.1
 
-DISTCLEANFILES = tdirs site.exp site.bak stringify.sed
+DISTCLEANFILES = tdirs site.exp development.exp site.bak stringify.sed
 distclean-local:
        rm -rf ldscripts
 
index bfb5599921b6aef889970e8cefd7fcee72415d98..3ddd581e6d553682fe63db810422058548d89084 100644 (file)
@@ -1008,7 +1008,7 @@ ld_new_DEPENDENCIES = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) \
                      $(BFDLIB) $(LIBIBERTY) $(LIBINTL_DEP)
 
 ld_new_LDADD = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBIBERTY) $(LIBINTL)
-
+#
 #
 # Build a dummy plugin using libtool.
 #
@@ -1034,6 +1034,7 @@ MAINTAINERCLEANFILES = configdoc.texi ld.1 ld.info
 CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.host $(srcdir)/configure.tgt \
        $(BFDDIR)/development.sh
 
+EXTRA_DEJAGNU_SITE_CONFIG = development.exp
 MOSTLYCLEANFILES = $(STAGESTUFF) ld1$(EXEEXT) ld2$(EXEEXT) ld3$(EXEEXT) \
        ldemul-list.h crtbegin.@OBJEXT@ crtend.@OBJEXT@ ld.log ld.sum
 
@@ -1044,7 +1045,7 @@ CLEANFILES = dep.sed DEP DEPA DEP1 DEP2 spu_ovl.s spu_ovl.@OBJEXT@ spu_icache.s
 EXTRA_DIST = ldgram.c ldgram.h ldlex.c emultempl/spu_ovl.@OBJEXT@_c \
             emultempl/spu_icache.@OBJEXT@_c deffilep.c deffilep.h $(man_MANS)
 
-DISTCLEANFILES = tdirs site.exp site.bak stringify.sed
+DISTCLEANFILES = tdirs site.exp development.exp site.bak stringify.sed
 all: $(BUILT_SOURCES) config.h
        $(MAKE) $(AM_MAKEFLAGS) all-recursive
 
@@ -3489,6 +3490,10 @@ check-DEJAGNU: site.exp
        else echo "WARNING: could not find \`runtest'" 1>&2; :;\
        fi
 
+development.exp: $(BFDDIR)/development.sh
+       $(EGREP) "[development|experimental]=" $(BFDDIR)/development.sh  \
+         | $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@
+
 # DOCUMENTATION TARGETS
 # Manual configuration file; not usually attached to normal configuration,
 # because almost all configs use "gen" version of manual.
index 5c79e0315ca03fde9fd85c81865b40048e90e071..9c4dbd6ce9ec7095a3d842c987891bfe1a17812a 100644 (file)
@@ -168,6 +168,7 @@ foreach flags $test_flags {
     if {"$do_strip" == "yes"} { 
        verbose -log "$strip tmpdir/ld1"     
        catch "exec $strip tmpdir/ld1" exec_output
+       set exec_output [prune_warnings $exec_output]
        if ![string match "" $exec_output] then {
            verbose -log "$exec_output"
            fail $testname
index 7970fe99ef0458eaa85ebe85938487770d5cba5e..cdb171d0d1b6ca8a070579b7541817d0c067ff3a 100644 (file)
@@ -513,7 +513,7 @@ set build_tests {
    "-shared" "-fPIC"
   {beginwarn.c end.c}
   {{readelf {-S --wide} libbarw.rd}
-   {warning "^.*beginwarn.c:7: warning: function foo is deprecated$"}}
+   {warning "^.*beginwarn.c:7: warning: function foo is deprecated\n?$"}}
   "libbarw.so" "c"}
   {"Build hidden libbar.so"
    "-shared" "-fPIC"
@@ -792,7 +792,7 @@ set run_tests [list \
     [list "Run warn with versioned libfoo.so" \
      "-Wl,--no-as-needed tmpdir/beginwarn.o tmpdir/libfoov.so" "" \
      {main.c} "warn" "warn.out" \
-     "" "c" {^.*beginwarn.c:7: warning: function foo is deprecated$} ] \
+     "" "c" {^.*beginwarn.c:7: warning: function foo is deprecated\n?$} ] \
     [list "Run protected with versioned libfoo.so" \
      "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoov.so tmpdir/endprotected.o" "" \
      {main.c} "protected" "normal.out" ] \
index 5c581e498ae0ee19786df95b07e2ae630abdb285..18829fdd64a5ea8f4cb4305488ca826dad5ad7b4 100644 (file)
@@ -515,6 +515,7 @@ if { [at_least_gcc_version 4 7] } {
           || [istarget "amd64-*-linux*"]) } {
        set testname "PR ld/12365"
        set exec_output [run_host_cmd "$CC" "-O2 -flto -flto-partition=none -fuse-linker-plugin -o tmpdir/pr12365 tmpdir/pr12365a.o tmpdir/pr12365b.o tmpdir/pr12365c.o"]
+       set exec_output [prune_warnings $exec_output]
        if { [ regexp "undefined reference to `my_bcopy'" $exec_output ] } {
            # Linker should catch the reference to undefined `my_bcopy'
            # error caused by a GCC bug.
index 2e7d368ce905f5a3ebf68e282e2bad9e9a4d4ec0..1833bdd2f039b467a5a2f0701f4201a589db7e0e 100644 (file)
@@ -1417,29 +1417,6 @@ proc run_ld_link_tests { ldtests args } {
     }
 }
 
-# This definition is taken from an unreleased version of DejaGnu.  Once
-# that version gets released, and has been out in the world for a few
-# months at least, it may be safe to delete this copy.
-if ![string length [info proc prune_warnings]] {
-    #
-    # prune_warnings -- delete various system verbosities from TEXT
-    #
-    # An example is:
-    # ld.so: warning: /usr/lib/libc.so.1.8.1 has older revision than expected 9
-    #
-    # Sites with particular verbose os's may wish to override this in site.exp.
-    #
-    proc prune_warnings { text } {
-       # This is from sun4's.  Do it for all machines for now.
-       # The "\\1" is to try to preserve a "\n" but only if necessary.
-       regsub -all "(^|\n)(ld.so: warning:\[^\n\]*\n?)+" $text "\\1" text
-
-       # It might be tempting to get carried away and delete blank lines, etc.
-       # Just delete *exactly* what we're ask to, and that's it.
-       return $text
-    }
-}
-
 # ldtests contains test-items with 3 items followed by 1 lists, 2 items
 # and 3 optional items:
 #   0:name