This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch to add thumb-elf support to EGCS
- To: egcs-patches at egcs dot cygnus dot com
- Subject: Patch to add thumb-elf support to EGCS
- From: Nick Clifton <nickc at cygnus dot com>
- Date: Wed, 9 Jun 1999 16:40:12 +0100
Hi Guys,
I would like to get approval toa pply the patch below. It adds
support for a thumb-elf targeted toolchain to EGCS.
Cheers
Nick
Wed Jun 9 16:29:01 1999 Nick Clifton <nickc@cygnus.com>
* configure.in: Add new target: thumb-elf.
* configure: Regenerate.
* config/arm/t-thumb-elf: New file: Makefile fragment for
thumb-elf build.
* config/arm/telf.h: New file: Header file for thumb-elf
build.
Index: configure.in
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/configure.in,v
retrieving revision 1.254
diff -p -r1.254 configure.in
*** configure.in 1999/06/08 13:08:09 1.254
- --- configure.in 1999/06/09 15:24:03
*************** changequote([,])dnl
*** 3215,3220 ****
- --- 3215,3227 ----
xm_file=arm/xm-thumb.h
md_file=arm/thumb.md
tmake_file=arm/t-thumb
+ ;;
+ thumb-*-elf* | thumbel-*-elf*)
+ tm_file=arm/telf.h
+ out_file=arm/thumb.c
+ xm_file=arm/xm-thumb.h
+ md_file=arm/thumb.md
+ tmake_file=arm/t-thumb-elf
;;
thumb-wrs-vxworks)
tm_file=arm/tcoff.h
Index: configure
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/configure,v
retrieving revision 1.250
diff -p -r1.250 configure
*** configure 1999/06/08 13:08:15 1.250
- --- configure 1999/06/09 15:24:15
*************** for machine in $build $host $target; do
*** 5519,5524 ****
- --- 5519,5531 ----
md_file=arm/thumb.md
tmake_file=arm/t-thumb
;;
+ thumb-*-elf* | thumbel-*-elf*)
+ tm_file=arm/telf.h
+ out_file=arm/thumb.c
+ xm_file=arm/xm-thumb.h
+ md_file=arm/thumb.md
+ tmake_file=arm/t-thumb-elf
+ ;;
thumb-wrs-vxworks)
tm_file=arm/tcoff.h
out_file=arm/thumb.c
*** /dev/null Tue May 5 21:32:27 1998
- --- config/arm/t-thumb-elf Wed Jun 9 15:33:01 1999
***************
*** 0 ****
- --- 1,34 ----
+ CROSS_LIBGCC1 = libgcc1-asm.a
+ LIB1ASMSRC = arm/lib1thumb.asm
+ LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX _interwork_call_via_rX
+ # adddi3/subdi3 added to machine description
+
+ # These are really part of libgcc1, but this will cause them to be
+ # built correctly, so...
+
+ LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
+
+ fp-bit.c: $(srcdir)/config/fp-bit.c
+ echo '#define FLOAT' > fp-bit.c
+ echo '#ifndef __ARMEB__' >> fp-bit.c
+ echo '#define FLOAT_BIT_ORDER_MISMATCH' >> fp-bit.c
+ echo '#endif' >> fp-bit.c
+ cat $(srcdir)/config/fp-bit.c >> fp-bit.c
+
+ dp-bit.c: $(srcdir)/config/fp-bit.c
+ echo '#ifndef __ARMEB__' > dp-bit.c
+ echo '#define FLOAT_BIT_ORDER_MISMATCH' >> dp-bit.c
+ echo '#define FLOAT_WORD_ORDER_MISMATCH' >> dp-bit.c
+ echo '#endif' >> dp-bit.c
+ cat $(srcdir)/config/fp-bit.c >> dp-bit.c
+
+ # Avoid building a duplicate set of libraries for the default endian-ness.
+ MULTILIB_OPTIONS = mlittle-endian/mbig-endian mno-thumb-interwork/mthumb-interwork fno-leading-underscore/fleading-underscore
+ MULTILIB_DIRNAMES = le be normal interwork elf under
+ MULTILIB_MATCHES = mbig-endian=mbe mlittle-endian=mle
+ EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
+
+ LIBGCC = stmp-multilib
+ INSTALL_LIBGCC = install-multilib
+
+ TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc
*** /dev/null Tue May 5 21:32:27 1998
- --- config/arm/telf.h Wed Jun 9 14:05:44 1999
***************
*** 0 ****
- --- 1,289 ----
+ /* Definitions of target machine for GNU compiler,
+ for Thumb with ELF obj format.
+ Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+
+ This file is part of GNU CC.
+
+ GNU CC 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.
+
+ GNU CC 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 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
+
+ #define CPP_PREDEFINES "-Dthumb -Dthumbelf -D__thumb -Acpu(arm) -Amachine(arm)"
+
+ #include "arm/thumb.h"
+
+ /* Run-time Target Specification. */
+ #undef TARGET_VERSION
+ #define TARGET_VERSION fputs (" (Thumb/elf)", stderr)
+
+ #define MULTILIB_DEFAULTS { "mlittle-endian" }
+
+ /* Setting this to 32 produces more efficient code, but the value set in previous
+ versions of this toolchain was 8, which produces more compact structures. The
+ command line option -mstructure_size_boundary=<n> can be used to change this
+ value. */
+ #undef STRUCTURE_SIZE_BOUNDARY
+ #define STRUCTURE_SIZE_BOUNDARY arm_structure_size_boundary
+
+ extern int arm_structure_size_boundary;
+
+ /* Debug */
+ #define DWARF_DEBUGGING_INFO
+ #define DWARF2_DEBUGGING_INFO
+ #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+
+
+ /* Note - it is important that these definitions match those in semi.h for the ARM port. */
+ #undef LOCAL_LABEL_PREFIX
+ #define LOCAL_LABEL_PREFIX "."
+
+
+ /* A C statement to output assembler commands which will identify the
+ object file as having been compiled with GNU CC (or another GNU
+ compiler). */
+ #define ASM_IDENTIFY_GCC(STREAM) \
+ fprintf (STREAM, "%sgcc2_compiled.:\n", LOCAL_LABEL_PREFIX )
+
+ #undef ASM_FILE_START
+ #define ASM_FILE_START(STREAM) \
+ do \
+ { \
+ extern char * version_string; \
+ fprintf ((STREAM), "%s Generated by gcc %s for Thumb/elf\n", \
+ ASM_COMMENT_START, version_string); \
+ fprintf ((STREAM), ASM_APP_OFF); \
+ } \
+ while (0)
+
+ /* A C statement to output something to the assembler file to switch to section
+ NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
+ NULL_TREE. Some target formats do not support arbitrary sections. Do not
+ define this macro in such cases. */
+ #define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
+ do \
+ { \
+ if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
+ fprintf (STREAM, "\t.section %s,\"ax\",@progbits\n", (NAME)); \
+ else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
+ fprintf (STREAM, "\t.section %s,\"a\"\n", (NAME)); \
+ else \
+ fprintf (STREAM, "\t.section %s,\"aw\"\n", (NAME)); \
+ } \
+ while (0)
+
+ /* Support the ctors/dtors and other sections. */
+
+ #undef INIT_SECTION_ASM_OP
+
+ /* Define this macro if jump tables (for `tablejump' insns) should be
+ output in the text section, along with the assembler instructions.
+ Otherwise, the readonly data section is used. */
+ #define JUMP_TABLES_IN_TEXT_SECTION 1
+
+ #undef READONLY_DATA_SECTION
+ #define READONLY_DATA_SECTION rdata_section
+ #undef RDATA_SECTION_ASM_OP
+ #define RDATA_SECTION_ASM_OP "\t.section .rodata"
+
+ #undef CTORS_SECTION_ASM_OP
+ #define CTORS_SECTION_ASM_OP "\t.section .ctors,\"aw\""
+ #undef DTORS_SECTION_ASM_OP
+ #define DTORS_SECTION_ASM_OP "\t.section .dtors,\"aw\""
+
+ #define USER_LABEL_PREFIX ""
+
+ /* Don't know how to order these. UNALIGNED_WORD_ASM_OP is in
+ dwarf2.out. */
+ #define UNALIGNED_WORD_ASM_OP ".4byte"
+
+ #define ASM_OUTPUT_DWARF2_ADDR_CONST(FILE,ADDR) \
+ if (((ADDR)[0] == '.') && ((ADDR)[1] == 'L')) \
+ fprintf ((FILE), "\t%s\t%s", UNALIGNED_WORD_ASM_OP, (ADDR)); \
+ else \
+ fprintf ((FILE), "\t%s\t%s", \
+ UNALIGNED_WORD_ASM_OP, (ADDR))
+
+ #define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,RTX) \
+ do \
+ { \
+ fprintf ((FILE), "\t%s\t", UNALIGNED_WORD_ASM_OP); \
+ output_addr_const ((FILE), (RTX)); \
+ fputc ('\n', (FILE)); \
+ } \
+ while (0)
+
+ /* This is how to equate one symbol to another symbol. The syntax used is
+ `SYM1=SYM2'. Note that this is different from the way equates are done
+ with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'. */
+
+ #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
+ do \
+ { \
+ fprintf ((FILE), "\t"); \
+ assemble_name (FILE, LABEL1); \
+ fprintf (FILE, " = "); \
+ assemble_name (FILE, LABEL2); \
+ fprintf (FILE, "\n"); \
+ } \
+ while (0)
+
+ /* A list of other sections which the compiler might be "in" at any
+ given time. */
+ #undef EXTRA_SECTIONS
+ #define EXTRA_SECTIONS SUBTARGET_EXTRA_SECTIONS in_rdata, in_ctors, in_dtors
+
+ #define SUBTARGET_EXTRA_SECTIONS
+
+ /* A list of extra section function definitions. */
+
+ #undef EXTRA_SECTION_FUNCTIONS
+ #define EXTRA_SECTION_FUNCTIONS \
+ RDATA_SECTION_FUNCTION \
+ CTORS_SECTION_FUNCTION \
+ DTORS_SECTION_FUNCTION \
+ SUBTARGET_EXTRA_SECTION_FUNCTIONS
+
+ #define SUBTARGET_EXTRA_SECTION_FUNCTIONS
+
+ #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; \
+ } \
+ }
+
+ #define CTOR_LIST_BEGIN \
+ asm (CTORS_SECTION_ASM_OP); \
+ func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) }
+
+ #define CTOR_LIST_END \
+ asm (CTORS_SECTION_ASM_OP); \
+ func_ptr __CTOR_END__[1] = { (func_ptr) 0 };
+
+ #define DTOR_LIST_BEGIN \
+ asm (DTORS_SECTION_ASM_OP); \
+ func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) }
+
+ #define DTOR_LIST_END \
+ asm (DTORS_SECTION_ASM_OP); \
+ func_ptr __DTOR_END__[1] = { (func_ptr) 0 };
+
+ #define CTORS_SECTION_FUNCTION \
+ void \
+ ctors_section () \
+ { \
+ if (in_section != in_ctors) \
+ { \
+ fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
+ in_section = in_ctors; \
+ } \
+ }
+
+ #define DTORS_SECTION_FUNCTION \
+ void \
+ dtors_section () \
+ { \
+ if (in_section != in_dtors) \
+ { \
+ fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
+ in_section = in_dtors; \
+ } \
+ }
+
+ /* Support the ctors/dtors sections for g++. */
+
+ #define INT_ASM_OP ".word"
+
+ #define INVOKE__main
+
+ #undef STARTFILE_SPEC
+ #define STARTFILE_SPEC "crtbegin%O%s crt0%O%s"
+
+ #undef ENDFILE_SPEC
+ #define ENDFILE_SPEC "crtend%O%s"
+
+ /* A C statement (sans semicolon) to output an element in the table of
+ global constructors. */
+ #undef ASM_OUTPUT_CONSTRUCTOR
+ #define ASM_OUTPUT_CONSTRUCTOR(STREAM,NAME) \
+ do \
+ { \
+ ctors_section (); \
+ fprintf (STREAM, "\t%s\t ", INT_ASM_OP); \
+ assemble_name (STREAM, NAME); \
+ fprintf (STREAM, "\n"); \
+ } \
+ while (0)
+
+ /* A C statement (sans semicolon) to output an element in the table of
+ global destructors. */
+ #undef ASM_OUTPUT_DESTRUCTOR
+ #define ASM_OUTPUT_DESTRUCTOR(STREAM,NAME) \
+ do \
+ { \
+ dtors_section (); \
+ fprintf (STREAM, "\t%s\t ", INT_ASM_OP); \
+ assemble_name (STREAM, NAME); \
+ fprintf (STREAM, "\n"); \
+ } \
+ while (0)
+
+ /* The ARM development system has atexit and doesn't have _exit,
+ so define this for now. */
+ #define HAVE_ATEXIT
+
+ /* 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_P(DECL) (DECL_ONE_ONLY (DECL))
+ #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)