This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: output # <srcline> between #APP and #NO_APP, for asm statements
On Mar 12, 2007, Alexandre Oliva <aoliva@redhat.com> wrote:
> It was a while ago, but I'll look into a configure test to verify
> whether we should generate the # 0 "" lines.
Here it is. I'm checking it in as obvious. Bootstrapped and
regression-tested on x86_64-linux-gnu.
for gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* configure.ac: Test for assembler tolerance to # 0 "".
* configure, config.in: Rebuilt.
* final.c (final_scan_insn): Emit it if HAVE_AS_LINE_ZERO.
Index: gcc/config.in
===================================================================
--- gcc/config.in.orig 2007-03-12 20:29:34.000000000 -0300
+++ gcc/config.in 2007-03-12 20:29:57.000000000 -0300
@@ -240,6 +240,12 @@
#endif
+/* Define if the assembler won't complain about a line such as # 0 "" 2. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_LINE_ZERO
+#endif
+
+
/* Define if your assembler supports ltoffx and ldxmov relocations. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_LTOFFX_LDXMOV_RELOCS
Index: gcc/configure
===================================================================
--- gcc/configure.orig 2007-03-12 20:29:34.000000000 -0300
+++ gcc/configure 2007-03-12 20:29:57.000000000 -0300
@@ -16005,6 +16005,46 @@ _ACEOF
fi
fi
+echo "$as_me:$LINENO: checking assembler for tolerance to line number 0" >&5
+echo $ECHO_N "checking assembler for tolerance to line number 0... $ECHO_C" >&6
+if test "${gcc_cv_as_line_zero+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ gcc_cv_as_line_zero=no
+ if test $in_tree_gas = yes; then
+ if test $gcc_cv_gas_vers -ge `expr \( \( elf,2,16,91 \* 1000 \) + gcc_cv_as_line_zero=yes \) \* 1000 + `
+ then :
+fi
+ elif test "x$gcc_cv_as" != x; then
+ { echo '# 1 "test.s" 1'; echo '# 0 "" 2'; } > conftest.s
+ if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5 2>conftest.out'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ test "x`cat conftest.out`" = x
+ then
+ gcc_cv_as_line_zero=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ echo "configure: error output was" >&5
+ cat conftest.out >&5
+ fi
+ rm -f conftest.o conftest.s conftest.out
+ fi
+fi
+echo "$as_me:$LINENO: result: $gcc_cv_as_line_zero" >&5
+echo "${ECHO_T}$gcc_cv_as_line_zero" >&6
+if test "x$gcc_cv_as_line_zero" = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_AS_LINE_ZERO 1
+_ACEOF
+
+fi
+
echo "$as_me:$LINENO: checking linker read-only and read-write section mixing" >&5
echo $ECHO_N "checking linker read-only and read-write section mixing... $ECHO_C" >&6
gcc_cv_ld_ro_rw_mix=unknown
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac.orig 2007-03-12 20:29:34.000000000 -0300
+++ gcc/configure.ac 2007-03-12 20:29:57.000000000 -0300
@@ -3069,6 +3069,30 @@ if test x"$insn" != x; then
[Define if your assembler supports the --gstabs option.])])
fi
+AC_CACHE_CHECK([assembler for tolerance to line number 0],
+ [gcc_cv_as_line_zero],
+ [gcc_cv_as_line_zero=no
+ if test $in_tree_gas = yes; then
+ gcc_GAS_VERSION_GTE_IFELSE([elf,2,16,91], [gcc_cv_as_line_zero=yes])
+ elif test "x$gcc_cv_as" != x; then
+ { echo '# 1 "test.s" 1'; echo '# 0 "" 2'; } > conftest.s
+ if AC_TRY_COMMAND([$gcc_cv_as -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD 2>conftest.out]) &&
+ test "x`cat conftest.out`" = x
+ then
+ gcc_cv_as_line_zero=yes
+ else
+ echo "configure: failed program was" >&AS_MESSAGE_LOG_FD
+ cat conftest.s >&AS_MESSAGE_LOG_FD
+ echo "configure: error output was" >&AS_MESSAGE_LOG_FD
+ cat conftest.out >&AS_MESSAGE_LOG_FD
+ fi
+ rm -f conftest.o conftest.s conftest.out
+ fi])
+if test "x$gcc_cv_as_line_zero" = xyes; then
+ AC_DEFINE([HAVE_AS_LINE_ZERO], 1,
+[Define if the assembler won't complain about a line such as # 0 "" 2.])
+fi
+
AC_MSG_CHECKING(linker read-only and read-write section mixing)
gcc_cv_ld_ro_rw_mix=unknown
if test $in_tree_ld = yes ; then
Index: gcc/final.c
===================================================================
--- gcc/final.c.orig 2007-03-12 20:29:56.000000000 -0300
+++ gcc/final.c 2007-03-12 20:29:57.000000000 -0300
@@ -2085,8 +2085,10 @@ final_scan_insn (rtx insn, FILE *file, i
fprintf (asm_out_file, "%s %i \"%s\" 1\n",
ASM_COMMENT_START, loc.line, loc.file);
fprintf (asm_out_file, "\t%s\n", string);
- if (loc.file && loc.line)
+#if HAVE_AS_LINE_ZERO
+ if (*loc.file && loc.line)
fprintf (asm_out_file, "%s 0 \"\" 2\n", ASM_COMMENT_START);
+#endif
}
break;
}
@@ -2124,8 +2126,10 @@ final_scan_insn (rtx insn, FILE *file, i
fprintf (asm_out_file, "%s %i \"%s\" 1\n",
ASM_COMMENT_START, loc.line, loc.file);
output_asm_insn (string, ops);
+#if HAVE_AS_LINE_ZERO
if (loc.file && loc.line)
fprintf (asm_out_file, "%s 0 \"\" 2\n", ASM_COMMENT_START);
+#endif
}
this_is_asm_operands = 0;
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member http://www.fsfla.org/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}