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]

Tidy up arm-elf header files


Hi Guys,

  Fred Fish recently pointed out that the unknown-elf.h in the arm
  config directory was broken.  That has been patched now, but it
  occurred to me that the ELF specific header files in that directory
  ought to be making use of elfos.h rather than defining their own,
  duplicate versions of the same macros.

  So here is a patch that does this.  I have not checked it in yet as
  I do not have the means to test the arm-linux or arm-conix
  configurations.  Richard, Phil can you have a look at this patch and
  tell me if you think that it is OK ?

Cheers
        Nick

2001-08-31  Nick Clifton  <nickc@cambridge.redhat.com>

	* config/arm/aout.h (NO_DOLLAR_IN_LABEL): Only define if not
	already defined.
	(ASM_OUTPUT_ASCII): Protect definition.
	(ASM_OUTPUT_SKIP): Protect definition.
	* config/arm.arm.h (TARGET_MEM_FUNCTIONS): Protect definition.
	(ASM_OUTPUT_CASE_LABEL): Protect definition.
	* config/arm/conix-elf.h: Include elfos.h.
	(USER_LABEL_PREFIX): Remove duplicate definition.
	(LOCAL_LABEL_PREFIX): Remove duplicate definition.
	(READONLY_DATA_SECTION): Remove redundant definition.
	(SUBTARGET_EXTRA_SECTION): Remove redundant definition.
	(SUBTARGET_EXTRA_SECTION_FUNCTION): Remove redundant definition.
	(RDATA_SECTION_ASM_OP): Remove redundant definition.
	(RDATA_SECTION_FUNCTION): Remove redundant definition.
	(TARGET_ASM_NAMED_SECTION): Remove duplicate definition.
	(MAKE_DECL_ONE_ONLY): Remove duplicate definition.
	(UNIQUE_SECTION): Remove duplicate definition.
	(STARTFILE_SPEC): Protect definition.
	(ENDFILE_SPEC): Protect definition.
	* config/arm/unknown-elf.h:
	  as for confix-elf.h
	* config/arm/linux-elf.h:
	  as for confix-elf.h
	* config/arm/elf.h: Test for inclusion of elfos.h
	(USER_LABEL_PREFIX): Remove redundant definition.
	(TYPE_OPERAND_FMT): Protect definition.
	(ASM_DECLARE_RESULT): Remove redundant definition.
	(ASM_DECLARE_FUNCTION_NAME): Protect definition.
	(ASM_DECLARE_RESULT): Remove redundant definition.
	(ASM_DECALRE_OBJECT_NAME): Remove redundant definition.
	(ASM_FINISH_DECALRE_OBJECT_NAME): Remove redundant definition.
	(ASM_DECLARE_FUNCTION_SIZE): Protect definition.
	(ASM_OUTPUT_INTERNAL_LABEL): Protect definition.
	(SUBTARGET_EXTRA_SECTION): Remove redundant definition.
	(SUBTARGET_EXTRA_SECTION_FUNCTION): Remove redundant definition.
	(EXTRA_SECTIONS): Remove redundant definition.
	(INT_ASM_OP): Remove redundant definition.
	(ASM_WEAKEN_LABEL): Remove redundant definition.
	(ASM_OUTPUT_ALIGNED_COMMON): Protect definition.
        
Index: config/arm/aout.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/aout.h,v
retrieving revision 1.18
diff -p -r1.18 aout.h
*** aout.h	2001/07/09 06:09:59	1.18
--- aout.h	2001/08/31 18:57:49
*************** Boston, MA 02111-1307, USA.  */
*** 105,111 ****
--- 105,113 ----
  /* Arm Assembler barfs on dollars */
  #define DOLLARS_IN_IDENTIFIERS 0
  
+ #ifndef NO_DOLLAR_IN_LABEL
  #define NO_DOLLAR_IN_LABEL 1
+ #endif
  
  /* DBX register number for a given compiler register number */
  #define DBX_REGISTER_NUMBER(REGNO)  (REGNO)
*************** Boston, MA 02111-1307, USA.  */
*** 257,266 ****
--- 259,270 ----
  #define ASM_OUTPUT_BYTE(STREAM, VALUE)  	\
    fprintf (STREAM, "\t.byte\t%d\n", VALUE)
  
+ #undef  ASM_OUTPUT_ASCII
  #define ASM_OUTPUT_ASCII(STREAM, PTR, LEN)  \
    output_ascii_pseudo_op (STREAM, (const unsigned char *)(PTR), LEN)
  
  /* Output a gap.  In fact we fill it with nulls.  */
+ #undef  ASM_OUTPUT_SKIP
  #define ASM_OUTPUT_SKIP(STREAM, NBYTES) 	\
    fprintf (STREAM, "\t.space\t%d\n", NBYTES)
  
Index: config/arm/arm.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.h,v
retrieving revision 1.113
diff -p -r1.113 arm.h
*** arm.h	2001/08/18 20:25:50	1.113
--- arm.h	2001/08/31 18:57:56
*************** extern int arm_is_6_or_7;
*** 587,592 ****
--- 587,593 ----
     that is controlled by the APCS-FRAME option.  */
  #define CAN_DEBUG_WITHOUT_FP
  
+ #undef  TARGET_MEM_FUNCTIONS
  #define TARGET_MEM_FUNCTIONS 1
  
  #define OVERRIDE_OPTIONS  arm_override_options ()
*************** extern int making_const_table;
*** 2579,2584 ****
--- 2580,2586 ----
  
  /* This is how to output a label which precedes a jumptable.  Since
     Thumb instructions are 2 bytes, we may need explicit alignment here.  */
+ #undef  ASM_OUTPUT_CASE_LABEL
  #define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE)	\
    do								\
      {								\
Index: config/arm/conix-elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/conix-elf.h,v
retrieving revision 1.8
diff -p -r1.8 conix-elf.h
*** conix-elf.h	2001/08/13 22:05:16	1.8
--- conix-elf.h	2001/08/31 18:57:56
***************
*** 1,6 ****
  /* Definitions of target machine for GNU compiler,
     for ARM with ConiX OS.
!    Copyright (C) 2000 Free Software Foundation, Inc.
     Contributed by Philip Blundell <pb@futuretv.com>
     
  This file is part of GNU CC.
--- 1,6 ----
  /* Definitions of target machine for GNU compiler,
     for ARM with ConiX OS.
!    Copyright (C) 2000, 2001 Free Software Foundation, Inc.
     Contributed by Philip Blundell <pb@futuretv.com>
     
  This file is part of GNU CC.
*************** along with GNU CC; see the file COPYING.
*** 20,25 ****
--- 20,28 ----
  the Free Software Foundation, 59 Temple Place - Suite 330,
  Boston, MA 02111-1307, USA.  */
  
+ /* Get the default ELF definitions and then override as necessary.  */
+ #include "elfos.h"
+ 
  /* Run-time Target Specification.  */
  #ifndef TARGET_VERSION
  #define TARGET_VERSION	fputs (" (ARM/ELF ConiX)", stderr);
*************** Boston, MA 02111-1307, USA.  */
*** 31,112 ****
  #endif
  
  /* Now we define the strings used to build the spec file.  */
  #define STARTFILE_SPEC		"crtbegin%O%s crt0%O%s"
  
  #define ENDFILE_SPEC		"crtend%O%s"
  
- #define USER_LABEL_PREFIX 	""
- #define LOCAL_LABEL_PREFIX 	"."
- 
- #define TEXT_SECTION		"\t.text"
- 
  /* Debugging */
! #define DWARF2_DEBUGGING_INFO
  #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
  
- /* Support for Constructors and Destructors.  */
- #define READONLY_DATA_SECTION	rdata_section
- 
- /* A list of other sections which the compiler might be "in" at any
-    given time.  */
- #define SUBTARGET_EXTRA_SECTIONS in_rdata,
- 
- /* A list of extra section function definitions.  */
- #define SUBTARGET_EXTRA_SECTION_FUNCTIONS	RDATA_SECTION_FUNCTION
-   
- #define RDATA_SECTION_ASM_OP	"\t.section .rodata"
- 
- #define RDATA_SECTION_FUNCTION 					\
- void								\
- rdata_section ()						\
- {								\
-   if (in_section != in_rdata)					\
-     {								\
-       fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP);	\
-       in_section = in_rdata;					\
-     }								\
- }
- 
- /* Switch into a generic section.  */
- #define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
- 
  /* The ARM development system defines __main.  */
! #define NAME__MAIN "__gccmain"
  #define SYMBOL__MAIN __gccmain
- 
- #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
- #define UNIQUE_SECTION(DECL,RELOC)				\
-   do								\
-     {								\
-       int len;							\
-       char * name, * string, * prefix;				\
-       								\
-       name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL));	\
-       								\
-       if (! DECL_ONE_ONLY (DECL))				\
- 	{							\
- 	  prefix = ".";                                         \
- 	  if (TREE_CODE (DECL) == FUNCTION_DECL)		\
- 	    prefix = ".text.";					\
- 	  else if (DECL_READONLY_SECTION (DECL, RELOC))		\
- 	    prefix = ".rodata.";				\
- 	  else							\
- 	    prefix = ".data.";					\
- 	}							\
-       else if (TREE_CODE (DECL) == FUNCTION_DECL)		\
- 	prefix = ".gnu.linkonce.t.";				\
-       else if (DECL_READONLY_SECTION (DECL, RELOC))		\
- 	prefix = ".gnu.linkonce.r.";				\
-       else							\
- 	prefix = ".gnu.linkonce.d.";				\
-       								\
-       len = strlen (name) + strlen (prefix);			\
-       string = alloca (len + 1);				\
-       sprintf (string, "%s%s", prefix, name);			\
-       								\
-       DECL_SECTION_NAME (DECL) = build_string (len, string);	\
-     }								\
-   while (0)
  
  #ifndef CPP_APCS_PC_DEFAULT_SPEC
  #define CPP_APCS_PC_DEFAULT_SPEC	"-D__APCS_32__"
--- 34,52 ----
  #endif
  
  /* Now we define the strings used to build the spec file.  */
+ #undef  STARTFILE_SPEC
  #define STARTFILE_SPEC		"crtbegin%O%s crt0%O%s"
  
+ #undef  ENDFILE_SPEC
  #define ENDFILE_SPEC		"crtend%O%s"
  
  /* Debugging */
! #undef  PREFERRED_DEBUGGING_TYPE
  #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
  
  /* The ARM development system defines __main.  */
! #define NAME__MAIN  "__gccmain"
  #define SYMBOL__MAIN __gccmain
  
  #ifndef CPP_APCS_PC_DEFAULT_SPEC
  #define CPP_APCS_PC_DEFAULT_SPEC	"-D__APCS_32__"
Index: config/arm/elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/elf.h,v
retrieving revision 1.29
diff -p -r1.29 elf.h
*** elf.h	2001/08/09 22:33:21	1.29
--- elf.h	2001/08/31 18:57:56
*************** along with GNU CC; see the file COPYING.
*** 22,38 ****
  the Free Software Foundation, 59 Temple Place - Suite 330,
  Boston, MA 02111-1307, USA.  */
  
! 
! #define OBJECT_FORMAT_ELF
  
  #ifndef LOCAL_LABEL_PREFIX
  #define LOCAL_LABEL_PREFIX "."
  #endif
  
- #ifndef USER_LABEL_PREFIX
- #define USER_LABEL_PREFIX ""
- #endif
- 
  #ifndef SUBTARGET_CPP_SPEC
  #define SUBTARGET_CPP_SPEC  "-D__ELF__"
  #endif
--- 22,35 ----
  the Free Software Foundation, 59 Temple Place - Suite 330,
  Boston, MA 02111-1307, USA.  */
  
! #ifndef OBJECT_FORMAT_ELF
!  #error elf.h included before elfos.h
! #endif
  
  #ifndef LOCAL_LABEL_PREFIX
  #define LOCAL_LABEL_PREFIX "."
  #endif
  
  #ifndef SUBTARGET_CPP_SPEC
  #define SUBTARGET_CPP_SPEC  "-D__ELF__"
  #endif
*************** Boston, MA 02111-1307, USA.  */
*** 58,87 ****
  %(subtarget_extra_asm_spec)"
  #endif
  
! /* The following macro defines the format used to output the second
!    operand of the .type assembler directive.  Different svr4 assemblers
!    expect various different forms for this operand.  The one given here
!    is just a default.  You may need to override it in your machine-
!    specific tm.h file (depending upon the particulars of your assembler).  */
  #define TYPE_OPERAND_FMT	"%s"
  
! /* Write the extra assembler code needed to declare a function's result.
!    Most svr4 assemblers don't require any special declaration of the
!    result value, but there are exceptions.  */
! #ifndef ASM_DECLARE_RESULT
! #define ASM_DECLARE_RESULT(FILE, RESULT)
! #endif
! 
! /* These macros generate the special .type and .size directives which
!    are used to set the corresponding fields of the linker symbol table
!    entries in an ELF object file under SVR4.  These macros also output
!    the starting labels for the relevant functions/objects.  */
! #define TYPE_ASM_OP     "\t.type\t"
! #define SIZE_ASM_OP     "\t.size\t"
! 
! /* Write the extra assembler code needed to declare a function properly.
!    Some svr4 assemblers need to also have something extra said about the
!    function's return value.  We allow for that here.  */
  #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)	\
    do							\
      {							\
--- 55,67 ----
  %(subtarget_extra_asm_spec)"
  #endif
  
! /* The ARM uses @ are a comment character so we need to redefine
!    TYPE_OPERAND_FMT.  */
! #undef  TYPE_OPERAND_FMT
  #define TYPE_OPERAND_FMT	"%s"
  
! /* We might need a ARM specific header to function declarations.  */
! #undef  ASM_DECLARE_FUNCTION_NAME
  #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)	\
    do							\
      {							\
*************** Boston, MA 02111-1307, USA.  */
*** 95,151 ****
        ASM_OUTPUT_LABEL(FILE, NAME);			\
      }							\
    while (0)
- 
- /* Write the extra assembler code needed to declare an object properly.  */
- #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)		\
-   do								\
-     {								\
-       fprintf (FILE, "%s", TYPE_ASM_OP);			\
-       assemble_name (FILE, NAME);				\
-       putc (',', FILE);						\
-       fprintf (FILE, TYPE_OPERAND_FMT, "object");		\
-       putc ('\n', FILE);					\
-       size_directive_output = 0;				\
-       if (!flag_inhibit_size_directive && DECL_SIZE (DECL))	\
-         {							\
- 	  size_directive_output = 1;				\
- 	  fprintf (FILE, "%s", SIZE_ASM_OP);			\
- 	  assemble_name (FILE, NAME);				\
- 	  putc (',', FILE);					\
- 	  fprintf (FILE, HOST_WIDE_INT_PRINT_DEC,		\
- 		   int_size_in_bytes (TREE_TYPE (DECL)));	\
- 	  fputc ('\n', FILE);					\
-         }							\
-       ASM_OUTPUT_LABEL(FILE, NAME);				\
-     }								\
-   while (0)
- 
- /* Output the size directive for a decl in rest_of_decl_compilation
-    in the case where we did not do so before the initializer.
-    Once we find the error_mark_node, we know that the value of
-    size_directive_output was set
-    by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
- #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)	\
-   do									\
-     {									\
-       const char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);		\
-       if (!flag_inhibit_size_directive && DECL_SIZE (DECL)		\
-           && ! AT_END && TOP_LEVEL					\
- 	  && DECL_INITIAL (DECL) == error_mark_node			\
- 	  && !size_directive_output)					\
-         {								\
- 	  size_directive_output = 1;					\
- 	  fprintf (FILE, "%s", SIZE_ASM_OP);				\
- 	  assemble_name (FILE, name);					\
- 	  putc (',', FILE);						\
- 	  fprintf (FILE, HOST_WIDE_INT_PRINT_DEC,			\
- 		  int_size_in_bytes (TREE_TYPE (DECL)));		\
- 	 fputc ('\n', FILE);						\
-         }								\
-     }									\
-   while (0)
  
! /* This is how to declare the size of a function.  */
  #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)		\
    do								\
      {								\
--- 75,83 ----
        ASM_OUTPUT_LABEL(FILE, NAME);			\
      }							\
    while (0)
  
! /* We might need an ARM specific trailer for function declarations.  */
! #undef  ASM_DECLARE_FUNCTION_SIZE
  #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)		\
    do								\
      {								\
*************** Boston, MA 02111-1307, USA.  */
*** 207,213 ****
  #endif
  
  /* Output an internal label definition.  */
! #ifndef ASM_OUTPUT_INTERNAL_LABEL
  #define ASM_OUTPUT_INTERNAL_LABEL(STREAM, PREFIX, NUM)  	\
    do								\
      {								\
--- 139,145 ----
  #endif
  
  /* Output an internal label definition.  */
! #undef  ASM_OUTPUT_INTERNAL_LABEL
  #define ASM_OUTPUT_INTERNAL_LABEL(STREAM, PREFIX, NUM)  	\
    do								\
      {								\
*************** Boston, MA 02111-1307, USA.  */
*** 216,273 ****
        extern rtx arm_target_insn;				\
  								\
        if (arm_ccfsm_state == 3 && arm_target_label == (NUM)	\
! 	&& !strcmp (PREFIX, "L"))				\
  	{							\
  	  arm_ccfsm_state = 0;					\
  	  arm_target_insn = NULL;				\
  	}							\
! 	ASM_GENERATE_INTERNAL_LABEL (s, (PREFIX), (NUM));	\
!         ASM_OUTPUT_LABEL (STREAM, s);		                \
      }								\
    while (0)
- #endif
  
! /* A list of other sections which the compiler might be "in" at any
!    given time.  */
! #ifndef SUBTARGET_EXTRA_SECTIONS
! #define SUBTARGET_EXTRA_SECTIONS
! #endif
! 
! #ifndef EXTRA_SECTIONS
! #define EXTRA_SECTIONS SUBTARGET_EXTRA_SECTIONS
! #endif
! 
! /* A list of extra section function definitions.  */
! #ifndef SUBTARGET_EXTRA_SECTION_FUNCTIONS
! #define SUBTARGET_EXTRA_SECTION_FUNCTIONS
! #endif
! 
! #ifndef EXTRA_SECTION_FUNCTIONS
! #define EXTRA_SECTION_FUNCTIONS 		\
!   SUBTARGET_EXTRA_SECTION_FUNCTIONS
! #endif
! 
! /* Switch into a generic section.  */
! #undef TARGET_ASM_NAMED_SECTION
  #define TARGET_ASM_NAMED_SECTION  arm_elf_asm_named_section
  
! /* Support the ctors/dtors sections for g++.  */
! #ifndef INT_ASM_OP
! #define INT_ASM_OP 	"\t.word\t"
! #endif
! 
! /* This is how we tell the assembler that a symbol is weak.  */
! 
! #define ASM_WEAKEN_LABEL(FILE, NAME)		\
!   do						\
!     {						\
!       fputs ("\t.weak\t", FILE);		\
!       assemble_name (FILE, NAME);		\
!       fputc ('\n', FILE);			\
!     }						\
!   while (0)
! 
! #ifndef ASM_OUTPUT_ALIGNED_COMMON
  #define ASM_OUTPUT_ALIGNED_COMMON(STREAM, NAME, SIZE, ALIGN)	\
    do								\
      {								\
--- 148,167 ----
        extern rtx arm_target_insn;				\
  								\
        if (arm_ccfsm_state == 3 && arm_target_label == (NUM)	\
! 	  && !strcmp (PREFIX, "L"))				\
  	{							\
  	  arm_ccfsm_state = 0;					\
  	  arm_target_insn = NULL;				\
  	}							\
!       ASM_GENERATE_INTERNAL_LABEL (s, (PREFIX), (NUM));		\
!       ASM_OUTPUT_LABEL (STREAM, s);		                \
      }								\
    while (0)
  
! #undef  TARGET_ASM_NAMED_SECTION
  #define TARGET_ASM_NAMED_SECTION  arm_elf_asm_named_section
  
! #undef  ASM_OUTPUT_ALIGNED_COMMON
  #define ASM_OUTPUT_ALIGNED_COMMON(STREAM, NAME, SIZE, ALIGN)	\
    do								\
      {								\
*************** Boston, MA 02111-1307, USA.  */
*** 276,282 ****
        fprintf (STREAM, ", %d, %d\n", SIZE, ALIGN);		\
      }								\
    while (0)
- #endif
  
  /* For PIC code we need to explicitly specify (PLT) and (GOT) relocs.  */
  #define NEED_PLT_RELOC	flag_pic
--- 170,175 ----
Index: config/arm/linux-elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/linux-elf.h,v
retrieving revision 1.27
diff -p -r1.27 linux-elf.h
*** linux-elf.h	2001/08/04 01:31:33	1.27
--- linux-elf.h	2001/08/31 18:57:56
*************** along with this program; see the file CO
*** 20,25 ****
--- 20,28 ----
  the Free Software Foundation, 59 Temple Place - Suite 330,
  Boston, MA 02111-1307, USA.  */
  
+ /* Get the default ELF definitions and then override as necessary.  */
+ #include "elfos.h"
+ 
  /* Run-time Target Specification.  */
  #define TARGET_VERSION  fputs (" (ARM GNU/Linux with ELF)", stderr);
  
*************** Boston, MA 02111-1307, USA.  */
*** 33,48 ****
  	{ "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" }
  #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
  
- /* Handle #pragma weak and #pragma pack.  */
- #define HANDLE_SYSV_PRAGMA
- 
  /* Now we define the strings used to build the spec file.  */
  #define LIB_SPEC \
    "%{shared: -lc} \
     %{!shared: %{pthread:-lpthread} \
     %{profile:-lc_p} %{!profile: -lc}}"
  
- 
  #define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc"
  
  /* Provide a STARTFILE_SPEC appropriate for GNU/Linux.  Here we add
--- 36,47 ----
*************** Boston, MA 02111-1307, USA.  */
*** 50,55 ****
--- 49,55 ----
     provides part of the support for getting C++ file-scope static
     object constructed before entering `main'. */
     
+ #undef  STARTFILE_SPEC
  #define STARTFILE_SPEC \
    "%{!shared: \
       %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
*************** Boston, MA 02111-1307, USA.  */
*** 63,68 ****
--- 63,69 ----
     object constructed before entering `main', followed by a normal
     GNU/Linux "finalizer" file, `crtn.o'.  */
  
+ #undef  ENDFILE_SPEC
  #define ENDFILE_SPEC \
    "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
  
*************** Boston, MA 02111-1307, USA.  */
*** 85,240 ****
  /* Allow #sccs in preprocessor.  */
  #define SCCS_DIRECTIVE
  
- #define USER_LABEL_PREFIX 	""	/* For ELF the default is no underscores */
- #define LOCAL_LABEL_PREFIX 	"."
- 
- #define IDENT_ASM_OP 	"\t.ident\t"
- 
- /* Output #ident as a .ident.  */
- #define ASM_OUTPUT_IDENT(FILE, NAME) \
-   fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME);
- 
- /* Support const sections and the ctors and dtors sections for g++.
-    Note that there appears to be two different ways to support const
-    sections at the moment.  You can either #define the symbol
-    READONLY_DATA_SECTION (giving it some code which switches to the
-    readonly data section) or else you can #define the symbols
-    EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
-    SELECT_RTX_SECTION.  We do both here just to be on the safe side.  */
- #define USE_CONST_SECTION	1
- 
- /* Support for Constructors and Destructors.  */
- #define READONLY_DATA_SECTION() const_section ()
- 
- /* A default list of other sections which we might be "in" at any given
-    time.  For targets that use additional sections (e.g. .tdesc) you
-    should override this definition in the target-specific file which
-    includes this file.  */
- #define SUBTARGET_EXTRA_SECTIONS in_const,
- 
- /* A default list of extra section function definitions.  For targets
-    that use additional sections (e.g. .tdesc) you should override this
-    definition in the target-specific file which includes this file.  */
- #define SUBTARGET_EXTRA_SECTION_FUNCTIONS	CONST_SECTION_FUNCTION
- 
- #define CONST_SECTION_ASM_OP	"\t.section\t.rodata"
- 
- #define CONST_SECTION_FUNCTION						\
- void									\
- const_section ()							\
- {									\
-   if (!USE_CONST_SECTION)						\
-     text_section ();							\
-   else if (in_section != in_const)					\
-     {									\
-       fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP);		\
-       in_section = in_const;						\
-     }									\
- }
- 
- /* Switch into a generic section.  */
- #define TARGET_ASM_NAMED_SECTION  arm_elf_asm_named_section
- 
- /* A C statement or statements to switch to the appropriate
-    section for output of DECL.  DECL is either a `VAR_DECL' node
-    or a constant of some sort.  RELOC indicates whether forming
-    the initial value of DECL requires link-time relocations.  */
- #define SELECT_SECTION(DECL,RELOC)					\
- {									\
-   if (TREE_CODE (DECL) == STRING_CST)					\
-     {									\
-       if (! flag_writable_strings)					\
- 	const_section ();						\
-       else								\
- 	data_section ();						\
-     }									\
-   else if (TREE_CODE (DECL) == VAR_DECL)				\
-     {									\
-       if ((flag_pic && RELOC)						\
- 	  || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)		\
- 	  || !DECL_INITIAL (DECL)					\
- 	  || (DECL_INITIAL (DECL) != error_mark_node			\
- 	      && !TREE_CONSTANT (DECL_INITIAL (DECL))))			\
- 	data_section ();						\
-       else								\
- 	const_section ();						\
-     }									\
-   else									\
-     const_section ();							\
- }
- 
- #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
- #define UNIQUE_SECTION(DECL, RELOC)				\
-   do								\
-     {								\
-       int len;							\
-       char * name;						\
-       char * string;						\
-       char * prefix;						\
- 								\
-       name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL));	\
-       								\
-       if (! DECL_ONE_ONLY (DECL))				\
- 	{							\
- 	  prefix = ".";                                         \
- 	  if (TREE_CODE (DECL) == FUNCTION_DECL)		\
- 	    prefix = ".text.";					\
- 	  else if (DECL_READONLY_SECTION (DECL, RELOC))		\
- 	    prefix = ".rodata.";				\
- 	  else							\
- 	    prefix = ".data.";					\
- 	}							\
-       else if (TREE_CODE (DECL) == FUNCTION_DECL)		\
- 	prefix = ".gnu.linkonce.t.";				\
-       else if (DECL_READONLY_SECTION (DECL, RELOC))		\
- 	prefix = ".gnu.linkonce.r.";				\
-       else							\
- 	prefix = ".gnu.linkonce.d.";				\
-       								\
-       len = strlen (name) + strlen (prefix);			\
-       string = alloca (len + 1);				\
-       sprintf (string, "%s%s", prefix, name);			\
-       								\
-       DECL_SECTION_NAME (DECL) = build_string (len, string);	\
-     }								\
-   while (0)
- 
- /* A C statement or statements to switch to the appropriate
-    section for output of RTX in mode MODE.  RTX is some kind
-    of constant in RTL.  The argument MODE is redundant except
-    in the case of a `const_int' rtx.  Currently, these always
-    go into the const section.  */
- #define SELECT_RTX_SECTION(MODE,RTX) const_section ()
- 
- /* On svr4, we *do* have support for the .init and .fini sections, and we
-    can put stuff in there to be executed before and after `main'.  We let
-    crtstuff.c and other files know this by defining the following symbols.
-    The definitions say how to change sections to the .init and .fini
-    sections.  This is the same for all known svr4 assemblers.  */
- #define INIT_SECTION_ASM_OP	"\t.section\t.init"
- #define FINI_SECTION_ASM_OP	"\t.section\t.fini"
- 
- 
- /* This is how we tell the assembler that a symbol is weak.  */
- #define ASM_WEAKEN_LABEL(FILE,NAME) \
-   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
-        fputc ('\n', FILE); } while (0)
- 
  /* This is how we tell the assembler that two symbols have the same value.  */
! 
! #define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
!   do { assemble_name (FILE, NAME1); 	 \
!        fputs (" = ", FILE);		 \
!        assemble_name (FILE, NAME2);	 \
!        fputc ('\n', FILE); } while (0)
! 
! /* Make DWARF2 an option, but keep DBX as the default for now.
!    Use -gdwarf-2 to turn on DWARF2.  */
! #define DWARF2_DEBUGGING_INFO
! #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
! 
! /* Get the standard ELF stabs definitions.  */
! #include "dbxelf.h"
  
  #include "arm/elf.h"
  #include "arm/linux-gas.h"
--- 86,101 ----
  /* Allow #sccs in preprocessor.  */
  #define SCCS_DIRECTIVE
  
  /* This is how we tell the assembler that two symbols have the same value.  */
! #define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \
!   do					   \
!     {					   \
!       assemble_name (FILE, NAME1); 	   \
!       fputs (" = ", FILE);		   \
!       assemble_name (FILE, NAME2);	   \
!       fputc ('\n', FILE);		   \
!     }					   \
!   while (0)
  
  #include "arm/elf.h"
  #include "arm/linux-gas.h"
Index: config/arm/unknown-elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/unknown-elf.h,v
retrieving revision 1.21
diff -p -r1.21 unknown-elf.h
*** unknown-elf.h	2001/08/31 17:09:58	1.21
--- unknown-elf.h	2001/08/31 18:57:56
*************** along with this program; see the file CO
*** 19,24 ****
--- 19,27 ----
  the Free Software Foundation, 59 Temple Place - Suite 330,
  Boston, MA 02111-1307, USA.  */
  
+ /* Get the default ELF definitions and then override as necessary.  */
+ #include "elfos.h"
+ 
  /* Run-time Target Specification.  */
  #ifndef TARGET_VERSION
  #define TARGET_VERSION	fputs (" (ARM/ELF non-Linux)", stderr);
*************** Boston, MA 02111-1307, USA.  */
*** 30,131 ****
  #endif
  
  /* Now we define the strings used to build the spec file.  */
  #define STARTFILE_SPEC	"crtbegin%O%s crt0%O%s"
  
  #define ENDFILE_SPEC	"crtend%O%s"
  
- #define USER_LABEL_PREFIX 	""
- #define LOCAL_LABEL_PREFIX 	"."
- 
- #define TEXT_SECTION_ASM_OP 	"\t.text"
- #define INIT_SECTION_ASM_OP	"\t.section\t.init"
- #define FINI_SECTION_ASM_OP	"\t.section\t.fini"
- 
  #define INVOKE__main
  
! /* Debugging */
! #define DWARF_DEBUGGING_INFO
! #define DWARF2_DEBUGGING_INFO
  #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
  
- /* Support for Constructors and Destrcutors .  */
- #define READONLY_DATA_SECTION	rdata_section
- 
- /* A list of other sections which the compiler might be "in" at any
-    given time.  */
- #define SUBTARGET_EXTRA_SECTIONS in_rdata
- 
- /* A list of extra section function definitions.  */
- #define SUBTARGET_EXTRA_SECTION_FUNCTIONS	RDATA_SECTION_FUNCTION
-   
- #define RDATA_SECTION_ASM_OP	"\t.section .rodata"
- 
- #define RDATA_SECTION_FUNCTION 					\
- void rdata_section PARAMS ((void));				\
- 								\
- void								\
- rdata_section ()						\
- {								\
-   if (in_section != in_rdata)					\
-     {								\
-       fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP);	\
-       in_section = in_rdata;					\
-     }								\
- }
- 
- /* Switch into a generic section.  */
- #define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
- 
  /* The ARM development system defines __main.  */
! #define NAME__MAIN "__gccmain"
  #define SYMBOL__MAIN __gccmain
  
  /* Return a non-zero value if DECL has a section attribute.  */
  #define IN_NAMED_SECTION(DECL)						\
    ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL)	\
     && DECL_SECTION_NAME (DECL) != NULL_TREE)
- 
- #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
- 
- #define UNIQUE_SECTION(DECL, RELOC)					\
-   do									\
-     {									\
-       int len;								\
-       int sec;								\
-       const char * name;						\
-       char * string;							\
-       char * prefix;							\
-       static char * prefixes[4][2] =					\
-       {									\
- 	{ ".text.",   ".gnu.linkonce.t." },				\
- 	{ ".rodata.", ".gnu.linkonce.r." },				\
- 	{ ".data.",   ".gnu.linkonce.d." },				\
-         { ".bss.",    ".gnu.linkonce.b." }				\
-       };								\
-       									\
-       if (TREE_CODE (DECL) == FUNCTION_DECL)				\
- 	sec = 0;							\
-       else if (DECL_READONLY_SECTION (DECL, RELOC))			\
- 	sec = 1;							\
-       else if (DECL_INITIAL (DECL) == NULL_TREE)			\
- 	sec = 3;							\
-       else								\
- 	sec = 2;							\
-       									\
-       prefix = prefixes[sec][DECL_ONE_ONLY(DECL)];			\
-       name   = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL));		\
-       									\
-       /* Strip off any encoding in name.  */				\
-       STRIP_NAME_ENCODING (name, name);					\
- 									\
-       len    = strlen (name) + strlen (prefix);				\
-       string = alloca (len + 1);					\
-       									\
-       sprintf (string, "%s%s", prefix, name);				\
-       									\
-       DECL_SECTION_NAME (DECL) = build_string (len, string);		\
-     }									\
-   while (0)
  
  #undef  ASM_OUTPUT_ALIGNED_BSS
  #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)   	\
--- 33,57 ----
  #endif
  
  /* Now we define the strings used to build the spec file.  */
+ #undef  STARTFILE_SPEC
  #define STARTFILE_SPEC	"crtbegin%O%s crt0%O%s"
  
+ #undef  ENDFILE_SPEC
  #define ENDFILE_SPEC	"crtend%O%s"
  
  #define INVOKE__main
  
! #undef  PREFERRED_DEBUGGING_TYPE
  #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
  
  /* The ARM development system defines __main.  */
! #define NAME__MAIN  "__gccmain"
  #define SYMBOL__MAIN __gccmain
  
  /* Return a non-zero value if DECL has a section attribute.  */
  #define IN_NAMED_SECTION(DECL)						\
    ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL)	\
     && DECL_SECTION_NAME (DECL) != NULL_TREE)
  
  #undef  ASM_OUTPUT_ALIGNED_BSS
  #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)   	\


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