* target.h (struct gcc_target): Add code_end hook.
* target-def.h (TARGET_ASM_CODE_END): Define to hook_void_void
if not yet defined.
(TARGET_ASM_OUT): Add TARGET_ASM_CODE_END.
* toplev.c (compile_file): Call targetm.asm_out.code_end
hook before unwind info/debug info output.
* config/i386/winnt.c (i386_pe_file_end): Don't call ix86_file_end.
* config/i386/linux.h (NEED_INDICATE_EXEC_STACK): Don't define.
(TARGET_ASM_FILE_END): Define to file_end_indicate_exec_stack.
* config/i386/linux64.h (NEED_INDICATE_EXEC_STACK): Don't define.
(TARGET_ASM_FILE_END): Define to file_end_indicate_exec_stack.
* config/i386/i386.c (ix86_file_end): Renamed to...
(ix86_code_end): ... this. Make static. Don't call
file_end_indicate_exec_stack. Emit unwind info using
final_start_function/final_end_function.
(darwin_x86_file_end): Remove.
(TARGET_ASM_CODE_END): Define.
* config/i386/i386.h (TARGET_ASM_FILE_END,
NEED_INDICATE_EXEC_STACK): Don't define.
* config/i386/darwin.h (darwin_x86_file_end): Remove prototype.
(TARGET_ASM_FILE_END): Define to darwin_file_end.
* config/i386/i386-protos.h (ix86_file_end): Remove prototype.
* doc/tm.texi (TARGET_ASM_CODE_END): Document.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157707
138bc75d-0d04-0410-961f-
82ee72b054a4
2010-03-24 Jakub Jelinek <jakub@redhat.com>
+ PR debug/43293
+ * target.h (struct gcc_target): Add code_end hook.
+ * target-def.h (TARGET_ASM_CODE_END): Define to hook_void_void
+ if not yet defined.
+ (TARGET_ASM_OUT): Add TARGET_ASM_CODE_END.
+ * toplev.c (compile_file): Call targetm.asm_out.code_end
+ hook before unwind info/debug info output.
+ * config/i386/winnt.c (i386_pe_file_end): Don't call ix86_file_end.
+ * config/i386/linux.h (NEED_INDICATE_EXEC_STACK): Don't define.
+ (TARGET_ASM_FILE_END): Define to file_end_indicate_exec_stack.
+ * config/i386/linux64.h (NEED_INDICATE_EXEC_STACK): Don't define.
+ (TARGET_ASM_FILE_END): Define to file_end_indicate_exec_stack.
+ * config/i386/i386.c (ix86_file_end): Renamed to...
+ (ix86_code_end): ... this. Make static. Don't call
+ file_end_indicate_exec_stack. Emit unwind info using
+ final_start_function/final_end_function.
+ (darwin_x86_file_end): Remove.
+ (TARGET_ASM_CODE_END): Define.
+ * config/i386/i386.h (TARGET_ASM_FILE_END,
+ NEED_INDICATE_EXEC_STACK): Don't define.
+ * config/i386/darwin.h (darwin_x86_file_end): Remove prototype.
+ (TARGET_ASM_FILE_END): Define to darwin_file_end.
+ * config/i386/i386-protos.h (ix86_file_end): Remove prototype.
+ * doc/tm.texi (TARGET_ASM_CODE_END): Document.
+
PR target/43498
* config/i386/i386.c (x86_output_mi_thunk): Call final_start_function
at the beginning and final_end_function at the end.
/* Target definitions for x86 running Darwin.
- Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008
+ Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2010
Free Software Foundation, Inc.
Contributed by Apple Computer Inc.
#define SHIFT_DOUBLE_OMITS_COUNT 0
-extern void darwin_x86_file_end (void);
#undef TARGET_ASM_FILE_END
-#define TARGET_ASM_FILE_END darwin_x86_file_end
+#define TARGET_ASM_FILE_END darwin_file_end
/* Define the syntax of pseudo-ops, labels and comments. */
/* Definitions of target machine for GCC for IA-32.
Copyright (C) 1988, 1992, 1994, 1995, 1996, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
extern int ix86_can_use_return_insn_p (void);
extern void ix86_setup_frame_addresses (void);
-extern void ix86_file_end (void);
extern HOST_WIDE_INT ix86_initial_elimination_offset (int, int);
extern void ix86_expand_prologue (void);
extern void ix86_expand_epilogue (int);
/* This function generates code for -fpic that loads %ebx with
the return address of the caller and then returns. */
-void
-ix86_file_end (void)
+static void
+ix86_code_end (void)
{
rtx xops[2];
int regno;
for (regno = 0; regno < 8; ++regno)
{
char name[32];
-#ifdef DWARF2_UNWIND_INFO
- bool do_cfi;
-#endif
+ tree decl;
if (! ((pic_labels_used >> regno) & 1))
continue;
get_pc_thunk_name (name, regno);
+ decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
+ get_identifier (name),
+ build_function_type (void_type_node, void_list_node));
+ DECL_RESULT (decl) = build_decl (BUILTINS_LOCATION, RESULT_DECL,
+ NULL_TREE, void_type_node);
+ TREE_PUBLIC (decl) = 1;
+ TREE_STATIC (decl) = 1;
+
#if TARGET_MACHO
if (TARGET_MACHO)
{
#endif
if (USE_HIDDEN_LINKONCE)
{
- tree decl;
-
- decl = build_decl (BUILTINS_LOCATION,
- FUNCTION_DECL, get_identifier (name),
- error_mark_node);
- TREE_PUBLIC (decl) = 1;
- TREE_STATIC (decl) = 1;
DECL_COMDAT_GROUP (decl) = DECL_ASSEMBLER_NAME (decl);
(*targetm.asm_out.unique_section) (decl, 0);
ASM_OUTPUT_LABEL (asm_out_file, name);
}
-#ifdef DWARF2_UNWIND_INFO
- do_cfi = dwarf2out_do_cfi_asm ();
- if (do_cfi)
- fprintf (asm_out_file, "\t.cfi_startproc\n");
-#endif
+ DECL_INITIAL (decl) = make_node (BLOCK);
+ current_function_decl = decl;
+ init_function_start (decl);
+ /* Make sure unwind info is emitted for the thunk if needed. */
+ final_start_function (emit_barrier (), asm_out_file, 1);
+
xops[0] = gen_rtx_REG (Pmode, regno);
xops[1] = gen_rtx_MEM (Pmode, stack_pointer_rtx);
output_asm_insn ("mov%z0\t{%1, %0|%0, %1}", xops);
output_asm_insn ("ret", xops);
-#ifdef DWARF2_UNWIND_INFO
- if (do_cfi)
- fprintf (asm_out_file, "\t.cfi_endproc\n");
-#endif
+ final_end_function ();
+ init_insn_lengths ();
+ free_after_compilation (cfun);
+ set_cfun (NULL);
+ current_function_decl = NULL;
}
-
- if (NEED_INDICATE_EXEC_STACK)
- file_end_indicate_exec_stack ();
}
/* Emit code for the SET_GOT patterns. */
fprintf (file, "\t.indirect_symbol %s\n", symbol_name);
fprintf (file, ASM_LONG "%s\n", binder_name);
}
-
-void
-darwin_x86_file_end (void)
-{
- darwin_file_end ();
- ix86_file_end ();
-}
#endif /* TARGET_MACHO */
/* Order the registers for register allocator. */
#undef TARGET_CAN_ELIMINATE
#define TARGET_CAN_ELIMINATE ix86_can_eliminate
+#undef TARGET_ASM_CODE_END
+#define TARGET_ASM_CODE_END ix86_code_end
+
struct gcc_target targetm = TARGET_INITIALIZER;
\f
#include "gt-i386.h"
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
function_arg (&(CUM), (MODE), (TYPE), (NAMED))
-#define TARGET_ASM_FILE_END ix86_file_end
-#define NEED_INDICATE_EXEC_STACK 0
-
/* Output assembler code to FILE to increment profiler label # LABELNO
for profiling a function entry. */
/* Definitions for Intel 386 running Linux-based GNU systems with ELF format.
Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2004, 2005,
- 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
Contributed by Eric Youngdale.
Modified for stabs-in-ELF by H.J. Lu.
#define LIBGCC2_TF_CEXT q
#define TF_SIZE 113
-#undef NEED_INDICATE_EXEC_STACK
-#define NEED_INDICATE_EXEC_STACK 1
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
#define MD_UNWIND_SUPPORT "config/i386/linux-unwind.h"
/* Definitions for AMD x86-64 running Linux-based GNU systems with ELF format.
- Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009
+ Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Contributed by Jan Hubicka <jh@suse.cz>, based on linux.h.
#define LIBGCC2_TF_CEXT q
#define TF_SIZE 113
-#undef NEED_INDICATE_EXEC_STACK
-#define NEED_INDICATE_EXEC_STACK 1
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
#define MD_UNWIND_SUPPORT "config/i386/linux-unwind.h"
/* Subroutines for insn-output.c for Windows NT.
Contributed by Douglas Rupp (drupp@cs.washington.edu)
Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GCC.
{
struct extern_list *p;
- ix86_file_end ();
-
for (p = extern_head; p != NULL; p = p->next)
{
tree decl;
this function.
@end deftypefun
+@deftypefn {Target Hook} void TARGET_ASM_CODE_END (void)
+Output to @code{asm_out_file} any text which is needed before emitting
+unwind info and debug info at the end of a file. Some targets emit
+here PIC setup thunks that cannot be emitted at the end of file,
+because they couldn't have unwind info then. The default is to output
+nothing.
+@end deftypefn
+
@defmac ASM_COMMENT_START
A C string constant describing how to begin a comment in the target
assembler language. The compiler assumes that the comment will end at
/* Default initializers for a generic GCC target.
- Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
#define TARGET_ASM_FILE_END hook_void_void
#endif
+#ifndef TARGET_ASM_CODE_END
+#define TARGET_ASM_CODE_END hook_void_void
+#endif
+
#ifndef TARGET_EXTRA_LIVE_ON_ENTRY
#define TARGET_EXTRA_LIVE_ON_ENTRY hook_void_bitmap
#endif
TARGET_ASM_CAN_OUTPUT_MI_THUNK, \
TARGET_ASM_FILE_START, \
TARGET_ASM_FILE_END, \
+ TARGET_ASM_CODE_END, \
TARGET_ASM_EXTERNAL_LIBCALL, \
TARGET_ASM_MARK_DECL_PRESERVED, \
TARGET_ASM_RECORD_GCC_SWITCHES, \
/* Data structure definitions for a generic GCC target.
- Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
translation unit. */
void (*file_end) (void);
+ /* Output any boilerplace text needed at the end of a
+ translation unit before debug and unwind info is emitted. */
+ void (*code_end) (void);
+
/* Output an assembler pseudo-op to declare a library function name
external. */
void (*external_libcall) (rtx);
/* Write out any pending weak symbol declarations. */
weak_finish ();
+ /* This must be at the end before unwind and debug info.
+ Some target ports emit PIC setup thunks here. */
+ targetm.asm_out.code_end ();
+
/* Do dbx symbols. */
timevar_push (TV_SYMOUT);