]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Have regdat.sh always rewrite the output register file
authorPatrick Palka <patrick@parcs.ath.cx>
Fri, 10 Jan 2014 03:55:50 +0000 (22:55 -0500)
committerTom Tromey <tromey@redhat.com>
Mon, 13 Jan 2014 19:53:53 +0000 (12:53 -0700)
The rules for generating the output register files look like:

amd64.c : $(srcdir)/../regformats/i386/amd64.dat $(regdat_sh)
$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64.dat amd64.c

According to this rule, if regdat.sh is newer than amd64.c, then
regdat.sh shall be invoked on amd64.dat.  According to regdat.sh, if the
script determines that the output file amd64.c has not changed, then it
will not overwrite the existing output file.  This means that a
subsequent invocation of make will trigger the above rule again as
regdat.sh will be perpetually newer than amd64.c.

This then shows up in the make output like so:

/bin/bash ./../regformats/regdat.sh ./../regformats/i386/amd64-linux.dat amd64-linux.c
amd64-linux.c unchanged.
/bin/bash ./../regformats/regdat.sh ./../regformats/i386/amd64-avx-linux.dat amd64-avx-linux.c
amd64-avx-linux.c unchanged.
...

To fix this pathological behavior, it suffices to have regdat.sh
unconditionally rewrite the output register file.

On my machine, which has a regdat.sh file that is newer than some of the
input register files, this change speeds up every invocation of make
under gdb/ by about 5 seconds.

gdb/ChangeLog
gdb/regformats/regdat.sh

index 18ed4d3c2de0d9f2570a677452b208a62e14cf74..16ed4f0a0248eeb24872893cb4b8940bb019d255 100644 (file)
@@ -1,3 +1,7 @@
+2014-01-13  Patrick Palka  <patrick@parcs.ath.cx>
+
+       * regformats/regdat.sh: Always rewrite the register file.
+
 2014-01-13  Pedro Alves  <palves@redhat.com>
 
         * Makefile.in (CHECK_HEADERS): New variable.
index 0cf458811af147b3ab8484862ecdcc6a94fd0324..fabc910f082b2cc36e9eba971c46b76bc9e36935 100755 (executable)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-move_if_change ()
-{
-    file=$1
-    if test -r ${file} && cmp -s "${file}" new-"${file}"
-    then
-       echo "${file} unchanged." 1>&2
-    else
-       mv new-"${file}" "${file}"
-       echo "${file} updated." 1>&2
-    fi
-}
-
 # Format of the input files
 read="type entry"
 
@@ -202,4 +190,4 @@ EOF
 
 # close things off
 exec 1>&2
-move_if_change $2
+mv -- "new-$2" "$2"