From a9acd81a68caccd25639017b16f7e596d908bae4 Mon Sep 17 00:00:00 2001 From: nickc Date: Fri, 14 Sep 2001 10:19:30 +0000 Subject: [PATCH] Rearrange arm/elf header files git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45594 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 47 ++++++++++ gcc/config.gcc | 18 ++-- gcc/config/arm/aout.h | 4 + gcc/config/arm/arm.h | 8 ++ gcc/config/arm/conix-elf.h | 95 ++------------------ gcc/config/arm/crti.asm | 70 +++++++++++++++ gcc/config/arm/crtn.asm | 81 +++++++++++++++++ gcc/config/arm/ecos-elf.h | 5 +- gcc/config/arm/elf.h | 139 ++++-------------------------- gcc/config/arm/linux-elf.h | 177 +++++--------------------------------- gcc/config/arm/linux-gas.h | 20 +---- gcc/config/arm/rtems-elf.h | 10 +-- gcc/config/arm/semi.h | 6 ++ gcc/config/arm/strongarm-elf.h | 3 +- gcc/config/arm/t-arm-elf | 13 ++- gcc/config/arm/t-strongarm-elf | 14 ++- gcc/config/arm/t-xscale-elf | 12 ++- gcc/config/arm/uclinux-elf.h | 4 +- gcc/config/arm/unknown-elf-oabi.h | 10 +-- gcc/config/arm/unknown-elf.h | 101 +++------------------- gcc/config/arm/xscale-elf.h | 4 +- 21 files changed, 328 insertions(+), 513 deletions(-) create mode 100644 gcc/config/arm/crti.asm create mode 100644 gcc/config/arm/crtn.asm diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1152607..de15375 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,50 @@ +2001-09-14 Nick Clifton + + * config.gcc: Move inclusion of arm elf specific header files + from the files themselves into the tm_file variable. Make + sure that elfos.h is included before target specific elf + headers. + * config/arm/aout.h (NO_DOLLAR_IN_LABEL): Only define if not + already defined. + (ASM_OUTPUT_ASCII, ASM_OUTPUT_SKIP): Protect definition. + * config/arm.arm.h (TARGET_MEM_FUNCTIONS, + ASM_OUTPUT_CASE_LABEL): Protect definition. + (CC1_SPEC, FP_DEFAULT, ARM_FUNCTION_PROFILE): Only define if + not already defined. + * config/arm/conix-elf.h: (USER_LABEL_PREFIX, + LOCAL_LABEL_PREFIX, MAKE_DECL_ONE_ONLY, UNIQUE_SECTION): + Remove duplicate definition. + (READONLY_DATA_SECTION, SUBTARGET_EXTRA_SECTION, + (SUBTARGET_EXTRA_SECTION_FUNCTION, RDATA_SECTION_ASM_OP, + (RDATA_SECTION_FUNCTION): Remove redundant definition. + (STARTFILE_SPEC, ENDFILE_SPEC): Protect definition. + Remove inclusion of arm/elf.h. + * config/arm/unknown-elf.h: as for conix-elf.h. + (STARTFILE_SPEC): Include crti.o and crtn.o. + * config/arm/linux-elf.h: as for conix-elf.h. + * config/arm/ecos-elf.h: Remove inclusion of unknown-elf.h. + * config/arm/strongarm-elf.h: Remove inclusion of + unknown-elf.h. + * config/arm/xscale-elf.h: Remove inclusion of unknown-elf.h. + * config/arm/unknown-elf-oabi.h: Remove inclusion of + unknown-elf.h and elf.h. + * config/arm/uclinux-elf.h: Remove inclusion of linux-elf.h. + * config/arm/linux-gas.h (DBX_DEBUGGING_INFO, + ASM_WEAKEN_LABEL): Remove redundant definition. + * config/arm/elf.h: Test for inclusion of elfos.h + (USER_LABEL_PREFIX, ASM_DECLARE_RESULT, ASM_DECLARE_RESULT, + ASM_DECLARE_OBJECT_NAME, ASM_FINISH_DECLARE_OBJECT_NAME, + SUBTARGET_EXTRA_SECTION, SUBTARGET_EXTRA_SECTION_FUNCTION, + EXTRA_SECTIONS, INT_ASM_OP, ASM_WEAKEN_LABEL): Remove + redundant definition. + (TYPE_OPERAND_FMT, ASM_DECLARE_FUNCTION_NAME, + ASM_DECLARE_FUNCTION_SIZE, ASM_OUTPUT_INTERNAL_LABEL, + ASM_OUTPUT_ALIGNED_COMMON): Protect definition. + * t-arm-elf (EXTRA_MULTILIB_PARTS): Add crti.o and crtn.o. + Add rules to build crti.o and crtn.o + * crti.asm: New file. + * crtn.asm: New file. + 2001-09-13 Neil Booth * c-parse.in (_yylex): Use _cpp_backup_tokens. diff --git a/gcc/config.gcc b/gcc/config.gcc index 00ed9b3..dc731f7 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -531,7 +531,7 @@ arc-*-elf*) extra_parts="crtinit.o crtfini.o" ;; arm*-*-rtems*) - tm_file=arm/rtems-elf.h + tm_file="elfos.h arm/unknown-elf.h arm/elf.h arm/rtems-elf.h rtems.h" tmake_file="arm/t-arm-elf t-rtems" if test x$enable_threads = xyes; then thread_file='rtems' @@ -576,7 +576,7 @@ arm*-*-netbsd*) ;; arm*-*-linux*) # ARM GNU/Linux with ELF xmake_file=x-linux - tm_file="arm/linux-elf.h" + tm_file="elfos.h arm/unknown-elf.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux" extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" gnu_ld=yes @@ -587,7 +587,7 @@ arm*-*-linux*) # ARM GNU/Linux with ELF esac ;; arm*-*-uclinux*) # ARM ucLinux - tm_file=arm/uclinux-elf.h + tm_file="elfos.h arm/unknown-elf.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/uclinux-elf.h" tmake_file=arm/t-arm-elf ;; arm*-*-aout) @@ -595,19 +595,19 @@ arm*-*-aout) tmake_file=arm/t-arm-aout ;; arm*-*-ecos-elf) - tm_file=arm/ecos-elf.h + tm_file="elfos.h arm/unknown-elf.h arm/elf.h arm/ecos-elf.h" tmake_file=arm/t-arm-elf ;; arm*-*-elf) - tm_file=arm/unknown-elf.h + tm_file="elfos.h arm/unknown-elf.h arm/elf.h" tmake_file=arm/t-arm-elf ;; arm*-*-conix*) - tm_file=arm/conix-elf.h + tm_file="elfos.h arm/unknown-elf.h arm/elf.h arm/conix-elf.h" tmake_file=arm/t-arm-elf ;; arm*-*-oabi) - tm_file=arm/unknown-elf-oabi.h + tm_file="arm/unknown-elf-oabi.h elfos.h arm/unknown-elf.h arm/elf.h" tmake_file=arm/t-arm-elf ;; arm-*-pe*) @@ -3117,7 +3117,7 @@ stormy16-*-elf) extra_parts="crtbegin.o crtend.o" ;; strongarm-*-elf*) - tm_file=arm/strongarm-elf.h + tm_file="arm/strongarm-elf.h elfos.h arm/unknown-elf.h arm/elf.h" tmake_file=arm/t-strongarm-elf out_file=arm/arm.c md_file=arm/arm.md @@ -3203,7 +3203,7 @@ we32k-att-sysv*) use_collect2=yes ;; xscale-*-elf) - tm_file=arm/xscale-elf.h + tm_file="arm/xscale-elf.h elfos.h arm/unknown-elf.h arm/elf.h" tmake_file=arm/t-xscale-elf out_file=arm/arm.c md_file=arm/arm.md diff --git a/gcc/config/arm/aout.h b/gcc/config/arm/aout.h index 1acb8b4..88dddc1 100644 --- a/gcc/config/arm/aout.h +++ b/gcc/config/arm/aout.h @@ -105,7 +105,9 @@ Boston, MA 02111-1307, USA. */ /* 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) @@ -257,10 +259,12 @@ Boston, MA 02111-1307, USA. */ #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) diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index aa1c177..462a291 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -258,7 +258,9 @@ Unrecognized value in TARGET_CPU_DEFAULT. %{!mthumb-interwork:%{!mno-thumb-interwork:%(cpp_interwork_default)}} \ " +#ifndef CC1_SPEC #define CC1_SPEC "" +#endif /* This macro defines names of additional specifications to put in the specs that can be used in various specifications like CC1_SPEC. Its definition @@ -548,7 +550,9 @@ extern enum floating_point_type arm_fpu_arch; /* Default floating point architecture. Override in sub-target if necessary. */ +#ifndef FP_DEFAULT #define FP_DEFAULT FP_SOFT2 +#endif /* Nonzero if the processor has a fast multiply insn, and one that does a 64-bit multiply of two 32-bit values. */ @@ -586,6 +590,7 @@ extern int arm_is_6_or_7; 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 () @@ -1554,6 +1559,7 @@ typedef struct The ``mov ip,lr'' seems like a good idea to stick with cc convention. ``prof'' doesn't seem to mind about this! */ +#ifndef ARM_FUNCTION_PROFILER #define ARM_FUNCTION_PROFILER(STREAM, LABELNO) \ { \ char temp[20]; \ @@ -1567,6 +1573,7 @@ typedef struct sym = gen_rtx (SYMBOL_REF, Pmode, temp); \ ASM_OUTPUT_INT (STREAM, sym); \ } +#endif #define THUMB_FUNCTION_PROFILER(STREAM, LABELNO) \ { \ @@ -2578,6 +2585,7 @@ extern int making_const_table; /* 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 \ { \ diff --git a/gcc/config/arm/conix-elf.h b/gcc/config/arm/conix-elf.h index 697210d..6cde16f 100644 --- a/gcc/config/arm/conix-elf.h +++ b/gcc/config/arm/conix-elf.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler, for ARM with ConiX OS. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. Contributed by Philip Blundell This file is part of GNU CC. @@ -18,95 +18,18 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU CC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +`Boston, MA 02111-1307, USA. */ + +/* elfos.h should have already been included. Now just override + any conflicting definitions and add any extras. */ /* Run-time Target Specification. */ -#ifndef TARGET_VERSION +#undef TARGET_VERSION #define TARGET_VERSION fputs (" (ARM/ELF ConiX)", stderr); -#endif /* Default to using APCS-32 and software floating point. */ -#ifndef TARGET_DEFAULT +#undef TARGET_DEFAULT #define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32) -#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__" @@ -116,8 +39,6 @@ rdata_section () \ #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm7tdmi #endif +#undef CPP_PREDEFINES #define CPP_PREDEFINES \ "-D__arm__ -D__CONIX__ -Acpu=arm -Amachine=arm -D__ELF__" - -/* Now get the routine arm-elf definitions. */ -#include "arm/elf.h" diff --git a/gcc/config/arm/crti.asm b/gcc/config/arm/crti.asm new file mode 100644 index 0000000..3799e92 --- /dev/null +++ b/gcc/config/arm/crti.asm @@ -0,0 +1,70 @@ +# Copyright (C) 2001 Free Software Foundation, Inc. +# Written By Nick Clifton +# +# 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. +# + +# This file just make a stack frame for the contents of the .fini and +# .init sections. Users may put any desired instructions in those +# sections. + + # Note - this macro is complimented by the FUNC_END macro + # in crtn.asm. If you change this macro you must also change + # that macro match. +.macro FUNC_START +#ifdef __thumb__ + .thumb + + push {r4, r5, r6, r7, lr} +#else + .arm + # Create a stack frame and save any call-preserved registers + mov ip, sp + stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc} + sub fp, ip, #4 +#endif +.endm + + .file "crti.asm" + + .section ".init" + .align 2 + .global _init +_init: + FUNC_START + + + .section ".fini" + .align 2 + .global _fini +_fini: + FUNC_START + +# end of crti.asm diff --git a/gcc/config/arm/crtn.asm b/gcc/config/arm/crtn.asm new file mode 100644 index 0000000..a7f0e9e --- /dev/null +++ b/gcc/config/arm/crtn.asm @@ -0,0 +1,81 @@ +# Copyright (C) 2001 Free Software Foundation, Inc. +# Written By Nick Clifton +# +# 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. +# + +# This file just makes sure that the .fini and .init sections do in +# fact return. Users may put any desired instructions in those sections. +# This file is the last thing linked into any executable. + + # Note - this macro is complimented by the FUNC_START macro + # in crti.asm. If you change this macro you must also change + # that macro match. + # + # Note - we do not try any fancy optimisations of the return + # sequences here, it is just not worth it. Instead keep things + # simple. Restore all the save resgisters, including the link + # register and then perform the correct function return instruction. +.macro FUNC_END +#ifdef __thumb__ + .thumb + + pop {r4, r5, r6, r7} + pop {r3} + mov lr, r3 +#else + .arm + + ldmdb fp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, lr} +#endif + +#if defined __THUMB_INTERWORK__ || defined __thumb__ + bx lr +#else +#ifdef __APCS_26__ + movs pc, lr +#else + mov pc, lr +#endif +#endif +.endm + + + .file "crtn.asm" + + .section ".init" + ;; + FUNC_END + + .section ".fini" + ;; + FUNC_END + +# end of crtn.asm diff --git a/gcc/config/arm/ecos-elf.h b/gcc/config/arm/ecos-elf.h index 9fdc64a..f1377a9 100644 --- a/gcc/config/arm/ecos-elf.h +++ b/gcc/config/arm/ecos-elf.h @@ -1,5 +1,5 @@ /* Definitions for ecos based ARM systems using ELF - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 2001 Free Software Foundation, Inc. This file is part of GNU CC. @@ -19,11 +19,10 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Run-time Target Specification. */ +#undef TARGET_VERSION #define TARGET_VERSION fputs (" (ARM/ELF Ecos)", stderr); #define HAS_INIT_SECTION -#include "unknown-elf.h" - #undef INVOKE_main diff --git a/gcc/config/arm/elf.h b/gcc/config/arm/elf.h index 0c8cd03..e39381d 100644 --- a/gcc/config/arm/elf.h +++ b/gcc/config/arm/elf.h @@ -22,17 +22,14 @@ along with GNU CC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define OBJECT_FORMAT_ELF +#ifndef OBJECT_FORMAT_ELF + #error elf.h included before elfos.h +#endif #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 @@ -58,30 +55,13 @@ Boston, MA 02111-1307, USA. */ %(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). */ +/* The ARM uses @ are a comment character so we need to redefine + TYPE_OPERAND_FMT. */ +#undef TYPE_OPERAND_FMT #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. */ +/* We might need a ARM specific header to function declarations. */ +#undef ASM_DECLARE_FUNCTION_NAME #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ do \ { \ @@ -96,56 +76,8 @@ Boston, MA 02111-1307, USA. */ } \ 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. */ +/* We might need an ARM specific trailer for function declarations. */ +#undef ASM_DECLARE_FUNCTION_SIZE #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ do \ { \ @@ -207,7 +139,7 @@ Boston, MA 02111-1307, USA. */ #endif /* Output an internal label definition. */ -#ifndef ASM_OUTPUT_INTERNAL_LABEL +#undef ASM_OUTPUT_INTERNAL_LABEL #define ASM_OUTPUT_INTERNAL_LABEL(STREAM, PREFIX, NUM) \ do \ { \ @@ -216,58 +148,20 @@ Boston, MA 02111-1307, USA. */ extern rtx arm_target_insn; \ \ if (arm_ccfsm_state == 3 && arm_target_label == (NUM) \ - && !strcmp (PREFIX, "L")) \ + && !strcmp (PREFIX, "L")) \ { \ arm_ccfsm_state = 0; \ arm_target_insn = NULL; \ } \ - ASM_GENERATE_INTERNAL_LABEL (s, (PREFIX), (NUM)); \ - ASM_OUTPUT_LABEL (STREAM, s); \ + 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 +#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 +#undef ASM_OUTPUT_ALIGNED_COMMON #define ASM_OUTPUT_ALIGNED_COMMON(STREAM, NAME, SIZE, ALIGN) \ do \ { \ @@ -276,7 +170,6 @@ Boston, MA 02111-1307, USA. */ 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 diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h index cb9014c..f6b9197 100644 --- a/gcc/config/arm/linux-elf.h +++ b/gcc/config/arm/linux-elf.h @@ -20,21 +20,27 @@ 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. */ +/* elfos.h should have already been included. Now just override + any conflicting definitions and add any extras. */ + /* Run-time Target Specification. */ +#undef TARGET_VERSION #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr); /* Do not assume anything about header files. */ #define NO_IMPLICIT_EXTERN_C /* Default is to use APCS-32 mode. */ +#undef TARGET_DEFAULT #define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS) + #define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" + +#undef MULTILIB_DEFAULTS #define MULTILIB_DEFAULTS \ { "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 +#define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" /* Now we define the strings used to build the spec file. */ #define LIB_SPEC \ @@ -42,7 +48,6 @@ Boston, MA 02111-1307, USA. */ %{!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 @@ -50,6 +55,7 @@ Boston, MA 02111-1307, USA. */ 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} \ @@ -63,9 +69,11 @@ Boston, MA 02111-1307, USA. */ 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" +#undef LINK_SPEC #define LINK_SPEC "%{h*} %{version:-v} \ %{b} %{Wl,*:%*} \ %{static:-Bstatic} \ @@ -85,159 +93,16 @@ Boston, MA 02111-1307, USA. */ /* 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,ALIGN) \ -{ \ - 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,ALIGN) 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" +#define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \ + do \ + { \ + assemble_name (FILE, NAME1); \ + fputs (" = ", FILE); \ + assemble_name (FILE, NAME2); \ + fputc ('\n', FILE); \ + } \ + while (0) /* NWFPE always understands FPA instructions. */ #undef FP_DEFAULT diff --git a/gcc/config/arm/linux-gas.h b/gcc/config/arm/linux-gas.h index eea8bed..b4e346d 100644 --- a/gcc/config/arm/linux-gas.h +++ b/gcc/config/arm/linux-gas.h @@ -20,24 +20,10 @@ 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. */ -/* - * We are using GAS, so stabs should work. - */ +/* This is how we tell the assembler that a symbol is weak. + GAS always supports weak symbols. */ -#ifndef DBX_DEBUGGING_INFO -#define DBX_DEBUGGING_INFO 1 -#endif - -/* - * This is how we tell the assembler that a symbol is weak. GAS always - * supports weak symbols. - */ - -#define ASM_WEAKEN_LABEL(FILE,NAME) \ - do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ - fputc ('\n', FILE); } while (0) - -/* This is used in ASM_FILE_START */ +/* This is used in ASM_FILE_START. */ #undef ARM_OS_NAME #define ARM_OS_NAME "Linux" diff --git a/gcc/config/arm/rtems-elf.h b/gcc/config/arm/rtems-elf.h index 23a1a32..954f72b 100644 --- a/gcc/config/arm/rtems-elf.h +++ b/gcc/config/arm/rtems-elf.h @@ -1,5 +1,5 @@ /* Definitions for RTEMS based ARM systems using ELF - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. This file is part of GNU CC. @@ -19,19 +19,15 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Run-time Target Specification. */ +#undef TARGET_VERSION #define TARGET_VERSION fputs (" (ARM/ELF RTEMS)", stderr); #define HAS_INIT_SECTION -#include "unknown-elf.h" - -#undef CPP_PREDEFINES +#undef CPP_PREDEFINES #define CPP_PREDEFINES "-Darm -Darm_elf -Drtems -D__rtems__ -D__ELF__ \ -Asystem(rtems) -Acpu(arm) -Amachine(arm)" /*#undef INVOKE_main*/ -/* Get machine-independent configuration parameters for RTEMS. */ -#include - diff --git a/gcc/config/arm/semi.h b/gcc/config/arm/semi.h index 3e7d76b..dc63ecd 100644 --- a/gcc/config/arm/semi.h +++ b/gcc/config/arm/semi.h @@ -21,11 +21,17 @@ Boston, MA 02111-1307, USA. */ #define STARTFILE_SPEC "crt0.o%s" +#ifndef LIB_SPEC #define LIB_SPEC "-lc" +#endif +#ifndef SUBTARGET_CPP_SPEC #define SUBTARGET_CPP_SPEC "-D__semi__" +#endif +#ifndef LINK_SPEC #define LINK_SPEC "%{mbig-endian:-EB} -X" +#endif #ifndef TARGET_VERSION #define TARGET_VERSION fputs (" (ARM/semi-hosted)", stderr); diff --git a/gcc/config/arm/strongarm-elf.h b/gcc/config/arm/strongarm-elf.h index 79ba961..3fc8487 100644 --- a/gcc/config/arm/strongarm-elf.h +++ b/gcc/config/arm/strongarm-elf.h @@ -1,5 +1,5 @@ /* Definitions for non-Linux based StrongARM systems using ELF - Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. Contributed by Catherine Moore This file is part of GNU CC. @@ -28,4 +28,3 @@ Boston, MA 02111-1307, USA. */ #define SUBTARGET_CPU_DEFAULT TARGET_CPU_strongarm #endif -#include "unknown-elf.h" diff --git a/gcc/config/arm/t-arm-elf b/gcc/config/arm/t-arm-elf index b87cedc..d94b5d2 100644 --- a/gcc/config/arm/t-arm-elf +++ b/gcc/config/arm/t-arm-elf @@ -70,10 +70,10 @@ MULTILIB_EXCEPTIONS = # MULTILIB_MATCHES += mcpu?arm7=mcpu?arm610 # MULTILIB_MATCHES += mcpu?arm7=mcpu?arm620 -EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o +EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o # If EXTRA_MULTILIB_PARTS is not defined above then define EXTRA_PARTS here -# EXTRA_PARTS = crtbegin.o crtend.o +# EXTRA_PARTS = crtbegin.o crtend.o crti.o crtn.o LIBGCC = stmp-multilib INSTALL_LIBGCC = install-multilib @@ -82,3 +82,12 @@ INSTALL_LIBGCC = install-multilib # or scheduling code that is breaking _fpmul_parts in fp-bit.c. # Disabling function inlining is a workaround for this problem. TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc -fno-inline + +# Assemble startup files. +$(T)crti.o: $(srcdir)/config/arm/crti.asm $(GCC_PASSES) + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ + -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/arm/crti.asm + +$(T)crtn.o: $(srcdir)/config/arm/crtn.asm $(GCC_PASSES) + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ + -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/arm/crtn.asm diff --git a/gcc/config/arm/t-strongarm-elf b/gcc/config/arm/t-strongarm-elf index a2bb644..46e2ac4 100644 --- a/gcc/config/arm/t-strongarm-elf +++ b/gcc/config/arm/t-strongarm-elf @@ -24,10 +24,7 @@ MULTILIB_OPTIONS = mlittle-endian/mbig-endian mhard-float/msoft-float MULTILIB_DIRNAMES = le be fpu soft MULTILIB_EXCEPTIONS = MULTILIB_MATCHES = mbig-endian=mbe mlittle-endian=mle -EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o - -# If EXTRA_MULTILIB_PARTS is not defined above then define EXTRA_PARTS here -# EXTRA_PARTS = crtbegin.o crtend.o +EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o LIBGCC = stmp-multilib INSTALL_LIBGCC = install-multilib @@ -36,3 +33,12 @@ INSTALL_LIBGCC = install-multilib # or scheduling code that is breaking _fpmul_parts in fp-bit.c. # Disabling function inlining is a workaround for this problem. TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc -fno-inline + +# Assemble startup files. +$(T)crti.o: $(srcdir)/config/arm/crti.asm $(GCC_PASSES) + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ + -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/arm/crti.asm + +$(T)crtn.o: $(srcdir)/config/arm/crtn.asm $(GCC_PASSES) + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ + -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/arm/crtn.asm diff --git a/gcc/config/arm/t-xscale-elf b/gcc/config/arm/t-xscale-elf index 5a5eb98..0efc1d5 100644 --- a/gcc/config/arm/t-xscale-elf +++ b/gcc/config/arm/t-xscale-elf @@ -37,7 +37,8 @@ MULTILIB_EXCEPTIONS += *mhard-float/*mthumb* MULTILIB_REDUNDANT_DIRS = interwork/thumb=thumb -EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o +EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o + LIBGCC = stmp-multilib INSTALL_LIBGCC = install-multilib @@ -45,3 +46,12 @@ INSTALL_LIBGCC = install-multilib # or scheduling code that is breaking _fpmul_parts in fp-bit.c. # Disabling function inlining is a workaround for this problem. TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc -fno-inline + +# Assemble startup files. +$(T)crti.o: $(srcdir)/config/arm/crti.asm $(GCC_PASSES) + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ + -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/arm/crti.asm + +$(T)crtn.o: $(srcdir)/config/arm/crtn.asm $(GCC_PASSES) + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ + -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/arm/crtn.asm diff --git a/gcc/config/arm/uclinux-elf.h b/gcc/config/arm/uclinux-elf.h index 751bdc5..cad61b7 100644 --- a/gcc/config/arm/uclinux-elf.h +++ b/gcc/config/arm/uclinux-elf.h @@ -1,5 +1,5 @@ /* Definitions for ARM running ucLinux using ELF - Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. Contributed by Philip Blundell This file is part of GNU CC. @@ -19,8 +19,6 @@ 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. */ -#include "arm/linux-elf.h" - /* We don't want a PLT. */ #undef NEED_PLT_RELOC #define NEED_PLT_RELOC 0 diff --git a/gcc/config/arm/unknown-elf-oabi.h b/gcc/config/arm/unknown-elf-oabi.h index 372e649..cc58f3a 100644 --- a/gcc/config/arm/unknown-elf-oabi.h +++ b/gcc/config/arm/unknown-elf-oabi.h @@ -20,17 +20,13 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Run-time Target Specification. */ -#ifndef TARGET_VERSION +#undef TARGET_VERSION #define TARGET_VERSION fputs (" (ARM/ELF non-Linux old abi)", stderr); -#endif +#undef CPP_PREDEFINES #define CPP_PREDEFINES "-Darm_oabi -Darm -Darm_elf -Acpu=arm -Amachine=arm -D__ELF__" -#ifndef ASM_SPEC +#undef ASM_SPEC #define ASM_SPEC "-moabi %{mbig-endian:-EB} %{mcpu=*:-m%*} %{march=*:-m%*} \ %{mapcs-*:-mapcs-%*} %{mthumb-interwork:-mthumb-interwork}" -#endif -/* Now get the routine arm-elf definitions. */ -#include "arm/unknown-elf.h" -#include "arm/elf.h" diff --git a/gcc/config/arm/unknown-elf.h b/gcc/config/arm/unknown-elf.h index aa69278..ba5f7ef 100644 --- a/gcc/config/arm/unknown-elf.h +++ b/gcc/config/arm/unknown-elf.h @@ -19,6 +19,9 @@ 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. */ +/* elfos.h should have already been included. Now just override + any conflicting definitions and add any extras. */ + /* Run-time Target Specification. */ #ifndef TARGET_VERSION #define TARGET_VERSION fputs (" (ARM/ELF non-Linux)", stderr); @@ -30,103 +33,25 @@ Boston, MA 02111-1307, USA. */ #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 "." +#undef STARTFILE_SPEC +#define STARTFILE_SPEC " crti%O%s crtbegin%O%s crt0%O%s" -#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" +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "crtend%O%s crtn%O%s" -#define INVOKE__main +/* The __USES_INITFINI__ define is tested in newlib/libc/sys/arm/crt0.S + to see if it needs to invoked _init() and _fini(). */ +#undef SUBTARGET_CPP_SPEC +#define SUBTARGET_CPP_SPEC "-D__ELF__ -D__USES_INITFINI__" -/* Debugging */ -#define DWARF_DEBUGGING_INFO -#define DWARF2_DEBUGGING_INFO +#undef PREFERRED_DEBUGGING_TYPE #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) \ do \ @@ -169,5 +94,3 @@ rdata_section () \ #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm7tdmi #endif -/* Now get the routine arm-elf definitions. */ -#include "elf.h" diff --git a/gcc/config/arm/xscale-elf.h b/gcc/config/arm/xscale-elf.h index 3718d11..72615da 100644 --- a/gcc/config/arm/xscale-elf.h +++ b/gcc/config/arm/xscale-elf.h @@ -1,5 +1,5 @@ /* Definitions for XScale architectures using ELF - Copyright (C) 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Catherine Moore This file is part of GNU CC. @@ -34,5 +34,3 @@ Boston, MA 02111-1307, USA. */ #define MULTILIB_DEFAULTS \ { "mlittle-endian", "mno-thumb-interwork", "marm" } #endif - -#include "unknown-elf.h" -- 2.7.4