[obv] Fix broken build on Fedora 23.
[deliverable/binutils-gdb.git] / gdb / contrib / cc-with-tweaks.sh
index ccc9c5a3f98a2dfeb7a861e4bf64bc0cd481422a..f491a0fb615c8d8a65182b05fd39fe9522496014 100755 (executable)
@@ -2,7 +2,7 @@
 # Wrapper around gcc to tweak the output in various ways when running
 # the testsuite.
 
-# Copyright (C) 2010-2012 Free Software Foundation, Inc.
+# Copyright (C) 2010-2016 Free Software Foundation, Inc.
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 3 of the License, or
 #   CC_FOR_TARGET="/bin/sh $srcdir/gdb/contrib/cc-with-tweaks.sh ARGS gcc" \
 #   CXX_FOR_TARGET="/bin/sh $srcdir/gdb/contrib/cc-with-tweaks.sh ARGS g++"
 #
+# For documentation on Fission and dwp files:
+#     http://gcc.gnu.org/wiki/DebugFission
+#     http://gcc.gnu.org/wiki/DebugFissionDWP
 # For documentation on index files: info -f gdb.info -n "Index Files"
 # For information about 'dwz', see the announcement:
 #     http://gcc.gnu.org/ml/gcc/2012-04/msg00686.html
 # (More documentation is to come.)
 
 # ARGS determine what is done.  They can be:
+# -Z invoke objcopy --compress-debug-sections
 # -z compress using dwz
 # -m compress using dwz -m
 # -i make an index
+# -p create .dwp files (Fission), you need to also use gcc option -gsplit-dwarf
 # If nothing is given, no changes are made
 
 myname=cc-with-tweaks.sh
@@ -74,9 +79,11 @@ want_index=false
 want_dwz=false
 want_multi=false
 want_dwp=false
+want_objcopy_compress=false
 
 while [ $# -gt 0 ]; do
     case "$1" in
+       -Z) want_objcopy_compress=true ;;
        -z) want_dwz=true ;;
        -i) want_index=true ;;
        -m) want_multi=true ;;
@@ -138,6 +145,12 @@ then
     exit 1
 fi
 
+if [ "$want_objcopy_compress" = true ]; then
+    $OBJCOPY --compress-debug-sections "$output_file"
+    rc=$?
+    [ $rc != 0 ] && exit $rc
+fi
+
 if [ "$want_index" = true ]; then
     $GDB --batch-silent -nx -ex "set auto-load no" -ex "file $output_file" -ex "save gdb-index $output_dir"
     rc=$?
@@ -166,8 +179,13 @@ fi
 if [ "$want_dwp" = true ]; then
     dwo_files=$($READELF -wi "${output_file}" | grep _dwo_name | \
        sed -e 's/^.*: //' | sort | uniq)
-    $DWP -o "${output_file}.dwp" ${dwo_files} > /dev/null
-    rm -f ${dwo_files}
+    rc=0
+    if [ -n "$dwo_files" ]; then
+       $DWP -o "${output_file}.dwp" ${dwo_files} > /dev/null
+       rc=$?
+       [ $rc != 0 ] && exit $rc
+       rm -f ${dwo_files}
+    fi
 fi
 
 rm -f "$index_file"
This page took 0.032 seconds and 4 git commands to generate.