This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: change DJGPP to use crt*.o.


The revision of the crtstuff patch makes neccessary revising this one to add a 
define for CRTSTUFF_USE_FINI_SECTION.

gcc/ChangeLog:

1999-08-18 Mark Elbrecht <snowball3@bigfoot.com>

* configure.in (extra_objects): Define.
* config/i386/djgpp.h (CTORS_SECTION_ASM_OP): Define.
  (DTORS_SECTION_ASM_OP): Define.
  (INIT_SECTION_ASM_OP): Define.
  (FINI_SECTION_ASM_OP): Define.
  (DATA_SECTION_ASM_OP): Define.
  (TEXT_SECTION_ASM_OP): Define.
  (EH_FRAME_SECTION_ASM_OP): Define.
  (STARTFILE_SPEC): Add crtbegin.o.
  (ENDFILE_SPEC): Define and add crtend.o.
  (DO_GLOBAL_CTORS_BODY): Define.
  (CRTSTUFF_USE_FINI_SECTION): Define
  (HAS_INIT_SECTION): Delete.

* config/i386/djgpp.h: Always undefine a macro before defining it.

*** gcc/configure.in.orig	Tue Aug 17 11:07:50 1999
--- gcc/configure.in	Tue Aug 17 12:39:40 1999
*************** changequote([,])dnl
*** 1358,1365 ****
--- 1358,1366 ----
  		xmake_file=i386/x-djgpp
  		gnu_ld=yes
  		gas=yes
  		exeext=.exe
+ 		extra_parts="crtbegin.o crtend.o"
  		case $host in *pc-msdosdjgpp*)
  			target_alias=djgpp
  			;;
  		esac
*** gcc/config/i386/djgpp.h.orig	Wed Aug 11 04:03:44 1999
--- gcc/config/i386/djgpp.h	Wed Aug 18 09:42:32 1999
*************** Boston, MA 02111-1307, USA.  */
*** 32,53 ****
  #define YES_UNDERSCORES
  
  #include "i386/gas.h"
  
  /* If defined, a C expression whose value is a string containing the
     assembler operation to identify the following data as
     uninitialized global data.  If not defined, and neither
     `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
     uninitialized global data will be output in the data section if
     `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
     used.  */
  #undef BSS_SECTION_ASM_OP
! #define BSS_SECTION_ASM_OP "\t.section\t.bss"
  
  /* Enable alias attribute support.  */
! #ifndef SET_ASM_OP
  #define SET_ASM_OP "\t.set"
! #endif
  
  /* Search for as.exe and ld.exe in DJGPP's binary directory. */ 
  #define MD_EXEC_PREFIX "$DJDIR/bin/"
  
--- 32,80 ----
  #define YES_UNDERSCORES
  
  #include "i386/gas.h"
  
+ /* Define the name of the .text section.  */
+ #undef TEXT_SECTION_ASM_OP
+ #define TEXT_SECTION_ASM_OP "\t.section .text"
+ 
+ /* Define the name of the .data section.  */
+ #undef DATA_SECTION_ASM_OP
+ #define DATA_SECTION_ASM_OP "\t.section .data"
+ 
  /* If defined, a C expression whose value is a string containing the
     assembler operation to identify the following data as
     uninitialized global data.  If not defined, and neither
     `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
     uninitialized global data will be output in the data section if
     `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
     used.  */
  #undef BSS_SECTION_ASM_OP
! #define BSS_SECTION_ASM_OP "\t.section .bss"
! 
! /* Define the name of the .ctor section.  */
! #undef CTORS_SECTION_ASM_OP
! #define CTORS_SECTION_ASM_OP    "\t.section .ctor"
! 
! /* Define the name of the .data section.  */
! #undef DTORS_SECTION_ASM_OP
! #define DTORS_SECTION_ASM_OP    "\t.section .dtor"
  
  /* Enable alias attribute support.  */
! #undef SET_ASM_OP
  #define SET_ASM_OP "\t.set"
