*** empty log message ***
From-SVN: r526
This commit is contained in:
parent
d742f26c5b
commit
b335c2ccab
6 changed files with 160 additions and 64 deletions
|
@ -99,26 +99,23 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#define FRAME_POINTER_REQUIRED \
|
||||
(current_function_calls_setjmp || current_function_calls_longjmp)
|
||||
|
||||
/* Define a few machine-specific details
|
||||
of the implementation of constructors.
|
||||
/* Define a few machine-specific details of the implementation of
|
||||
constructors.
|
||||
|
||||
CTORS_SECTION_ASM_OP should be defined to concatenate
|
||||
the macro INIT_SECTION_ASM_OP, a newline, and a push instruction
|
||||
to push a word containing 0 (or some equivalent of that).
|
||||
The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN
|
||||
and CTOR_LIST_END to contribute to the .init section an instruction to
|
||||
push a word containing 0 (or some equivalent of that).
|
||||
|
||||
ASM_OUTPUT_CONSTRUCTOR should be defined
|
||||
to push the address of the constructor. */
|
||||
ASM_OUTPUT_CONSTRUCTOR should be defined to push the address of the
|
||||
constructor. */
|
||||
|
||||
#undef INIT_SECTION_ASM_OP
|
||||
#define INIT_SECTION_ASM_OP ".section .init,\"x\""
|
||||
|
||||
#define CTORS_SECTION_ASM_OP \
|
||||
INIT_SECTION_ASM_OP "\n" \
|
||||
"\tpushl $0\n\t" \
|
||||
DATA_SECTION_ASM_OP
|
||||
/* The reason we end with DATA_SECTION_ASM_OP is to prevent the
|
||||
initial and final table elements (see crtstuff.c) from getting into
|
||||
the .init section and causing a crash. */
|
||||
#define CTOR_LIST_BEGIN \
|
||||
asm (INIT_SECTION_ASM_OP); \
|
||||
asm ("pushl $0")
|
||||
#define CTOR_LIST_END CTOR_LIST_BEGIN
|
||||
|
||||
#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
|
||||
do { \
|
||||
|
|
|
@ -59,15 +59,38 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#undef USE_LIBG
|
||||
#define USE_LIBG
|
||||
|
||||
/* Define a few machine-specific details
|
||||
of the implementation of constructors.
|
||||
/* Define a few machine-specific details of the implementation of
|
||||
constructors. */
|
||||
|
||||
CTORS_SECTION_ASM_OP should be defined to concatenate
|
||||
the macro INIT_SECTION_ASM_OP, a newline, and a push instruction
|
||||
to push a word containing 0 (or some equivalent of that).
|
||||
/* Although the .init section is used, it is not automatically invoked. */
|
||||
#define INVOKE__main
|
||||
|
||||
ASM_OUTPUT_CONSTRUCTOR should be defined
|
||||
to push the address of the constructor. */
|
||||
/* State that atexit exists so __do_global_ctors will register
|
||||
__do_global_dtors. */
|
||||
#define HAVE_ATEXIT
|
||||
|
||||
#if (STACK_BOUNDARY / BITS_PER_UNIT) == 16 && REG_PARM_STACK_SPACE (0) == 32
|
||||
#define CTOR_LIST_BEGIN \
|
||||
asm (INIT_SECTION_ASM_OP); \
|
||||
asm ("\tsubu\t r31,r31,16"); \
|
||||
asm ("\tst\t r0,r31,32");
|
||||
#define CTOR_LIST_END
|
||||
#endif
|
||||
|
||||
/* ASM_OUTPUT_CONSTRUCTOR outputs code into the .init section to push the
|
||||
address of the constructor. This becomes the body of __do_global_ctors
|
||||
in crtstuff.c. r13 is a temporary register. */
|
||||
#undef ASM_OUTPUT_CONSTRUCTOR
|
||||
#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
|
||||
do { \
|
||||
init_section (); \
|
||||
fprintf (FILE, "\tor.u\t r13,r0,hi16("); \
|
||||
assemble_name (FILE, NAME); \
|
||||
fprintf (FILE, ")\n\tor\t r13,r13,lo16("); \
|
||||
assemble_name (FILE, NAME); \
|
||||
fprintf (FILE, ")\n\tsubu\t r31,r31,%d\n\tst\t r13,r31,%d\n", \
|
||||
STACK_BOUNDARY / BITS_PER_UNIT, REG_PARM_STACK_SPACE (0)); \
|
||||
} while (0)
|
||||
|
||||
#undef DO_GLOBAL_CTORS_BODY
|
||||
#define DO_GLOBAL_CTORS_BODY \
|
||||
|
@ -77,26 +100,41 @@ do { \
|
|||
(*p) (); \
|
||||
} while (0)
|
||||
|
||||
#undef CTORS_SECTION_ASM_OP
|
||||
#define CTORS_SECTION_ASM_OP \
|
||||
INIT_SECTION_ASM_OP "\n" \
|
||||
"subu\t r31,r31,16\n\tst\t r0,r31,32\n\t" \
|
||||
DATA_SECTION_ASM_OP
|
||||
#define DTOR_LIST_BEGIN \
|
||||
asm (FINI_SECTION_ASM_OP); \
|
||||
func_ptr __DTOR_LIST__[4] = { (func_ptr) (-1), (func_ptr) (-1), \
|
||||
(func_ptr) (-1), (func_ptr) (-1) }
|
||||
#define DTOR_LIST_END \
|
||||
asm (FINI_SECTION_ASM_OP); \
|
||||
func_ptr __DTOR_END__[4] = { (func_ptr) 0, (func_ptr) 0, \
|
||||
(func_ptr) 0, (func_ptr) 0 }
|
||||
|
||||
/* The reason we end with DATA_SECTION_ASM_OP is to prevent the
|
||||
initial and final table elements (see crtstuff.c) from getting into
|
||||
the .init section and causing a crash. */
|
||||
|
||||
#undef ASM_OUTPUT_CONSTRUCTOR
|
||||
#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
|
||||
/* A C statement (sans semicolon) to output an element in the table of
|
||||
global destructors. The table is constructed in the .fini section
|
||||
so that an explicit linker script is not required. The complication
|
||||
is that this section is padded with NOP instructions and to either
|
||||
8 or 16 byte alignment depending on the specific system. A clever
|
||||
way to avoid trouble is to output a block of 16 bytes where the
|
||||
extra words are known values (-1). */
|
||||
#undef ASM_OUTPUT_DESTRUCTOR
|
||||
#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
|
||||
do { \
|
||||
init_section (); \
|
||||
fprintf (FILE, "\tor.u r13,r0,hi16("); \
|
||||
assemble_name (FILE, NAME); \
|
||||
fprintf (FILE, ")\nor\t r13,r13,lo16("); \
|
||||
assemble_name (FILE, NAME); \
|
||||
fprintf (FILE, ")\n\tsubu r31,r31,16\nst\t r13,r31,32\n"); \
|
||||
} while (0)
|
||||
register int i; \
|
||||
fini_section (); \
|
||||
fprintf (FILE, "\t%s\t ", ASM_LONG); \
|
||||
assemble_name (FILE,NAME); \
|
||||
fprintf (FILE, "\n"); \
|
||||
for (i = 1; i < 4; i++) \
|
||||
fprintf (FILE, "\t%s\t -1\n", ASM_LONG); \
|
||||
} while (0)
|
||||
|
||||
#undef DTORS_SECTION_ASM_OP
|
||||
#define DTORS_SECTION_ASM_OP FINI_SECTION_ASM_OP
|
||||
/* Walk the list looking for the terminating zero and ignoring all values of
|
||||
-1. */
|
||||
#undef DO_GLOBAL_DTORS_BODY
|
||||
#define DO_GLOBAL_DTORS_BODY \
|
||||
do { \
|
||||
int i; \
|
||||
for (i = 0; __DTOR_LIST__[i] != 0; i++) \
|
||||
if (((int *)__DTOR_LIST__)[i] != -1) \
|
||||
__DTOR_LIST__[i] (); \
|
||||
} while (0)
|
||||
|
|
|
@ -172,25 +172,25 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|||
unless the specific tm.h file turns it on by defining
|
||||
USE_CONST_SECTION as 1. */
|
||||
|
||||
/* The support for constructors and destructors depends on two
|
||||
machine-specific macros that the individual tm.h file has to define:
|
||||
/* Define a few machine-specific details of the implementation of
|
||||
constructors.
|
||||
|
||||
CTORS_SECTION_ASM_OP should be defined to concatenate
|
||||
the macro INIT_SECTION_ASM_OP, a newline, and a push instruction
|
||||
to push a word containing 0 (or some equivalent of that).
|
||||
The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN
|
||||
and CTOR_LIST_END to contribute to the .init section an instruction to
|
||||
push a word containing 0 (or some equivalent of that).
|
||||
|
||||
ASM_OUTPUT_CONSTRUCTOR should be defined
|
||||
to push the address of the constructor. */
|
||||
Define ASM_OUTPUT_CONSTRUCTOR to push the address of the constructor. */
|
||||
|
||||
#define USE_CONST_SECTION 0
|
||||
|
||||
#define INIT_SECTION_ASM_OP ".section\t.init"
|
||||
#define FINI_SECTION_ASM_OP ".section .fini,\"x\""
|
||||
#define CONST_SECTION_ASM_OP ".section\t.rodata, \"x\""
|
||||
|
||||
#define CTORS_SECTION_ASM_OP INIT_SECTION_ASM_OP
|
||||
#define DTORS_SECTION_ASM_OP FINI_SECTION_ASM_OP
|
||||
/* CTORS_SECTION_ASM_OP is machine-dependent
|
||||
because it pushes on the stack. */
|
||||
|
||||
/* CTOR_LIST_BEGIN and CTOR_LIST_END are machine-dependent
|
||||
because they push on the stack. */
|
||||
|
||||
#define DO_GLOBAL_CTORS_BODY \
|
||||
do { \
|
||||
|
|
|
@ -69,8 +69,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
|
||||
#ifdef INIT_SECTION_ASM_OP
|
||||
|
||||
/* Force cc1 to switch to .text section. */
|
||||
static void force_to_text () { }
|
||||
/* The function __do_global_ctors_aux is compiled twice (once in crtbegin.o
|
||||
and once in crtend.o). It must be declared static to aviod a link
|
||||
error. Here, we define __do_global_ctors as an externally callable
|
||||
function. It is externally callable so that __main can invoke it when
|
||||
INVOKE__main is defined. This has the additional effect of forcing cc1
|
||||
to switch to the .text section. */
|
||||
void __do_global_ctors () { __do_global_ctors_aux (); }
|
||||
|
||||
asm (INIT_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */
|
||||
|
||||
|
@ -90,7 +95,7 @@ asm (INIT_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */
|
|||
file-scope static-storage C++ objects within shared libraries. */
|
||||
|
||||
static void
|
||||
__do_global_ctors () /* prologue goes in .init section */
|
||||
__do_global_ctors_aux () /* prologue goes in .init section */
|
||||
{
|
||||
asm (TEXT_SECTION_ASM_OP); /* don't put epilogue and body in .init */
|
||||
DO_GLOBAL_CTORS_BODY;
|
||||
|
@ -104,11 +109,19 @@ static func_ptr force_to_data[0] = { };
|
|||
|
||||
/* The -1 is a flag to __do_global_[cd]tors
|
||||
indicating that this table does not start with a count of elements. */
|
||||
#ifdef CTOR_LIST_BEGIN
|
||||
CTOR_LIST_BEGIN;
|
||||
#else
|
||||
asm (CTORS_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */
|
||||
func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) };
|
||||
#endif
|
||||
|
||||
#ifdef DTOR_LIST_BEGIN
|
||||
DTOR_LIST_BEGIN;
|
||||
#else
|
||||
asm (DTORS_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */
|
||||
func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) };
|
||||
#endif
|
||||
|
||||
#endif /* defined(CRT_BEGIN) */
|
||||
|
||||
|
@ -129,7 +142,7 @@ func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) };
|
|||
*/
|
||||
|
||||
static void
|
||||
__do_global_ctors () /* prologue goes in .text section */
|
||||
__do_global_ctors_aux () /* prologue goes in .text section */
|
||||
{
|
||||
asm (INIT_SECTION_ASM_OP);
|
||||
DO_GLOBAL_CTORS_BODY;
|
||||
|
@ -141,10 +154,18 @@ __do_global_ctors () /* prologue goes in .text section */
|
|||
/* Force cc1 to switch to .data section. */
|
||||
static func_ptr force_to_data[0] = { };
|
||||
|
||||
#ifdef CTOR_LIST_END
|
||||
CTOR_LIST_END;
|
||||
#else
|
||||
asm (CTORS_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */
|
||||
func_ptr __CTOR_END__[1] = { (func_ptr) 0 };
|
||||
#endif
|
||||
|
||||
#ifdef DTOR_LIST_END
|
||||
DTOR_LIST_END;
|
||||
#else
|
||||
asm (DTORS_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */
|
||||
func_ptr __DTOR_END__[1] = { (func_ptr) 0 };
|
||||
#endif
|
||||
|
||||
#endif /* defined(CRT_END) */
|
||||
|
|
|
@ -1028,7 +1028,7 @@ fixup_var_refs_insns (var, insn, toplevel)
|
|||
|
||||
/* We can not separate USE insns from the CALL_INSN
|
||||
that they belong to. If this is a CALL_INSN, insert
|
||||
the move insn before the USE insns preceeding it
|
||||
the move insn before the USE insns preceding it
|
||||
instead of immediately before the insn. */
|
||||
if (GET_CODE (insn) == CALL_INSN)
|
||||
{
|
||||
|
@ -1904,7 +1904,7 @@ instantiate_decls (fndecl, valid_only)
|
|||
if (DECL_RTL (decl) && GET_CODE (DECL_RTL (decl)) == MEM)
|
||||
instantiate_virtual_regs_1 (&XEXP (DECL_RTL (decl), 0),
|
||||
valid_only ? DECL_RTL (decl) : 0, 0);
|
||||
#if 0 /* This is probably correct, but it seems to require fixes
|
||||
#if 1 /* This is probably correct, but it seems to require fixes
|
||||
elsewhere in order to work. Let's fix them in 2.1. */
|
||||
if (DECL_INCOMING_RTL (decl)
|
||||
&& GET_CODE (DECL_INCOMING_RTL (decl)) == MEM)
|
||||
|
@ -2167,7 +2167,7 @@ instantiate_virtual_regs_1 (loc, object, extra_insns)
|
|||
/* Most cases of MEM that convert to valid addresses have already been
|
||||
handled by our scan of regno_reg_rtx. The only special handling we
|
||||
need here is to make a copy of the rtx to ensure it isn't being
|
||||
shared if we have to change it to a psuedo.
|
||||
shared if we have to change it to a pseudo.
|
||||
|
||||
If the rtx is a simple reference to an address via a virtual register,
|
||||
it can potentially be shared. In such cases, first try to make it
|
||||
|
@ -2778,7 +2778,7 @@ assign_parms (fndecl, second_time)
|
|||
#if 0 /* This change was turned off because it makes compilation bigger. */
|
||||
!optimize
|
||||
#else /* It's not clear why the following was replaced. */
|
||||
/* Obsoleted by preceeding line. */
|
||||
/* Obsoleted by preceding line. */
|
||||
(obey_regdecls && ! TREE_REGDECL (parm)
|
||||
&& ! TREE_INLINE (fndecl))
|
||||
#endif
|
||||
|
@ -3212,6 +3212,12 @@ setjmp_protect (block)
|
|||
|| TREE_CODE (decl) == PARM_DECL)
|
||||
&& DECL_RTL (decl) != 0
|
||||
&& GET_CODE (DECL_RTL (decl)) == REG
|
||||
/* If this variable came from an inline function, it must be
|
||||
that it's life doesn't overlap the setjmp. If there was a
|
||||
setjmp in the function, it would already be in memory. We
|
||||
must exclude such variable because their DECL_RTL might be
|
||||
set to strange things such as virtual_stack_vars_rtx. */
|
||||
&& ! DECL_FROM_INLINE (decl)
|
||||
&& (
|
||||
#ifdef NON_SAVING_SETJMP
|
||||
/* If longjmp doesn't restore the registers,
|
||||
|
@ -3623,10 +3629,10 @@ mark_varargs ()
|
|||
void
|
||||
expand_main_function ()
|
||||
{
|
||||
#ifndef INIT_SECTION_ASM_OP
|
||||
#if !defined (INIT_SECTION_ASM_OP) || defined (INVOKE__main)
|
||||
emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "__main"), 0,
|
||||
VOIDmode, 0);
|
||||
#endif /* not INIT_SECTION_ASM_OP */
|
||||
#endif /* not INIT_SECTION_ASM_OP or INVOKE__main */
|
||||
}
|
||||
|
||||
/* Start the RTL for a new function, and set variables used for
|
||||
|
|
|
@ -29,7 +29,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
do not apply. */
|
||||
|
||||
#include "tm.h"
|
||||
#ifndef L_trampoline
|
||||
#include "gstddef.h"
|
||||
#endif
|
||||
|
||||
/* Don't use `fancy_abort' here even if config.h says to use it. */
|
||||
#ifdef abort
|
||||
|
@ -864,8 +866,13 @@ asm ("__builtin_saveregs:");
|
|||
#endif /* not SVR4 */
|
||||
#else /* not __i860__ */
|
||||
#ifdef __sparc__
|
||||
#ifdef NO_UNDERSCORES
|
||||
asm (".global __builtin_saveregs");
|
||||
asm ("__builtin_saveregs:");
|
||||
#else
|
||||
asm (".global ___builtin_saveregs");
|
||||
asm ("___builtin_saveregs:");
|
||||
#endif
|
||||
asm ("st %i0,[%fp+68]");
|
||||
asm ("st %i1,[%fp+72]");
|
||||
asm ("st %i2,[%fp+76]");
|
||||
|
@ -1219,6 +1226,31 @@ __enable_execute_stack ()
|
|||
asm ("pich");
|
||||
}
|
||||
#endif /* __convex__ */
|
||||
|
||||
#ifdef __pyr__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/vmmac.h>
|
||||
|
||||
/* Modified from the convex -code above.
|
||||
mremap promises to clear the i-cache. */
|
||||
|
||||
void
|
||||
__enable_execute_stack ()
|
||||
{
|
||||
int fp;
|
||||
if (mprotect (((unsigned int)&fp/PAGSIZ)*PAGSIZ, PAGSIZ,
|
||||
PROT_READ|PROT_WRITE|PROT_EXEC))
|
||||
{
|
||||
perror ("mprotect in __enable_execute_stack");
|
||||
fflush (stderr);
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
#endif /* __pyr__ */
|
||||
#endif /* L_trampoline */
|
||||
|
||||
#ifdef L__main
|
||||
|
@ -1271,7 +1303,9 @@ __do_global_ctors ()
|
|||
DO_GLOBAL_CTORS_BODY;
|
||||
ON_EXIT (__do_global_dtors, 0);
|
||||
}
|
||||
#endif /* no INIT_SECTION_ASM_OP */
|
||||
|
||||
#if !defined (INIT_SECTION_ASM_OP) || defined (INVOKE__main)
|
||||
/* Subroutine called automatically by `main'.
|
||||
Compiling a global function named `main'
|
||||
produces an automatic call to this function at the beginning.
|
||||
|
@ -1291,7 +1325,7 @@ __main ()
|
|||
__do_global_ctors ();
|
||||
}
|
||||
}
|
||||
#endif /* no INIT_SECTION_ASM_OP */
|
||||
#endif /* no INIT_SECTION_ASM_OP or INVOKE__main */
|
||||
|
||||
#endif /* L__main */
|
||||
|
||||
|
@ -1306,10 +1340,10 @@ __main ()
|
|||
|
||||
/* We declare the lists here with two elements each,
|
||||
so that they are valid empty lists if no other definition is loaded. */
|
||||
#ifndef INIT_SECTION_ASM_OP
|
||||
#if !defined(INIT_SECTION_ASM_OP) && !defined(CTOR_LISTS_DEFINED_EXTERNALLY)
|
||||
func_ptr __CTOR_LIST__[2];
|
||||
func_ptr __DTOR_LIST__[2];
|
||||
#endif /* INIT_SECTION_ASM_OP */
|
||||
#endif /* no INIT_SECTION_ASM_OP and not CTOR_LISTS_DEFINED_EXTERNALLY */
|
||||
|
||||
#ifndef ON_EXIT
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue