This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
detect assembler dwarf2 .debug_line support
- To: gcc-patches at gcc dot gnu dot org
- Subject: detect assembler dwarf2 .debug_line support
- From: Richard Henderson <rth at redhat dot com>
- Date: Fri, 17 Nov 2000 15:59:16 -0800
Gas in cvs supports this for quite a number of platforms, and
since the directives were stolen from Irix, it should work
there as well.
The difference in size for the .debug_line section on Alpha
is stunning -- the new size is about 4% of the original.
For 32-bit targets I'd expect a more "modest" 10%, but havn't
actually measured it yet.
r~
* configure.in (HAVE_AS_DWARF2_DEBUG_LINE): New. Detect
whether as accepts .file/.loc and produces dwarf2 line info.
* dwarf2out.c (DWARF2_ASM_LINE_DEBUG_INFO): Default on if
the assembler supports it.
* config.in, configure: Regenerate.
Index: configure.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/configure.in,v
retrieving revision 1.453
diff -c -p -d -r1.453 configure.in
*** configure.in 2000/11/17 10:42:44 1.453
--- configure.in 2000/11/17 23:40:34
*************** AC_MSG_RESULT($gcc_cv_nm)
*** 1210,1216 ****
# Figure out what assembler alignment features are present.
AC_MSG_CHECKING(assembler alignment features)
! gcc_cv_as_alignment_features=
if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
# Gas version 2.6 and later support for .balign and .p2align.
# bytes to skip when using .p2align.
--- 1210,1216 ----
# Figure out what assembler alignment features are present.
AC_MSG_CHECKING(assembler alignment features)
! gcc_cv_as_alignment_features=none
if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
# Gas version 2.6 and later support for .balign and .p2align.
# bytes to skip when using .p2align.
*************** fi
*** 1245,1251 ****
AC_MSG_RESULT($gcc_cv_as_alignment_features)
AC_MSG_CHECKING(assembler subsection support)
! gcc_cv_as_subsections=
if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
gcc_cv_as_subsections="working .subsection -1"
--- 1245,1251 ----
AC_MSG_RESULT($gcc_cv_as_alignment_features)
AC_MSG_CHECKING(assembler subsection support)
! gcc_cv_as_subsections=no
if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
gcc_cv_as_subsections="working .subsection -1"
*************** fi
*** 1283,1289 ****
AC_MSG_RESULT($gcc_cv_as_subsections)
AC_MSG_CHECKING(assembler weak support)
! gcc_cv_as_weak=
if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 2 -o "$gcc_cv_gas_major_version" -gt 2; then
gcc_cv_as_weak="yes"
--- 1283,1289 ----
AC_MSG_RESULT($gcc_cv_as_subsections)
AC_MSG_CHECKING(assembler weak support)
! gcc_cv_as_weak=no
if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 2 -o "$gcc_cv_gas_major_version" -gt 2; then
gcc_cv_as_weak="yes"
*************** fi
*** 1302,1308 ****
AC_MSG_RESULT($gcc_cv_as_weak)
AC_MSG_CHECKING(assembler hidden support)
! gcc_cv_as_hidden=
if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 10 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
gcc_cv_as_hidden="yes"
--- 1302,1308 ----
AC_MSG_RESULT($gcc_cv_as_weak)
AC_MSG_CHECKING(assembler hidden support)
! gcc_cv_as_hidden=no
if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 10 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
gcc_cv_as_hidden="yes"
*************** changequote([,])dnl
*** 1456,1461 ****
--- 1456,1502 ----
AC_MSG_RESULT($gcc_cv_as_instructions)
;;
esac
+
+ AC_MSG_CHECKING(assembler dwarf2 debug_line support)
+ gcc_cv_as_dwarf2_debug_line=no
+ # ??? Not all targets support dwarf2 debug_line, even within a version
+ # of gas. Moreover, we need to emit a valid instruction to trigger any
+ # info to the output file. So, as supported targets are added to gas 2.11,
+ # add some instruction here to (also) show we expect this might work.
+ # ??? Once 2.11 is released, probably need to add first known working
+ # version to the per-target configury.
+ case "$target" in
+ i?86*-*-* | mips*-*-* | alpha*-*-*)
+ insn="nop"
+ ;;
+ ia64*-*-*)
+ insn="nop 0"
+ ;;
+ esac
+ if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x;
+ then
+ if test "$gcc_cv_gas_major_version" -eq 2 \
+ -a "$gcc_cv_gas_minor_version" -ge 11 \
+ -o "$gcc_cv_gas_major_version" -gt 2 \
+ && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
+ && test x"$insn" != x ; then
+ gcc_cv_as_dwarf2_debug_line="yes"
+ fi
+ elif test x$gcc_cv_as != x -a x"$insn" != x ; then
+ echo ' .file 0 "conftest.s"' > conftest.s
+ echo ' .loc 0 3 0' >> conftest.s
+ echo " $insn" >> conftest.s
+ if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
+ && grep debug_line conftest.o > /dev/null 2>&1 ; then
+ gcc_cv_as_dwarf2_debug_line="yes"
+ fi
+ rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
+ fi
+ if test x"$gcc_cv_as_dwarf2_debug_line" = xyes; then
+ AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1,
+ [Define if your assembler supports dwarf2 .file/.loc directives.])
+ fi
+ AC_MSG_RESULT($gcc_cv_as_dwarf2_debug_line)
# Figure out what language subdirectories are present.
# Look if the user specified --enable-languages="..."; if not, use
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf2out.c,v
retrieving revision 1.218
diff -c -p -d -r1.218 dwarf2out.c
*** dwarf2out.c 2000/11/17 17:31:07 1.218
--- dwarf2out.c 2000/11/17 23:40:34
*************** extern int flag_traditional;
*** 3127,3135 ****
(DWARF_ROUND (2 * DWARF_OFFSET_SIZE + 4, DWARF2_ADDR_SIZE * 2) \
- (2 * DWARF_OFFSET_SIZE + 4))
! /* The default is to have gcc emit the line number tables. */
#ifndef DWARF2_ASM_LINE_DEBUG_INFO
#define DWARF2_ASM_LINE_DEBUG_INFO 0
#endif
/* Define the architecture-dependent minimum instruction length (in bytes).
--- 3127,3139 ----
(DWARF_ROUND (2 * DWARF_OFFSET_SIZE + 4, DWARF2_ADDR_SIZE * 2) \
- (2 * DWARF_OFFSET_SIZE + 4))
! /* Use assembler line directives if available. */
#ifndef DWARF2_ASM_LINE_DEBUG_INFO
+ #ifdef HAVE_AS_DWARF2_DEBUG_LINE
+ #define DWARF2_ASM_LINE_DEBUG_INFO 1
+ #else
#define DWARF2_ASM_LINE_DEBUG_INFO 0
+ #endif
#endif
/* Define the architecture-dependent minimum instruction length (in bytes).