Commit d4ea4622 by Richard Henderson Committed by Richard Henderson

Makefile.in (c-cppbuiltin.o): Depend on debug.h.

        * Makefile.in (c-cppbuiltin.o): Depend on debug.h.
        * c-cppbuiltin.c (c_cpp_builtins): Define __GCC_HAVE_DWARF2_CFI_ASM.
        * doc/cpp.texi (__GCC_HAVE_DWARF2_CFI_ASM): Document it.
        * common.opt (fdwarf2-cfi-asm): New.
        * configure.ac (HAVE_GAS_CFI_DIRECTIVE): New.
        * config.in, configure: Rebuild.
        * dwarf2asm.c (dw2_asm_output_data_raw): New.
        (dw2_asm_output_data_uleb128_raw, dw2_asm_output_data_sleb128_raw): New.
        (dw2_force_const_mem): Externalize.
        * dwarf2asm.h: Update.
        * dwarf2out.c (dwarf2out_cfi_label): If flag_dwarf2_cfi_asm, don't
        generate a real label.
        (output_cfi_directive): New.
        (add_fde_cfi): If flag_dwarf2_cfi_asm, use it.
        (output_call_frame_info): Do nothing if flag_dwarf2_cfi_asm.
        (dwarf2out_begin_prologue): Emit .cfi_startproc, .cfi_personality,
        and .cfi_lsda.
        (dwarf2out_end_epilogue): Emit .cfi_endproc.
        (output_loc_operands_raw, output_loc_sequence_raw): New.
        (output_cfa_loc_raw): New.