! 
! /* Define the name of the .init section.  */
! #undef INIT_SECTION_ASM_OP
! #define INIT_SECTION_ASM_OP "\t.section .init"
! 
! /* Define the name of the .fini section.  */
! #undef FINI_SECTION_ASM_OP
! #define FINI_SECTION_ASM_OP "\t.section .fini"
! 
! /* Define the name of the .eh_frame section.  */
! #undef EH_FRAME_SECTION_ASM_OP
! #define EH_FRAME_SECTION_ASM_OP "\t.section .eh_frame"
  
  /* Search for as.exe and ld.exe in DJGPP's binary directory. */ 
  #define MD_EXEC_PREFIX "$DJDIR/bin/"
  
*************** Boston, MA 02111-1307, USA.  */
*** 86,94 ****
  #define LIB_SPEC "-lc"
  
  /* Pick the right startup code depending on the -pg flag.  */
  #undef STARTFILE_SPEC
! #define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:crt0.o%s}"
  
  /* Make sure that gcc will not look for .h files in /usr/local/include 
     unless user explicitly requests it.  */
  #undef LOCAL_INCLUDE_DIR
--- 113,126 ----
  #define LIB_SPEC "-lc"
  
  /* Pick the right startup code depending on the -pg flag.  */
  #undef STARTFILE_SPEC
! #define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:crt0.o%s} crtbegin.o%s"
! 
! /* Link in crtbegin.o and crtend.o for calling functions with the
!    constructor and destructor attribute.  */
! #undef ENDFILE_SPEC
! #define ENDFILE_SPEC "crtend.o%s"
  
  /* Make sure that gcc will not look for .h files in /usr/local/include 
     unless user explicitly requests it.  */
  #undef LOCAL_INCLUDE_DIR
*************** Boston, MA 02111-1307, USA.  */
*** 100,107 ****
--- 132,140 ----
  #define EXTRA_SECTION_FUNCTIONS					\
    CTOR_SECTION_FUNCTION						\
    DTOR_SECTION_FUNCTION
  
+ #undef CTOR_SECTION_FUCTION
  #define CTOR_SECTION_FUNCTION					\
  void								\
  ctor_section ()							\
  {								\
*************** ctor_section ()							\
*** 111,118 ****
--- 144,152 ----
        in_section = in_ctor;					\
      }								\
  }
  
+ #undef DTOR_SECTION_FUNCTION
  #define DTOR_SECTION_FUNCTION					\
  void								\
  dtor_section ()							\
  {								\
*************** dtor_section ()							\
*** 122,129 ****
--- 156,164 ----
        in_section = in_dtor;					\
      }								\
  }
  
+ #undef ASM_OUTPUT_CONSTRUCTOR
  #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)	\
    do {						\
      ctor_section ();				\
      fprintf (FILE, "%s\t", ASM_LONG);		\
*************** dtor_section ()							\
*** 131,143 ****
--- 166,180 ----
      fprintf (FILE, "\n");			\
    } while (0)
  
  /* Allow (eg) __attribute__((section "locked")) to work */
+ #undef ASM_OUTPUT_SECTION_NAME
  #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC)\
    do {						\
      fprintf (FILE, "\t.section %s\n", NAME);	\
    } while (0)
  
+ #undef ASM_OUTPUT_DESTRUCTOR
  #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)	\
    do {						\
      dtor_section ();                   		\
      fprintf (FILE, "%s\t", ASM_LONG);		\
*************** dtor_section ()							\
*** 170,176 ****
  /* djgpp has atexit ().  */
  #undef HAVE_ATEXIT
  #define HAVE_ATEXIT
  
! /* djgpp automatically calls its own version of __main, so don't define one
!    in libgcc, nor call one in main().  */
! #define HAS_INIT_SECTION
--- 207,222 ----
  /* djgpp has atexit ().  */
  #undef HAVE_ATEXIT
  #define HAVE_ATEXIT
  
! /* Define how DJGPP calls function pointers in the .ctor section.  */
! #undef DO_GLOBAL_CTORS_BODY
! #define DO_GLOBAL_CTORS_BODY						\
!   do {									\
!     func_ptr *p;								\
!     for (p = __CTOR_LIST__ + 1; *p ; p++)				\
!       (*p) ();								\
!   } while (0)
! 
! /* Use the .fini section for destructors.  */
! #define CRTSTUFF_USE_FINI_SECTION
! 

--- 
Mark Elbrecht, snowball3@bigfoot.com
http://snowball.frogspace.net/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]