use crtstuff.c on alpha

Richard Henderson rth@redhat.com
Sat Jan 26 20:51:00 GMT 2002


The main point of this patch is to get Alpha using crtstuff.c,
so that we can include <link.h>, so that we can determine if
the version of glibc in use supports PT_GNU_EH_FRAME.

In the process, I cleaned up crtstuff.c a bit -- removing 3
undocumented macros and documenting one that stayed.  It is 
now built with optimization on as well, which should reduce
the startup cost of constructors marginally.

Tested on alphaev6-linux, i686-linux, and cris-elf.


r~


	* Makefile.in (CRTSTUFF_CFLAGS): New.
	(crtbegin.o, crtend.o, crtbeginS.o, crtendS.o, crtbeginT.o): Use it.
	* config.gcc (alpha-linux, alpha-freebsd, alpha-netbsd): Use plain
	crtstuff.c instead of alpha assembly version.
	* crtstuff.c (CRT_CALL_STATIC_FUNCTION): Rewrite to assume the
	entire dummy function sequence.  Use FORCE_CODE_SECTION_ALIGN
	not FORCE_{INIT,FINI}_SECTION_ALIGN.
	(__do_global_dtors_aux): Mark used.
	(frame_dummy, __do_global_ctors_aux): Mark used.
	(fini_dummy, init_dummy): Remove.

	* config/alpha/crtbegin.asm: Remove file.
	* config/alpha/crtend.asm: Remove file.
	* config/alpha/t-crtbe: Remove file.
	* config/alpha/elf.h (CRT_CALL_STATIC_FUNCTION): New.
	(LINK_EH_SPEC): New.

	* config/cris/cris.h (CRT_CALL_STATIC_FUNCTION): Rewrite old
	FORCE_INIT_SECTION_ALIGN hack.  Register __fini_start before
	calling constructors.
	* config/cris/linux.h (CRT_CALL_STATIC_FUNCTION): Undef.

	* config/i386/i386.h (CRT_CALL_STATIC_FUNCTION): New.
	* config/i386/linux.h (CRT_CALL_STATIC_FUNCTION): Replace old
	CRT_END_INIT_DUMMY hack.
	* config/i386/sol2.h (FORCE_CODE_SECTION_ALIGN): Replace
	FORCE_{INIT,FINI}_SECTION_ALIGN.

	* config/mcore/mcore-elf.h (FORCE_CODE_SECTION_ALIGN): Replace
	FORCE_{INIT,FINI}_SECTION_ALIGN.

	* config/s390/s390.h (CRT_CALL_STATIC_FUNCTION): Update for new
	invocation sequence.
	* config/sh/sh.h (CRT_CALL_STATIC_FUNCTION): Likewise.

	* doc/tm.texi (CRT_CALL_STATIC_FUNCTION): Update.
	(FORCE_CODE_SECTION_ALIGN): New.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.824
diff -c -p -d -r1.824 Makefile.in
*** Makefile.in	2002/01/25 23:46:13	1.824
--- Makefile.in	2002/01/27 03:56:14
*************** LIBGCC2_INCLUDES =
*** 370,375 ****
--- 370,379 ----
  # Additional target-dependent options for compiling libgcc2.a.
  TARGET_LIBGCC2_CFLAGS =
  
+ # Options to use when compiling crtbegin/end.
+ CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
+   -finhibit-size-directive -fno-inline-functions -fno-exceptions
+ 
  # Additional sources to handle exceptions; overridden on ia64.
  LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \
    $(srcdir)/unwind-sjlj.c
*************** stmp-multilib: $(LIBGCC_DEPS)
*** 1067,1108 ****
  # constructors.
  $(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
    gbl-ctors.h stmp-int-hdrs tsystem.h
! 	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
! 	  -finhibit-size-directive -fno-inline-functions \
! 	  -fno-exceptions $(CRTSTUFF_T_CFLAGS) @inhibit_libc@ \
! 	  -c $(srcdir)/crtstuff.c -DCRT_BEGIN -o $(T)crtbegin$(objext)
  
  $(T)crtend.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
    gbl-ctors.h stmp-int-hdrs tsystem.h
! 	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
! 	  -finhibit-size-directive -fno-inline-functions \
! 	  -fno-exceptions $(CRTSTUFF_T_CFLAGS) @inhibit_libc@ \
! 	  -c $(srcdir)/crtstuff.c -DCRT_END -o $(T)crtend$(objext)
  
  # These are versions of crtbegin and crtend for shared libraries.
  $(T)crtbeginS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
    gbl-ctors.h stmp-int-hdrs tsystem.h
! 	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
! 	  -finhibit-size-directive -fno-inline-functions \
! 	  -fno-exceptions $(CRTSTUFF_T_CFLAGS_S) @inhibit_libc@ \
! 	  -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O \
  	  -o $(T)crtbeginS$(objext)
  
  $(T)crtendS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
    gbl-ctors.h stmp-int-hdrs tsystem.h
! 	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
! 	  -finhibit-size-directive -fno-inline-functions \
! 	  -fno-exceptions $(CRTSTUFF_T_CFLAGS_S) @inhibit_libc@ \
! 	  -c $(srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O \
  	  -o $(T)crtendS$(objext)
  
  # This is a version of crtbegin for -static links.
  $(T)crtbeginT.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
    gbl-ctors.h stmp-int-hdrs tsystem.h
! 	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
! 	  -finhibit-size-directive -fno-inline-functions \
! 	  -fno-exceptions $(CRTSTUFF_T_CFLAGS) @inhibit_libc@ \
! 	  -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \
  	  -o $(T)crtbeginT$(objext)
  
  # Compile the start modules crt0.o and mcrt0.o that are linked with
--- 1071,1104 ----
  # constructors.
  $(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
    gbl-ctors.h stmp-int-hdrs tsystem.h
! 	$(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
! 	  @inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_BEGIN \
! 	  -o $(T)crtbegin$(objext)
  
  $(T)crtend.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
    gbl-ctors.h stmp-int-hdrs tsystem.h
! 	$(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
! 	  @inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_END \
! 	  -o $(T)crtend$(objext)
  
  # These are versions of crtbegin and crtend for shared libraries.
  $(T)crtbeginS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
    gbl-ctors.h stmp-int-hdrs tsystem.h
! 	$(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
! 	  @inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O \
  	  -o $(T)crtbeginS$(objext)
  
  $(T)crtendS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
    gbl-ctors.h stmp-int-hdrs tsystem.h
! 	$(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
! 	  @inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O \
  	  -o $(T)crtendS$(objext)
  
  # This is a version of crtbegin for -static links.
  $(T)crtbeginT.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
    gbl-ctors.h stmp-int-hdrs tsystem.h
! 	$(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
! 	  @inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \
  	  -o $(T)crtbeginT$(objext)
  
  # Compile the start modules crt0.o and mcrt0.o that are linked with
Index: config.gcc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.153
diff -c -p -d -r1.153 config.gcc
*** config.gcc	2002/01/26 01:23:25	1.153
--- config.gcc	2002/01/27 03:56:14
*************** alpha*-*-linux*ecoff*)
*** 461,467 ****
  alpha*-*-linux*libc1*)
  	tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
  	target_cpu_default="MASK_GAS"
! 	tmake_file="t-slibgcc-elf-ver t-linux t-linux-gnulibc1 alpha/t-alpha alpha/t-crtbe alpha/t-crtfm alpha/t-ieee"
  	gas=yes gnu_ld=yes
  	if test x$enable_threads = xyes; then
  		thread_file='posix'
--- 461,468 ----
  alpha*-*-linux*libc1*)
  	tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
  	target_cpu_default="MASK_GAS"
! 	tmake_file="t-slibgcc-elf-ver t-linux t-linux-gnulibc1 alpha/t-alpha alpha/t-crtfm alpha/t-ieee"
! 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o"
  	gas=yes gnu_ld=yes
  	if test x$enable_threads = xyes; then
  		thread_file='posix'
*************** alpha*-*-linux*libc1*)
*** 470,476 ****
  alpha*-*-linux*)
  	tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
  	target_cpu_default="MASK_GAS"
! 	tmake_file="t-slibgcc-elf-ver t-linux alpha/t-crtbe alpha/t-crtfm alpha/t-alpha alpha/t-ieee"
  	gas=yes gnu_ld=yes
  	if test x$enable_threads = xyes; then
  		thread_file='posix'
--- 471,478 ----
  alpha*-*-linux*)
  	tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
  	target_cpu_default="MASK_GAS"
! 	tmake_file="t-slibgcc-elf-ver t-linux alpha/t-crtfm alpha/t-alpha alpha/t-ieee"
! 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o"
  	gas=yes gnu_ld=yes
  	if test x$enable_threads = xyes; then
  		thread_file='posix'
*************** alpha*-*-linux*)
*** 479,490 ****
  alpha*-*-freebsd*)
  	tm_file="${tm_file} ${fbsd_tm_file} alpha/elf.h alpha/freebsd.h"
  	target_cpu_default="MASK_GAS"
! 	tmake_file="${tmake_file} alpha/t-crtbe alpha/t-crtfm alpha/t-alpha alpha/t-ieee"
  	;;
  alpha*-*-netbsd*)
  	tm_file="${tm_file} netbsd.h alpha/elf.h netbsd-elf.h alpha/netbsd.h"
  	target_cpu_default="MASK_GAS"
! 	tmake_file="${tmake_file} alpha/t-alpha alpha/t-crtbe alpha/t-ieee"
  	;;
  
  alpha*-*-openbsd*)
--- 481,494 ----
  alpha*-*-freebsd*)
  	tm_file="${tm_file} ${fbsd_tm_file} alpha/elf.h alpha/freebsd.h"
  	target_cpu_default="MASK_GAS"
! 	tmake_file="${tmake_file} alpha/t-crtfm alpha/t-alpha alpha/t-ieee"
! 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o"
  	;;
  alpha*-*-netbsd*)
  	tm_file="${tm_file} netbsd.h alpha/elf.h netbsd-elf.h alpha/netbsd.h"
  	target_cpu_default="MASK_GAS"
! 	tmake_file="${tmake_file} alpha/t-alpha alpha/t-ieee"
! 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o"
  	;;
  
  alpha*-*-openbsd*)
Index: crtstuff.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/crtstuff.c,v
retrieving revision 1.52
diff -c -p -d -r1.52 crtstuff.c
*** crtstuff.c	2002/01/25 11:22:52	1.52
--- crtstuff.c	2002/01/27 03:56:14
***************
*** 1,7 ****
  /* Specialized bits of code needed to support construction and
     destruction of file-scope objects in C++ code.
     Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998,
!    1999, 2000, 2001 Free Software Foundation, Inc.
     Contributed by Ron Guilmette (rfg@monkeys.com).
  
  This file is part of GCC.
--- 1,7 ----
  /* Specialized bits of code needed to support construction and
     destruction of file-scope objects in C++ code.
     Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998,
!    1999, 2000, 2001, 2002 Free Software Foundation, Inc.
     Contributed by Ron Guilmette (rfg@monkeys.com).
  
  This file is part of GCC.
*************** Software Foundation, 59 Temple Place - S
*** 62,69 ****
  #include "tsystem.h"
  #include "unwind-dw2-fde.h"
  
  #ifndef CRT_CALL_STATIC_FUNCTION
! # define CRT_CALL_STATIC_FUNCTION(func) func ()
  #endif
  
  #if defined(OBJECT_FORMAT_ELF) && defined(HAVE_LD_EH_FRAME_HDR) \
--- 62,81 ----
  #include "tsystem.h"
  #include "unwind-dw2-fde.h"
  
+ #ifndef FORCE_CODE_SECTION_ALIGN
+ # define FORCE_CODE_SECTION_ALIGN
+ #endif
+ 
  #ifndef CRT_CALL_STATIC_FUNCTION
! # define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
! static void __attribute__((__used__))			\
! call_ ## FUNC (void)					\
! {							\
!   asm (SECTION_OP);					\
!   FUNC ();						\
!   FORCE_CODE_SECTION_ALIGN				\
!   asm (TEXT_SECTION_ASM_OP);				\
! }
  #endif
  
  #if defined(OBJECT_FORMAT_ELF) && defined(HAVE_LD_EH_FRAME_HDR) \
*************** extern void __cxa_finalize (void *) TARG
*** 237,247 ****
     the list we left off processing, and we resume at that point,
     should we be re-invoked.  */
  
! static void
  __do_global_dtors_aux (void)
  {
    static func_ptr *p = __DTOR_LIST__ + 1;
!   static int completed;
    func_ptr f;
  
    if (__builtin_expect (completed, 0))
--- 249,259 ----
     the list we left off processing, and we resume at that point,
     should we be re-invoked.  */
  
! static void __attribute__((used))
  __do_global_dtors_aux (void)
  {
    static func_ptr *p = __DTOR_LIST__ + 1;
!   static _Bool completed;
    func_ptr f;
  
    if (__builtin_expect (completed, 0))
*************** __do_global_dtors_aux (void)
*** 273,298 ****
    completed = 1;
  }
  
- 
  /* Stick a call to __do_global_dtors_aux into the .fini section.  */
! 
! static void __attribute__ ((__unused__))
! fini_dummy (void)
! {
!   asm (FINI_SECTION_ASM_OP);
!   CRT_CALL_STATIC_FUNCTION (__do_global_dtors_aux);
! #ifdef FORCE_FINI_SECTION_ALIGN
!   FORCE_FINI_SECTION_ALIGN;
! #endif
!   asm (TEXT_SECTION_ASM_OP);
! }
  
  #if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME)
  /* Stick a call to __register_frame_info into the .init section.  For some
     reason calls with no arguments work more reliably in .init, so stick the
     call in another function.  */
  
! static void
  frame_dummy (void)
  {
  #ifdef USE_EH_FRAME_REGISTRY
--- 285,299 ----
    completed = 1;
  }
  
  /* Stick a call to __do_global_dtors_aux into the .fini section.  */
! CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux)
  
  #if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME)
  /* Stick a call to __register_frame_info into the .init section.  For some
     reason calls with no arguments work more reliably in .init, so stick the
     call in another function.  */
  
! static void __attribute__((used))
  frame_dummy (void)
  {
  #ifdef USE_EH_FRAME_REGISTRY
*************** frame_dummy (void)
*** 322,337 ****
  #endif /* JCR_SECTION_NAME */
  }
  
! static void __attribute__ ((__unused__))
! init_dummy (void)
! {
!   asm (INIT_SECTION_ASM_OP);
!   CRT_CALL_STATIC_FUNCTION (frame_dummy);
! #ifdef FORCE_INIT_SECTION_ALIGN
!   FORCE_INIT_SECTION_ALIGN;
! #endif
!   asm (TEXT_SECTION_ASM_OP);
! }
  #endif /* EH_FRAME_SECTION_NAME || JCR_SECTION_NAME */
  
  #else  /* OBJECT_FORMAT_ELF */
--- 323,329 ----
  #endif /* JCR_SECTION_NAME */
  }
  
! CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, frame_dummy)
  #endif /* EH_FRAME_SECTION_NAME || JCR_SECTION_NAME */
  
  #else  /* OBJECT_FORMAT_ELF */
*************** asm (INIT_SECTION_ASM_OP);	/* cc1 doesn'
*** 373,384 ****
     such a thing) so that we can properly perform the construction of
     file-scope static-storage C++ objects within shared libraries.  */
  
! static void
  __do_global_ctors_aux (void)	/* prologue goes in .init section */
  {
! #ifdef FORCE_INIT_SECTION_ALIGN
!   FORCE_INIT_SECTION_ALIGN;	/* Explicit align before switch to .text */
! #endif
    asm (TEXT_SECTION_ASM_OP);	/* don't put epilogue and body in .init */
    DO_GLOBAL_CTORS_BODY;
    atexit (__do_global_dtors);
--- 365,374 ----
     such a thing) so that we can properly perform the construction of
     file-scope static-storage C++ objects within shared libraries.  */
  
! static void __attribute__((used))
  __do_global_ctors_aux (void)	/* prologue goes in .init section */
  {
!   FORCE_CODE_SECTION_ALIGN	/* explicit align before switch to .text */
    asm (TEXT_SECTION_ASM_OP);	/* don't put epilogue and body in .init */
    DO_GLOBAL_CTORS_BODY;
    atexit (__do_global_dtors);
*************** STATIC void *__JCR_END__[1] 
*** 486,493 ****
  #ifdef INIT_SECTION_ASM_OP
  
  #ifdef OBJECT_FORMAT_ELF
! 
! static void
  __do_global_ctors_aux (void)
  {
    func_ptr *p;
--- 476,482 ----
  #ifdef INIT_SECTION_ASM_OP
  
  #ifdef OBJECT_FORMAT_ELF
! static void __attribute__((used))
  __do_global_ctors_aux (void)
  {
    func_ptr *p;
*************** __do_global_ctors_aux (void)
*** 496,516 ****
  }
  
  /* Stick a call to __do_global_ctors_aux into the .init section.  */
! 
! static void __attribute__ ((__unused__))
! init_dummy (void)
! {
!   asm (INIT_SECTION_ASM_OP);
!   CRT_CALL_STATIC_FUNCTION (__do_global_ctors_aux);
! #ifdef FORCE_INIT_SECTION_ALIGN
!   FORCE_INIT_SECTION_ALIGN;
! #endif
!   asm (TEXT_SECTION_ASM_OP);
! #ifdef CRT_END_INIT_DUMMY
!   CRT_END_INIT_DUMMY;
! #endif
! }
! 
  #else  /* OBJECT_FORMAT_ELF */
  
  /* Stick the real initialization code, followed by a normal sort of
--- 485,491 ----
  }
  
  /* Stick a call to __do_global_ctors_aux into the .init section.  */
! CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, __do_global_ctors_aux)
  #else  /* OBJECT_FORMAT_ELF */
  
  /* Stick the real initialization code, followed by a normal sort of
*************** __do_global_ctors_aux (void)	/* prologue
*** 542,551 ****
    atexit (__do_global_dtors);
  }				/* epilogue and body go in .init section */
  
! #ifdef FORCE_INIT_SECTION_ALIGN
! FORCE_INIT_SECTION_ALIGN;
! #endif
! 
  asm (TEXT_SECTION_ASM_OP);
  
  #endif /* OBJECT_FORMAT_ELF */
--- 517,523 ----
    atexit (__do_global_dtors);
  }				/* epilogue and body go in .init section */
  
