re PR debug/43293 (Invalid unwind info for i?86 -fpic)
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. From-SVN: r157707
This commit is contained in:
parent
81ef7e2403
commit
6d217c3249
@ -1,5 +1,30 @@
|
||||
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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* 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.
|
||||
|
||||
@ -141,9 +141,8 @@ along with GCC; see the file COPYING3. If not see
|
||||
|
||||
#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. */
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* 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.
|
||||
@ -27,7 +27,6 @@ extern void ix86_conditional_register_usage (void);
|
||||
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);
|
||||
|
@ -7580,8 +7580,8 @@ get_pc_thunk_name (char name[32], unsigned int regno)
|
||||
/* 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;
|
||||
@ -7589,15 +7589,21 @@ ix86_file_end (void)
|
||||
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)
|
||||
{
|
||||
@ -7613,13 +7619,6 @@ ix86_file_end (void)
|
||||
#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);
|
||||
@ -7637,23 +7636,22 @@ ix86_file_end (void)
|
||||
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. */
|
||||
@ -25938,13 +25936,6 @@ machopic_output_stub (FILE *file, const char *symb, const char *stub)
|
||||
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. */
|
||||
@ -30550,6 +30541,9 @@ ix86_enum_va_list (int idx, const char **pname, tree *ptree)
|
||||
#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;
|
||||
|
||||
#include "gt-i386.h"
|
||||
|
@ -1627,9 +1627,6 @@ typedef struct ix86_args {
|
||||
#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. */
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* 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.
|
||||
|
||||
@ -202,8 +202,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
#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"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* 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.
|
||||
|
||||
@ -105,8 +105,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
#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"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* 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.
|
||||
|
||||
@ -670,8 +670,6 @@ i386_pe_file_end (void)
|
||||
{
|
||||
struct extern_list *p;
|
||||
|
||||
ix86_file_end ();
|
||||
|
||||
for (p = extern_head; p != NULL; p = p->next)
|
||||
{
|
||||
tree decl;
|
||||
|
@ -7137,6 +7137,14 @@ need to do other things in that hook, have your hook function call
|
||||
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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* 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
|
||||
@ -204,6 +204,10 @@
|
||||
#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
|
||||
@ -292,6 +296,7 @@
|
||||
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, \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* 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
|
||||
@ -235,6 +235,10 @@ struct gcc_target
|
||||
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);
|
||||
|
@ -1084,6 +1084,10 @@ compile_file (void)
|
||||
/* 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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user