From-SVN: r138733
parent cdaf871b
2008-08-05 Richard Henderson <rth@redhat.com>
* Makefile.in (c-cppbuiltin.o): Depend on debug.h.
* c-cppbuiltin.c (c_cpp_builtins): Define __GCC_HAVE_DWARF2_CFI_ASM.
* doc/cpp.texi (__GCC_HAVE_DWARF2_CFI_ASM): Document it.
* common.opt (fdwarf2-cfi-asm): New.
* configure.ac (HAVE_GAS_CFI_DIRECTIVE): New.
* config.in, configure: Rebuild.
* dwarf2asm.c (dw2_asm_output_data_raw): New.
(dw2_asm_output_data_uleb128_raw, dw2_asm_output_data_sleb128_raw): New.
(dw2_force_const_mem): Externalize.
* dwarf2asm.h: Update.
* dwarf2out.c (dwarf2out_cfi_label): If flag_dwarf2_cfi_asm, don't
generate a real label.
(output_cfi_directive): New.
(add_fde_cfi): If flag_dwarf2_cfi_asm, use it.
(output_call_frame_info): Do nothing if flag_dwarf2_cfi_asm.
(dwarf2out_begin_prologue): Emit .cfi_startproc, .cfi_personality,
and .cfi_lsda.
(dwarf2out_end_epilogue): Emit .cfi_endproc.
(output_loc_operands_raw, output_loc_sequence_raw): New.
(output_cfa_loc_raw): New.
2008-08-05 Paul Brook <paul@codesourcery.com>
* doc/invoke.texi: Document new ARM -mfpu= and -mcpu= options.
......
......@@ -1870,8 +1870,9 @@ c-opts.o : c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$< $(OUTPUT_OPTION) @TARGET_SYSTEM_ROOT_DEFINE@
c-cppbuiltin.o : c-cppbuiltin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) version.h $(C_COMMON_H) $(C_PRAGMA_H) $(FLAGS_H) $(TOPLEV_H) \
output.h except.h $(REAL_H) $(TARGET_H) $(TM_P_H) $(BASEVER)
$(TREE_H) version.h $(C_COMMON_H) $(C_PRAGMA_H) $(FLAGS_H) \
$(TOPLEV_H) output.h except.h $(REAL_H) $(TARGET_H) $(TM_P_H) \
$(BASEVER) debug.h
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) -DBASEVER=$(BASEVER_s) \
$< $(OUTPUT_OPTION)
......
......@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "c-pragma.h"
#include "output.h"
#include "except.h" /* For USING_SJLJ_EXCEPTIONS. */
#include "debug.h" /* For dwarf2out_do_frame. */
#include "toplev.h"
#include "tm_p.h" /* Target prototypes. */
#include "target.h"
......@@ -691,6 +692,11 @@ c_cpp_builtins (cpp_reader *pfile)
cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16");
#endif
#ifdef DWARF2_UNWIND_INFO
if (flag_dwarf2_cfi_asm && dwarf2out_do_frame ())
cpp_define (pfile, "__GCC_HAVE_DWARF2_CFI_ASM");
#endif
/* Make the choice of ObjC runtime visible to source code. */
if (c_dialect_objc () && flag_next_runtime)
cpp_define (pfile, "__NEXT_RUNTIME__");
......
......@@ -459,6 +459,10 @@ fdump-unnumbered
Common Report Var(flag_dump_unnumbered) VarExists
Suppress output of instruction numbers, line number notes and addresses in debugging dumps
fdwarf2-cfi-asm
Common Report Var(flag_dwarf2_cfi_asm) Init(HAVE_GAS_CFI_DIRECTIVE)
Enable CFI tables via GAS assembler directives.
fearly-inlining
Common Report Var(flag_early_inlining) Init(1) Optimization
Perform early inlining
......
......@@ -821,6 +821,12 @@
#endif
/* Define 0/1 if your assembler supports CFI directives. */
#ifndef USED_FOR_TARGET
#undef HAVE_GAS_CFI_DIRECTIVE
#endif
/* Define if your assembler uses the new HImode fild and fist notation. */
#ifndef USED_FOR_TARGET
#undef HAVE_GAS_FILDS_FISTS
......
......@@ -20832,6 +20832,50 @@ _ACEOF
fi
# Check if we have assembler support for unwind directives.
echo "$as_me:$LINENO: checking assembler for cfi directives" >&5
echo $ECHO_N "checking assembler for cfi directives... $ECHO_C" >&6
if test "${gcc_cv_as_cfi_directive+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
gcc_cv_as_cfi_directive=no
if test $in_tree_gas = yes; then
if test $in_tree_gas_is_elf = yes \
&& test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 17 \) \* 1000 + 0`
then gcc_cv_as_cfi_directive=yes
fi
elif test x$gcc_cv_as != x; then
echo ' .text
.cfi_startproc
.cfi_offset 0, 0
.cfi_same_value 1
.cfi_def_cfa 1, 2
.cfi_escape 1, 2, 3, 4, 5
.cfi_endproc' > conftest.s
if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5'
{ (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); }; }
then
gcc_cv_as_cfi_directive=yes
else
echo "configure: failed program was" >&5
cat conftest.s >&5
fi
rm -f conftest.o conftest.s
fi
fi
echo "$as_me:$LINENO: result: $gcc_cv_as_cfi_directive" >&5
echo "${ECHO_T}$gcc_cv_as_cfi_directive" >&6
cat >>confdefs.h <<_ACEOF
#define HAVE_GAS_CFI_DIRECTIVE `if test $gcc_cv_as_cfi_directive = yes; then echo 1; else echo 0; fi`
_ACEOF
# GAS versions up to and including 2.11.0 may mis-optimize
# .eh_frame data.
echo "$as_me:$LINENO: checking assembler for eh_frame optimization" >&5
......
......@@ -2180,6 +2180,20 @@ changequote([,])dnl
[AC_DEFINE(HAVE_AS_LEB128, 1,
[Define if your assembler supports .sleb128 and .uleb128.])])
# Check if we have assembler support for unwind directives.
gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive,
[elf,2,17,0],,
[ .text
.cfi_startproc
.cfi_offset 0, 0
.cfi_same_value 1
.cfi_def_cfa 1, 2
.cfi_escape 1, 2, 3, 4, 5
.cfi_endproc])
AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_DIRECTIVE,
[`if test $gcc_cv_as_cfi_directive = yes; then echo 1; else echo 0; fi`],
[Define 0/1 if your assembler supports CFI directives.])
# GAS versions up to and including 2.11.0 may mis-optimize
# .eh_frame data.
gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame,
......
......@@ -2239,6 +2239,10 @@ If GCC cannot determine the current date, it will emit a warning message
These macros are defined when the target processor supports atomic compare
and swap operations on operands 1, 2, 4, 8 or 16 bytes in length, respectively.
@item __GCC_HAVE_DWARF2_CFI_ASM
This macro is defined when the compiler is emitting Dwarf2 CFI directives
to the assembler. When this is defined, it is possible to emit those same
directives in inline assembly.
@end table
@node System-specific Predefined Macros
......
......@@ -62,6 +62,34 @@ dw2_assemble_integer (int size, rtx x)
}
/* Output a value of a given size in target byte order. */
void
dw2_asm_output_data_raw (int size, unsigned HOST_WIDE_INT value)
{
unsigned char bytes[8];
int i;
for (i = 0; i < 8; ++i)
{
bytes[i] = value & 0xff;
value >>= 8;
}
if (BYTES_BIG_ENDIAN)
{
for (i = size - 1; i > 0; --i)
fprintf (asm_out_file, "0x%x,", bytes[i]);
fprintf (asm_out_file, "0x%x", bytes[0]);
}
else
{
for (i = 0; i < size - 1; ++i)
fprintf (asm_out_file, "0x%x,", bytes[i]);
fprintf (asm_out_file, "0x%x", bytes[i]);
}
}
/* Output an immediate constant in a given SIZE in bytes. */
void
......@@ -505,6 +533,26 @@ eh_data_format_name (int format)
#endif
}
/* Output an unsigned LEB128 quantity, but only the byte values. */
void
dw2_asm_output_data_uleb128_raw (unsigned HOST_WIDE_INT value)
{
while (1)
{
int byte = (value & 0x7f);
value >>= 7;
if (value != 0)
/* More bytes to follow. */
byte |= 0x80;
fprintf (asm_out_file, "0x%x", byte);
if (value == 0)
break;
fputc (',', asm_out_file);
}
}
/* Output an unsigned LEB128 quantity. */
void
......@@ -566,6 +614,29 @@ dw2_asm_output_data_uleb128 (unsigned HOST_WIDE_INT value,
va_end (ap);
}
/* Output an signed LEB128 quantity, but only the byte values. */
void
dw2_asm_output_data_sleb128_raw (HOST_WIDE_INT value)
{
int byte, more;
while (1)
{
byte = (value & 0x7f);
value >>= 7;
more = !((value == 0 && (byte & 0x40) == 0)
|| (value == -1 && (byte & 0x40) != 0));
if (more)
byte |= 0x80;
fprintf (asm_out_file, "0x%x", byte);
if (!more)
break;
fputc (',', asm_out_file);
}
}
/* Output a signed LEB128 quantity. */
void
......@@ -689,7 +760,6 @@ dw2_asm_output_delta_sleb128 (const char *lab1 ATTRIBUTE_UNUSED,
}
#endif /* 0 */
static rtx dw2_force_const_mem (rtx, bool);
static int dw2_output_indirect_constant_1 (splay_tree_node, void *);
static GTY((param1_is (char *), param2_is (tree))) splay_tree indirect_pool;
......@@ -733,7 +803,7 @@ splay_tree_compare_strings (splay_tree_key k1, splay_tree_key k2)
"near" the function in any interesting sense. IS_PUBLIC controls whether
the symbol can be shared across the entire application (or DSO). */
static rtx
rtx
dw2_force_const_mem (rtx x, bool is_public)
{
splay_tree_node node;
......
......@@ -20,6 +20,8 @@ along with GCC; see the file COPYING3. If not see
extern void dw2_assemble_integer (int, rtx);
extern void dw2_asm_output_data_raw (int, unsigned HOST_WIDE_INT);
extern void dw2_asm_output_data (int, unsigned HOST_WIDE_INT,
const char *, ...)
ATTRIBUTE_NULL_PRINTF_3;
......@@ -46,10 +48,14 @@ extern void dw2_asm_output_nstring (const char *, size_t,
const char *, ...)
ATTRIBUTE_NULL_PRINTF_3;
extern void dw2_asm_output_data_uleb128_raw (unsigned HOST_WIDE_INT);
extern void dw2_asm_output_data_uleb128 (unsigned HOST_WIDE_INT,
const char *, ...)
ATTRIBUTE_NULL_PRINTF_2;
extern void dw2_asm_output_data_sleb128_raw (HOST_WIDE_INT);
extern void dw2_asm_output_data_sleb128 (HOST_WIDE_INT,
const char *, ...)
ATTRIBUTE_NULL_PRINTF_2;
......@@ -63,6 +69,7 @@ extern int size_of_sleb128 (HOST_WIDE_INT);
extern int size_of_encoded_value (int);
extern const char *eh_data_format_name (int);
extern rtx dw2_force_const_mem (rtx, bool);
extern void dw2_output_indirect_constants (void);
/* These are currently unused. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment