mklibgcc.in: Use a here document to avoid running afoul of shells that generate contr...
authorZack Weinberg <zack@codesourcery.com>
Mon, 7 Apr 2003 05:34:50 +0000 (05:34 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Mon, 7 Apr 2003 05:34:50 +0000 (05:34 +0000)
* mklibgcc.in: Use a here document to avoid running afoul of
shells that generate control-A from "echo \1".

From-SVN: r65321

gcc/ChangeLog
gcc/mklibgcc.in

index ca209182bc0b096d22d57f21a99101eec718daa9..0b7d329511989ca1eab8719a2ee81e6bd1bd2dba 100644 (file)
@@ -1,3 +1,8 @@
+2003-04-06  Zack Weinberg  <zack@codesourcery.com>
+
+       * mklibgcc.in: Use a here document to avoid running afoul of
+       shells that generate control-A from "echo \1".
+
 2003-04-06  Aldy Hernandez  <aldyh@redhat.com>
 
         * doc/invoke.texi (RS/6000 and PowerPC Options): Document -mspe
index 3a492da13b14b5759271bdc7741b4bda3e9515cf..1abb3a05e5e9632d88a67b41b7e2014c4ee20ac9 100644 (file)
@@ -311,13 +311,20 @@ for ml in $MULTILIBS; do
   if [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" ]; then
     mapfile="libgcc/${dir}/libgcc.map"
     tmpmapfile="libgcc/${dir}/tmp-libgcc.map"
-    echo ""
-    echo "${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES $libgcc_sh_objs"
-    echo '     { $(NM_FOR_TARGET)'" $SHLIB_NM_FLAGS $libgcc_sh_objs; echo %%; \\"
-    echo "       cat $SHLIB_MAPFILES | sed -e "'"/^[   ]*#/d" -e '\''s/^%\(if\|else\|elif\|endif\|define\)/#\1/'\'" \\"
-    echo "       | $gcc_compile $flags -E -xassembler-with-cpp -; \\"
-    echo '     } | $(AWK)'" -f $SHLIB_MKMAP $SHLIB_MKMAP_OPTS > ${tmpmapfile}"
-    echo '     mv '"$tmpmapfile"' $@'
+    # This uses a here document instead of echos because some shells
+    # will convert the \1 in the second sed command to a control-A.
+    # The behavior of here documents is more predictable.
+    cat <<EOF
+
+${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES $libgcc_sh_objs
+       { \$(NM_FOR_TARGET) $SHLIB_NM_FLAGS $libgcc_sh_objs; echo %%; \\
+         cat $SHLIB_MAPFILES \\
+           | sed -e '/^[   ]*#/d' \\
+                 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \\
+           | $gcc_compile $flags -E -xassembler-with-cpp -; \\
+       } | \$(AWK) -f $SHLIB_MKMAP $SHLIB_MKMAP_OPTS > ${tmpmapfile}
+       mv '$tmpmapfile' \$@
+EOF
   fi
   shlib_deps="$shlib_deps $mapfile"