! FORCE_CODE_SECTION_ALIGN
  asm (TEXT_SECTION_ASM_OP);
  
  #endif /* OBJECT_FORMAT_ELF */
Index: config/alpha/crtbegin.asm
===================================================================
RCS file: crtbegin.asm
diff -N crtbegin.asm
*** /sourceware/cvs-tmp/cvsniFafu	Sat Jan 26 19:56:18 2002
--- /dev/null	Tue May  5 13:32:27 1998
***************
*** 1,228 ****
- /*
-  * Copyright (C) 1996, 1998, 2000 Free Software Foundation, Inc.
-  *  Contributed by Richard Henderson (rth@tamu.edu)
-  *
-  * This file is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU General Public License as published by the
-  * Free Software Foundation; either version 2, or (at your option) any
-  * later version.
-  * 
-  * In addition to the permissions in the GNU General Public License, the
-  * Free Software Foundation gives you unlimited permission to link the
-  * compiled version of this file with other programs, and to distribute
-  * those programs without any restriction coming from the use of this
-  * file.  (The General Public License restrictions do apply in other
-  * respects; for example, they cover modification of the file, and
-  * distribution when not linked into another program.)
-  * 
-  * This file is distributed in the hope that it will be useful, but
-  * WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-  * General Public License for more details.
-  * 
-  * You should have received a copy of the GNU General Public License
-  * along with this program; see the file COPYING.  If not, write to
-  * the Free Software Foundation, 59 Temple Place - Suite 330,
-  * Boston, MA 02111-1307, USA.
-  * 
-  *    As a special exception, if you link this library with files
-  *    compiled with GCC to produce an executable, this does not cause
-  *    the resulting executable to be covered by the GNU General Public License.
-  *    This exception does not however invalidate any other reasons why
-  *    the executable file might be covered by the GNU General Public License.
-  */
- 
- #include "auto-host.h"
- 
- 
- /*
-  * Heads of the constructor/destructor lists.
-  */
- 
- /* The __*TOR_LIST__ symbols are not global because when this file is used
-    in a shared library, we do not want the symbol to fall over to the
-    application's lists.  */
- 
- .section .ctors,"aw"
- 	.align 3
- __CTOR_LIST__:
- 	.quad	-1
- 
- .section .dtors,"aw"
- 	.align 3
- __DTOR_LIST__:
- 	.quad	-1
- 
- .section .jcr,"aw"
- 	.align 3
- __JCR_LIST__:
- 
- .section .eh_frame,"aw"
- __EH_FRAME_BEGIN__:
- 
- /*
-  * Fragment of the ELF _fini routine that invokes our dtor cleanup.
-  */
- 
- .section .fini,"ax"
- 
- 	/* Since the bits of the _fini function are spread across many
- 	   object files, each potentially with its own GP, we must
- 	   assume we need to load ours.  Further, our .fini section
- 	   can easily be more than 4MB away from our .text bits so we
- 	   can't use bsr.  */
- 
- 	br      $29,1f
- 1:	ldgp    $29,0($29)
- 	jsr     $26,__do_global_dtors_aux
- 
- 	/* Must match the alignment we got from crti.o else we get
- 	   zero-filled holes in our _fini function and then SIGILL.  */
- 	.align 3
- 
- /*
-  * Fragment of the ELF _init routine that sets up the frame info.
-  */
- 
- .section .init,"ax"
-        br      $29,1f
- 1:     ldgp    $29,0($29)
-        jsr     $26,__do_frame_setup
-        .align 3
- 
- /*
-  * Invoke our destructors in order.
-  */
- 
- .section .sdata
- 
- /* Support recursive calls to exit.  */
- 	.type dtor_ptr,@object
- 	.size dtor_ptr,4
- dtor_ptr:
- 	.gprel32 __DTOR_LIST__ + 8
- 
- /* A globally unique widget for c++ local destructors to hang off.
- 
-    This has a unique value in every dso; in the main program its
-    value is zero.  The object should be protected.  This means the
-    instance in any dso or the main program is not used in any other
-    dso.  The dynamic linker takes care of this.  */
-  
- 	.global __dso_handle
- 	.type __dso_handle,@object
- 	.size __dso_handle,8
- #ifdef SHARED
- .section .data
- 	.align 3
- __dso_handle:
- 	.quad	__dso_handle
- #else
- .section .bss
- 	.align 3
- __dso_handle:
- 	.zero 8
- #endif
- #ifdef HAVE_GAS_HIDDEN
- 	.hidden	__dso_handle
- #endif
- 
- .text
- 
- 	.align 3
- 	.ent __do_global_dtors_aux
- 
- __do_global_dtors_aux:
- 	ldgp	$29,0($27)
- 	lda     $30,-16($30)
- 	.frame  $30,16,$26,0
- 	stq	$9,8($30)
- 	stq     $26,0($30)
- 	.mask   0x4000200,-16
- 	.prologue 1
- 
- #ifdef SHARED
- 	/* Do c++ local destructors.  */
- 	lda	$1,__cxa_finalize
- 	beq	$1,0f
- 	lda	$16,__dso_handle
- 	jsr	$26,__cxa_finalize
- 	ldgp	$29,0($26)
- #endif
- 
- 0:	lda     $9,dtor_ptr
- 	br      2f
- 1:	stl	$1,0($9)
- 	jsr     $26,($27)
- 	ldgp	$29,0($26)
- 2:	ldl	$1,0($9)
- 	addq	$1,$29,$2
- 	ldq     $27,0($2)
- 	addl    $1,8,$1
- 	bne     $27,1b
- 
- 	/* Remove our frame info.  */
- 	lda	$1,__deregister_frame_info
- 	beq	$1,3f
- 	lda	$16,__EH_FRAME_BEGIN__
- 	jsr	$26,__deregister_frame_info
- 	ldgp	$29,0($26)
- 
- 3:	ldq     $26,0($30)
- 	ldq	$9,8($30)
- 	lda     $30,16($30)
- 	ret
- 
- 	.end __do_global_dtors_aux
- 
- /*
-  * Install our frame info; register java classes, if any.
-  */
- 
- .section .bss
- 	.type frame_object,@object
- 	.size frame_object, 48
- 	.align 3
- frame_object:
- 	.zero 48
- 
- .text 
- 
- 	.align 3
- 	.ent __do_frame_setup
- 
- __do_frame_setup:
- 	ldgp	$29,0($27)
- 	lda     $30,-16($30)
- 	.frame  $30,16,$26,0
- 	stq     $26,0($30)
- 	.mask   0x4000000,-16
- 	.prologue 1
- 
- 	lda	$1,__register_frame_info
- 	beq	$1,0f
- 	lda	$16,__EH_FRAME_BEGIN__
- 	lda	$17,frame_object
- 	jsr	$26,__register_frame_info
- 	ldgp	$29,0($26)
- 
- 0:	lda	$1,_Jv_RegisterClasses
- 	lda	$16,__JCR_LIST__
- 	beq	$1,0f
- 	ldq	$2,8($16)
- 	beq	$2,0f
- 	jsr	$26,_Jv_RegisterClasses
- 	ldgp	$29,0($26)
- 
- 0:	ldq     $26,0($30)
- 	lda     $30,16($30)
- 	ret
- 
- 	.end __do_frame_setup
- 
- .weak __register_frame_info
- .weak __deregister_frame_info
- #ifdef SHARED
- .weak __cxa_finalize
- #endif
- .weak _Jv_RegisterClasses
--- 0 ----
Index: config/alpha/crtend.asm
===================================================================
RCS file: crtend.asm
diff -N crtend.asm
*** /sourceware/cvs-tmp/cvsgnqVYo	Sat Jan 26 19:56:18 2002
--- /dev/null	Tue May  5 13:32:27 1998
***************
*** 1,113 ****
- /*
-  * Copyright (C) 1996, 2000 Free Software Foundation, Inc.
-  *  Contributed by Richard Henderson (rth@tamu.edu)
-  *
-  * This file is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU General Public License as published by the
-  * Free Software Foundation; either version 2, or (at your option) any
-  * later version.
-  * 
-  * In addition to the permissions in the GNU General Public License, the
-  * Free Software Foundation gives you unlimited permission to link the
-  * compiled version of this file with other programs, and to distribute
-  * those programs without any restriction coming from the use of this
-  * file.  (The General Public License restrictions do apply in other
-  * respects; for example, they cover modification of the file, and
-  * distribution when not linked into another program.)
-  * 
-  * This file is distributed in the hope that it will be useful, but
-  * WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-  * General Public License for more details.
-  * 
-  * You should have received a copy of the GNU General Public License
-  * along with this program; see the file COPYING.  If not, write to
-  * the Free Software Foundation, 59 Temple Place - Suite 330,
-  * Boston, MA 02111-1307, USA.
-  * 
-  *    As a special exception, if you link this library with files
-  *    compiled with GCC to produce an executable, this does not cause
-  *    the resulting executable to be covered by the GNU General Public License.
-  *    This exception does not however invalidate any other reasons why
-  *    the executable file might be covered by the GNU General Public License.
-  */
- 
- /*
-  * Tails of the constructor/destructor lists.
-  */
- 
- /* The __*TOR_END__ symbols are not global because when this file is used
-    in a shared library, we do not want the symbol to fall over to the
-    application's lists.  */
- 
- .section .ctors,"aw"
- 	.align 3
- __CTOR_END__:
- 	.quad   0
- 
- .section .dtors,"aw"
- 	.align 3
- __DTOR_END__:
- 	.quad   0
- 
- .section .jcr,"aw"
- 	.align 3
- __JCR_END__:
- 	.quad	0
- 
- .section .eh_frame,"aw"
- __FRAME_END__:
- 	.quad	0
- 
- /*
-  * Fragment of the ELF _init routine that invokes our ctor startup
-  */
- 
- .section .init,"ax"
- 
- 	/* Since the bits of the _init function are spread across many
- 	   object files, each potentially with its own GP, we must
- 	   assume we need to load ours.  Further, our .init section
- 	   can easily be more than 4MB away from our .text bits so we
- 	   can't use bsr.  */
- 
- 	br      $29,1f
- 1:	ldgp    $29,0($29)
- 	jsr     $26,__do_global_ctors_aux
- 
- 	/* Must match the alignment we got from crti.o else we get
- 	   zero-filled holes in our _init function and thense SIGILL.  */
- 	.align 3
- 
- /*
-  * Invoke our constructors in order.
-  */
- 
- .text
- 
- 	.align 3
- 	.ent __do_global_ctors_aux
- 
- __do_global_ctors_aux:
- 	ldgp	$29,0($27)
- 	lda     $30,-16($30)
- 	.frame  $30,16,$26,0
- 	stq     $9,8($30)
- 	stq     $26,0($30)
- 	.mask   0x4000200,-16
- 	.prologue 1
- 
- 	lda     $9,__CTOR_END__-8
- 	br      1f
- 0:	jsr     $26,($27)
- 1:	ldq     $27,0($9)
- 	subq    $9,8,$9
- 	not     $27,$0
- 	bne     $0,0b
- 
- 	ldq     $26,0($30)
- 	ldq     $9,8($30)
- 	lda     $30,16($30)
- 	ret
- 
- 	.end __do_global_ctors_aux
--- 0 ----
Index: config/alpha/elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/elf.h,v
retrieving revision 1.48
diff -c -p -d -r1.48 elf.h
*** config/alpha/elf.h	2001/12/17 15:05:26	1.48
--- config/alpha/elf.h	2002/01/27 03:56:14
***************
*** 1,5 ****
  /* Definitions of target machine for GNU compiler, for DEC Alpha w/ELF.
!    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
     Free Software Foundation, Inc.
     Contributed by Richard Henderson (rth@tamu.edu).
  
--- 1,5 ----
  /* Definitions of target machine for GNU compiler, for DEC Alpha w/ELF.
!    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
     Free Software Foundation, Inc.
     Contributed by Richard Henderson (rth@tamu.edu).
  
*************** do {									\
*** 642,644 ****
--- 642,666 ----
    alpha_this_gpdisp_sequence_number = 0)
  extern int alpha_this_literal_sequence_number;
  extern int alpha_this_gpdisp_sequence_number;
+ 
+ /* Since the bits of the _init and _fini function is spread across
+    many object files, each potentially with its own GP, we must assume
+    we need to load our GP.  Further, the .init/.fini section can
+    easily be more than 4MB away from the function to call so we can't
+    use bsr.  */
+ #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
+    asm (SECTION_OP "\n"					\
+ "	br $29,1f\n"					\
+ "1:	ldgp $29,0($29)\n"				\
+ "	unop\n"						\
+ "	jsr $26," USER_LABEL_PREFIX #FUNC "\n"		\
+ "	.align 3\n"					\
+ "	.previous");
+ 
+ /* If we have the capability create headers for efficient EH lookup.
+    As of Jan 2002, only glibc 2.2.4 can actually make use of this, but
+    I imagine that other systems will catch up.  In the meantime, it
+    doesn't harm to make sure that the data exists to be used later.  */
+ #if defined(HAVE_LD_EH_FRAME_HDR)
+ #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+ #endif
Index: config/alpha/t-crtbe
===================================================================
RCS file: t-crtbe
diff -N t-crtbe
*** /sourceware/cvs-tmp/cvs6ucI8l	Sat Jan 26 19:56:18 2002
--- /dev/null	Tue May  5 13:32:27 1998
***************
*** 1,14 ****
- # Effectively disable the crtbegin/end rules using crtstuff.c
- T = disable
- 
- EXTRA_PARTS += crtbegin.o crtend.o crtbeginS.o crtendS.o
- 
- # Assemble startup files.
- crtbegin.o: $(srcdir)/config/alpha/crtbegin.asm $(GCC_PASSES)
- 	$(GCC_FOR_TARGET) -c -o crtbegin.o -x assembler-with-cpp -I. $(srcdir)/config/alpha/crtbegin.asm
- crtend.o: $(srcdir)/config/alpha/crtend.asm $(GCC_PASSES)
- 	$(GCC_FOR_TARGET) -c -o crtend.o -x assembler-with-cpp -I. $(srcdir)/config/alpha/crtend.asm
- crtbeginS.o: $(srcdir)/config/alpha/crtbegin.asm $(GCC_PASSES)
- 	$(GCC_FOR_TARGET) -DSHARED -c -o crtbeginS.o -x assembler-with-cpp -I. $(srcdir)/config/alpha/crtbegin.asm
- crtendS.o: $(srcdir)/config/alpha/crtend.asm $(GCC_PASSES)
- 	$(GCC_FOR_TARGET) -DSHARED -c -o crtendS.o -x assembler-with-cpp -I. $(srcdir)/config/alpha/crtend.asm
--- 0 ----
Index: config/cris/cris.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/cris/cris.h,v
retrieving revision 1.21
diff -c -p -d -r1.21 cris.h
*** config/cris/cris.h	2002/01/08 22:51:25	1.21
--- config/cris/cris.h	2002/01/27 03:56:14
*************** struct cum_args {int regs;};
*** 1451,1464 ****
  /* We pull a little trick to register the _fini function with atexit,
     after (presumably) registering the eh frame info, since we don't handle
     _fini (a.k.a. ___fini_start) in crt0 or have a crti for "pure" ELF.  */
