+2019-09-29  Tom de Vries  <tdevries@suse.de>
+
+       * contrib/cc-with-tweaks.sh (get_tmpdir): New function.
+       Use $tmpdir/$(basename "$output_file").dwz instead of
+       "${output_file}.dwz".
+
 2019-09-28  Simon Marchi  <simon.marchi@polymtl.ca>
 
        PR gdb/25045
 
     exit 1
 fi
 
+get_tmpdir ()
+{
+    tmpdir=$(dirname "$output_file")/.tmp
+    mkdir -p "$tmpdir"
+}
+
 if [ "$want_objcopy_compress" = true ]; then
     $OBJCOPY --compress-debug-sections "$output_file"
     rc=$?
        ;;
     esac
 elif [ "$want_multi" = true ]; then
+    get_tmpdir
+    dwz_file=$tmpdir/$(basename "$output_file").dwz
     # Remove the dwz output file if it exists, so we don't mistake it for a
     # new file in case dwz fails.
-    rm -f "${output_file}.dwz"
+    rm -f "$dwz_file"
 
     cp $output_file ${output_file}.alt
-    $DWZ -m ${output_file}.dwz "$output_file" ${output_file}.alt > /dev/null
+    $DWZ -m "$dwz_file" "$output_file" ${output_file}.alt > /dev/null
     rm -f ${output_file}.alt
 
     # Validate dwz's work by checking if the expected output file exists.
-    if [ ! -f "${output_file}.dwz" ]; then
-       echo "$myname: dwz file ${output_file}.dwz missing."
+    if [ ! -f "$dwz_file" ]; then
+       echo "$myname: dwz file $dwz_file missing."
        exit 1
     fi
 fi
 
+2019-09-29  Tom de Vries  <tdevries@suse.de>
+
+        * gdb.dwarf2/gdb-index.exp: Handle new location of .dwz file.
+
 2019-09-29  Tom de Vries  <tdevries@suse.de>
 
        * gdb.dwarf2/gdb-index.exp: Use with_test_prefix for second objcopy.
 
 
 proc add_gdb_index { program } {
     set index_file ${program}.gdb-index
-    set dwz ${program}.dwz
-    set dwz_index_file ${dwz}.gdb-index
+    set dir [file dirname ${program}]
+    set filename [file tail ${program}]
+    set dwz $dir/.tmp/${filename}.dwz
+    set dwz_index_file $program.dwz.gdb-index
     verbose -log "index_file: ${index_file}"
     remote_file host delete ${index_file}
     remote_file host delete ${dwz_index_file}