! #ifdef CRT_BEGIN
! #define FORCE_INIT_SECTION_ALIGN		\
!  do						\
!    {						\
!      extern void __fini__start (void);		\
!      atexit (__fini__start);			\
!    }						\
!  while (0)
  #endif
  
  /* Node: PIC */
--- 1451,1470 ----
  /* We pull a little trick to register the _fini function with atexit,
     after (presumably) registering the eh frame info, since we don't handle
     _fini (a.k.a. ___fini_start) in crt0 or have a crti for "pure" ELF.  */
! #ifdef CRT_END
! # define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)		\
! static void __attribute__((__used__))				\
! call_ ## FUNC (void)						\
! {								\
!   asm (SECTION_OP);						\
!   if (__builtin_strcmp (#FUNC, "__do_global_ctors_aux") == 0)	\
!    {								\
!      extern void __fini__start (void);				\
!      atexit (__fini__start);					\
!    }								\
!   FUNC ();							\
!   asm (TEXT_SECTION_ASM_OP);					\
! }
  #endif
  
  /* Node: PIC */
Index: config/cris/linux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/cris/linux.h,v
retrieving revision 1.2
diff -c -p -d -r1.2 linux.h
*** config/cris/linux.h	2001/10/31 19:50:59	1.2
--- config/cris/linux.h	2002/01/27 03:56:14
*************** Boston, MA 02111-1307, USA.  */
*** 102,109 ****
  /* Node: Sections */
  
  /* GNU/Linux has crti and crtn and does not need the
!    FORCE_INIT_SECTION_ALIGN trick in cris.h.  */
! #undef FORCE_INIT_SECTION_ALIGN
  
  /*
   * Local variables:
--- 102,109 ----
  /* Node: Sections */
  
  /* GNU/Linux has crti and crtn and does not need the
!    CRT_CALL_STATIC_FUNCTION trick in cris.h.  */
! #undef CRT_CALL_STATIC_FUNCTION
  
  /*
   * Local variables:
Index: config/i386/i386.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
retrieving revision 1.238
diff -c -p -d -r1.238 i386.h
*** config/i386/i386.h	2002/01/16 02:37:25	1.238
--- config/i386/i386.h	2002/01/27 03:56:15
*************** extern int const svr4_dbx_register_map[F
*** 2911,2916 ****
--- 2911,2924 ----
  
  #define ASM_SIMPLIFY_DWARF_ADDR(X) \
    i386_simplify_dwarf_addr (X)
+ 
+ /* Switch to init or fini section via SECTION_OP, emit a call to FUNC,
+    and switch back.  For x86 we do this only to save a few bytes that
+    would otherwise be unused in the text section.  */
+ #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
+    asm (SECTION_OP "\n\t"				\
+ 	"call " USER_LABEL_PREFIX #FUNC "\n"		\
+ 	TEXT_SECTION_ASM_OP);
  
  /* Print operand X (an rtx) in assembler syntax to file FILE.
     CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
Index: config/i386/linux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/linux.h,v
retrieving revision 1.33
diff -c -p -d -r1.33 linux.h
*** config/i386/linux.h	2001/12/18 15:41:10	1.33
--- config/i386/linux.h	2002/01/27 03:56:15
***************
*** 1,5 ****
  /* Definitions for Intel 386 running Linux-based GNU systems with ELF format.
!    Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
     Contributed by Eric Youngdale.
     Modified for stabs-in-ELF by H.J. Lu.
  
--- 1,6 ----
  /* Definitions for Intel 386 running Linux-based GNU systems with ELF format.
!    Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002
!    Free Software Foundation, Inc.
     Contributed by Eric Youngdale.
     Modified for stabs-in-ELF by H.J. Lu.
  
*************** Boston, MA 02111-1307, USA.  */
*** 167,186 ****
  
  #if defined(__PIC__) && defined (USE_GNULIBC_1)
  /* This is a kludge. The i386 GNU/Linux dynamic linker needs ___brk_addr,
!    __environ and atexit (). We have to make sure they are in the .dynsym
!    section. We accomplish it by making a dummy call here. This
!    code is never reached.  */
!          
! #define CRT_END_INIT_DUMMY		\
!   do					\
!     {					\
!       extern void *___brk_addr;		\
!       extern char **__environ;		\
! 					\
!       ___brk_addr = __environ;		\
!       atexit (0);			\
!     }					\
!   while (0)
  #endif
  
  /* Handle special EH pointer encodings.  Absolute, pc-relative, and
--- 168,187 ----
  
  #if defined(__PIC__) && defined (USE_GNULIBC_1)
  /* This is a kludge. The i386 GNU/Linux dynamic linker needs ___brk_addr,
!    __environ and atexit.  We have to make sure they are in the .dynsym
!    section.  We do this by forcing the assembler to create undefined 
!    references to these symbols in the object file.  */
! #undef CRT_CALL_STATIC_FUNCTION
! #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
!    asm (SECTION_OP "\n\t"				\
! 	"call " USER_LABEL_PREFIX #FUNC "\n"		\
! 	TEXT_SECTION_ASM_OP "\n\t"			\
! 	".extern ___brk_addr\n\t"			\
! 	".type ___brk_addr,@object\n\t"			\
! 	".extern __environ\n\t"				\
! 	".type __environ,@object\n\t"			\
! 	".extern atexit\n\t"				\
! 	".type atexit,@function");
  #endif
  
  /* Handle special EH pointer encodings.  Absolute, pc-relative, and
Index: config/i386/sol2.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/sol2.h,v
retrieving revision 1.18
diff -c -p -d -r1.18 sol2.h
*** config/i386/sol2.h	2001/12/17 15:05:33	1.18
--- config/i386/sol2.h	2002/01/27 03:56:15
***************
*** 1,5 ****
  /* Target definitions for GNU compiler for Intel 80386 running Solaris 2
!    Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001
     Free Software Foundation, Inc.
     Contributed by Fred Fish (fnf@cygnus.com).
  
--- 1,5 ----
  /* Target definitions for GNU compiler for Intel 80386 running Solaris 2
!    Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
     Free Software Foundation, Inc.
     Contributed by Fred Fish (fnf@cygnus.com).
  
*************** Boston, MA 02111-1307, USA.  */
*** 56,64 ****
     two 0x00000090 ints, which generates a segmentation violation when
     executed.  This macro forces the assembler to do the padding, since
     it knows what it is doing.  */
! 
! #define FORCE_INIT_SECTION_ALIGN asm (ALIGN_ASM_OP ## "16")
! #define FORCE_FINI_SECTION_ALIGN FORCE_INIT_SECTION_ALIGN
  
  /* Select a format to encode pointers in exception handling data.  CODE
     is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
--- 56,62 ----
     two 0x00000090 ints, which generates a segmentation violation when
     executed.  This macro forces the assembler to do the padding, since
     it knows what it is doing.  */
! #define FORCE_CODE_SECTION_ALIGN  asm(ALIGN_ASM_OP "16");
  
  /* Select a format to encode pointers in exception handling data.  CODE
     is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
Index: config/mcore/mcore-elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mcore/mcore-elf.h,v
retrieving revision 1.8
diff -c -p -d -r1.8 mcore-elf.h
*** config/mcore/mcore-elf.h	2001/12/17 15:05:34	1.8
--- config/mcore/mcore-elf.h	2002/01/27 03:56:15
***************
*** 1,5 ****
  /* Definitions of MCore target. 
!    Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
     Contributed by Cygnus Solutions.
  
  This file is part of GNU CC.
--- 1,5 ----
  /* Definitions of MCore target. 
!    Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
     Contributed by Cygnus Solutions.
  
  This file is part of GNU CC.
*************** exports_section ()						\
*** 158,168 ****
  #undef  ENDFILE_SPEC
  #define ENDFILE_SPEC  "%{!mno-lsim:-lsim} crtend.o%s crtn.o%s"
  
- 
  /* The subroutine calls in the .init and .fini sections create literal
     pools which must be jumped around...  */
! #define FORCE_INIT_SECTION_ALIGN	asm ("br 1f ; .literals ; 1:")
! #define FORCE_FINI_SECTION_ALIGN	asm ("br 1f ; .literals ; 1:")
  
  #undef  CTORS_SECTION_ASM_OP
  #define CTORS_SECTION_ASM_OP	"\t.section\t.ctors,\"aw\""
--- 158,166 ----
  #undef  ENDFILE_SPEC
  #define ENDFILE_SPEC  "%{!mno-lsim:-lsim} crtend.o%s crtn.o%s"
  
  /* The subroutine calls in the .init and .fini sections create literal
     pools which must be jumped around...  */
! #define FORCE_CODE_SECTION_ALIGN	asm ("br 1f ; .literals ; 1:");
  
  #undef  CTORS_SECTION_ASM_OP
  #define CTORS_SECTION_ASM_OP	"\t.section\t.ctors,\"aw\""
Index: config/s390/s390.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.h,v
retrieving revision 1.18
diff -c -p -d -r1.18 s390.h
*** config/s390/s390.h	2002/01/16 02:37:33	1.18
--- config/s390/s390.h	2002/01/27 03:56:15
*************** extern struct rtx_def *s390_compare_op0,
*** 1299,1313 ****
  /* S/390 constant pool breaks the devices in crtstuff.c to control section
     in where code resides.  We have to write it as asm code.  */
  #ifndef __s390x__
! #define CRT_CALL_STATIC_FUNCTION(func) \
!   if (0) \
!      func (); /* ... to avoid warnings.  */ \
!   else \
!     asm \
!       ("bras\t%%r2,1f\n\
! 0:	.long\t" #func " - 0b\n\
  1:	l\t%%r3,0(%%r2)\n\
! 	bas\t%%r14,0(%%r3,%%r2)" : : : "2", "3", "cc", "memory");
  #endif
  
  /* Constant Pool for all symbols operands which are changed with
--- 1299,1311 ----
  /* S/390 constant pool breaks the devices in crtstuff.c to control section
     in where code resides.  We have to write it as asm code.  */
  #ifndef __s390x__
! #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
!     asm (SECTION_OP "\n\
! 	bras\t%%r2,1f\n\
! 0:	.long\t" USER_LABEL_PREFIX #FUNC " - 0b\n\
  1:	l\t%%r3,0(%%r2)\n\
! 	bas\t%%r14,0(%%r3,%%r2)\n\
! 	.previous");
  #endif
  
  /* Constant Pool for all symbols operands which are changed with
Index: config/sh/sh.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.h,v
retrieving revision 1.127
diff -c -p -d -r1.127 sh.h
*** config/sh/sh.h	2002/01/16 02:37:34	1.127
--- config/sh/sh.h	2002/01/27 03:56:15
*************** extern struct rtx_def *fpscr_rtx;
*** 2301,2321 ****
  
  /* SH constant pool breaks the devices in crtstuff.c to control section
     in where code resides.  We have to write it as asm code.  */
! #define CRT_CALL_STATIC_FUNCTION(func) \
!   if (0) \
!      /* This avoids warnings about the static function being unused.  */ \
!      func (); \
!   else \
!     /* We should be passing FUNC to the asm statement as an asm input	\
!        operand, but this breaks with -fPIC.  FIXME.  */			\
!     asm \
!       ("mov.l	1f,r1\n\
  	mova	2f,r0\n\
  	braf	r1\n\
  	lds	r0,pr\n\
  0:	.p2align 2\n\
! 1:	.long	" USER_LABEL_PREFIX #func " - 0b\n\
! 2:")
  
  #define ALLOCATE_INITIAL_VALUE(hard_reg) \
    (REGNO (hard_reg) == PR_REG \
--- 2301,2315 ----
  
  /* SH constant pool breaks the devices in crtstuff.c to control section
     in where code resides.  We have to write it as asm code.  */
! #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
!    asm (SECTION_OP "\n\
! 	mov.l	1f,r1\n\
  	mova	2f,r0\n\
  	braf	r1\n\
  	lds	r0,pr\n\
  0:	.p2align 2\n\
! 1:	.long	" USER_LABEL_PREFIX #FUNC " - 0b\n\
! 2:\n" TEXT_SECTION_ASM_OP);
  
  #define ALLOCATE_INITIAL_VALUE(hard_reg) \
    (REGNO (hard_reg) == PR_REG \
Index: doc/tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.92
diff -c -p -d -r1.92 tm.texi
*** doc/tm.texi	2002/01/23 17:30:28	1.92
--- doc/tm.texi	2002/01/27 03:56:16
*************** finalization code.  If not defined, GCC 
*** 5458,5472 ****
  not exist.
  
  @findex CRT_CALL_STATIC_FUNCTION
! @item CRT_CALL_STATIC_FUNCTION
! If defined, a C statement that calls the function named as the sole
! argument of this macro.  This is used in @file{crtstuff.c} if
! @code{INIT_SECTION_ASM_OP} or @code{FINI_SECTION_ASM_OP} to calls to
! initialization and finalization functions from the init and fini
! sections.  By default, this macro is a simple function call.  Some
  ports need hand-crafted assembly code to avoid dependencies on
  registers initialized in the function prologue or to ensure that
  constant pools don't end up too far way in the text section.
  
  @findex EXTRA_SECTIONS
  @findex in_text
--- 5458,5480 ----
  not exist.
  
  @findex CRT_CALL_STATIC_FUNCTION
! @item CRT_CALL_STATIC_FUNCTION (@var{section_op}, @var{function})
! If defined, an ASM statement that switches to a different section
! via @var{section_op}, calls @var{function}, and switches back to
! the text section.  This is used in @file{crtstuff.c} if
! @code{INIT_SECTION_ASM_OP} or @code{FINI_SECTION_ASM_OP} to calls
! to initialization and finalization functions from the init and fini
! sections.  By default, this macro uses a simple function call.  Some
  ports need hand-crafted assembly code to avoid dependencies on
  registers initialized in the function prologue or to ensure that
  constant pools don't end up too far way in the text section.
+ 
+ @findex FORCE_CODE_SECTION_ALIGN
+ @item FORCE_CODE_SECTION_ALIGN
+ If defined, an ASM statement that aligns a code section to some
+ arbitrary boundary.  This is used to force all fragments of the
+ @code{.init} and @code{.fini} sections to have to same alignment
+ and thus prevent the linker from having to add any padding.
  
  @findex EXTRA_SECTIONS
  @findex in_text



More information about the Gcc-patches mailing list