From a54fc94ed2903b3d860690e330ddd7667f871afb Mon Sep 17 00:00:00 2001 From: erich Date: Wed, 6 Dec 1995 11:39:58 +0000 Subject: [PATCH] Initial revision git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@10679 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/config/arm/aof.h | 480 +++++++++++++++++++++++++++++++++++++++++++++++ gcc/config/arm/aout.h | 264 ++++++++++++++++++++++++++ gcc/config/arm/semiaof.h | 49 +++++ gcc/config/arm/t-semiaof | 63 +++++++ 4 files changed, 856 insertions(+) create mode 100644 gcc/config/arm/aof.h create mode 100644 gcc/config/arm/aout.h create mode 100644 gcc/config/arm/semiaof.h create mode 100644 gcc/config/arm/t-semiaof diff --git a/gcc/config/arm/aof.h b/gcc/config/arm/aof.h new file mode 100644 index 00000000000..5af670b023e --- /dev/null +++ b/gcc/config/arm/aof.h @@ -0,0 +1,480 @@ +/* Definitions of target machine for GNU compiler, for Advanced RISC Machines + ARM compilation, AOF Assembler. + Copyright (C) 1995 Free Software Foundation, Inc. + Contributed by Richard Earnshaw (rearnsha@armltd.co.uk) + +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 AOF_ASSEMBLER + +#define LINK_LIBGCC_SPECIAL 1 + +#define LINK_SPEC "%{aof} %{bin} %{aif} %{ihf} %{shl,*} %{reent*} %{split} \ + %{ov*,*} %{reloc*} -nodebug" + +#define STARTFILE_SPEC "crtbegin.o%s" + +#define ENDFILE_SPEC "crtend.o%s" + +#ifndef ASM_SPEC +#define ASM_SPEC "%{g -g} -arch 4 \ +-apcs 3%{mapcs-32:/32bit}%{mapcs-26:/26bit}%{!mapcs-26:%{!macps-32:/26bit}}" +#endif + +#ifndef LIB_SPEC +#define LIB_SPEC "%{Eb: armlib_h.32b%s}%{!Eb: armlib_h.32l%s}" +#endif + +#define LIBGCC_SPEC "libgcc.a%s" + +/* Dividing the Output into Sections (Text, Data, ...) */ +/* AOF Assembler syntax is a nightmare when it comes to areas, since once + we change from one area to another, we can't go back again. Instead, + we must create a new area with the same attributes and add the new output + to that. Unfortunately, there is nothing we can do here to guarantee that + two areas with the same attributes will be linked adjacently in the + resulting executable, so we have to be careful not to do pc-relative + addressing across such boundaries. This isn't a major problem for thumb, + since the range of such addressing modes is so limited that it would + rarely be useful anyway. */ +char *aof_text_section (); +#define TEXT_SECTION_ASM_OP \ + aof_text_section (in_section == in_readonly_data) + +#define SELECT_RTX_SECTION(MODE,RTX) text_section (); + +char *aof_data_section (); +#define DATA_SECTION_ASM_OP aof_data_section () + +#define EXTRA_SECTIONS in_zero_init, in_readonly_data, in_ctor, in_dtor + +#define EXTRA_SECTION_FUNCTIONS \ +ZERO_INIT_SECTION \ +READONLYDATA_SECTION \ +CTOR_SECTION \ +DTOR_SECTION + +#define ZERO_INIT_SECTION \ +void \ +zero_init_section () \ +{ \ + static int zero_init_count = 1; \ + if (in_section != in_zero_init) \ + { \ + fprintf (asm_out_file, "\tAREA |C$$zidata%d|,NOINIT\n", \ + zero_init_count++); \ + in_section = in_zero_init; \ + } \ +} + +#define READONLYDATA_SECTION \ +void \ +readonly_data () \ +{ \ + extern int arm_text_section_count; \ + if (in_section != in_readonly_data) \ + { \ + if (in_section != in_text) \ + { \ + fprintf (asm_out_file, \ + "\tAREA |C$$code%d|, CODE, READONLY", \ + arm_text_section_count++); \ + if (flag_pic) \ + fputs (", PIC, REENTRANT", asm_out_file); \ + fputc ('\n', asm_out_file); \ + } \ + in_section = in_readonly_data; \ + } \ +} \ + \ +int \ +in_readonly_data_section () \ +{ \ + return in_section == in_readonly_data; \ +} + +#define CTOR_SECTION \ +void \ +ctor_section () \ +{ \ + static int ctors_once = 0; \ + if (in_section != in_ctor) \ + { \ + if (ctors_once) \ + { \ + fprintf (stderr, \ + "Attempt to output more than one ctor section\n"); \ + abort (); \ + } \ + fprintf (asm_out_file, "\t%s\n", CTORS_SECTION_ASM_OP); \ + in_section = in_ctor; \ + ctors_once = 1; \ + } \ +} + +#define DTOR_SECTION \ +void \ +dtor_section () \ +{ \ + static int dtors_once = 0; \ + if (in_section != in_dtor) \ + { \ + if (dtors_once) \ + { \ + fprintf (stderr, \ + "Attempt to output more than one dtor section\n"); \ + abort (); \ + } \ + fprintf (asm_out_file, "\t%s\n", DTORS_SECTION_ASM_OP); \ + in_section = in_dtor; \ + dtors_once = 1; \ + } \ +} + +#define CTOR_LIST_BEGIN \ +asm (CTORS_SECTION_ASM_OP); \ +extern func_ptr __CTOR_END__[1]; \ +func_ptr __CTOR_LIST__[1] = {__CTOR_END__}; + +#define CTOR_LIST_END \ +asm (CTORS_SECTION_ASM_OP); \ +func_ptr __CTOR_END__[1] = { (func_ptr) 0 }; + +#define DO_GLOBAL_CTORS_BODY \ +do { \ + func_ptr *ptr = __CTOR_LIST__ + 1; \ + while (*ptr) \ + (*ptr++) (); \ +} while (0) + +#define DTOR_LIST_BEGIN \ +asm (DTORS_SECTION_ASM_OP); \ +extern func_ptr __DTOR_END__[1]; \ +func_ptr __DTOR_LIST__[1] = {__DTOR_END__}; + +#define DTOR_LIST_END \ +asm (DTORS_SECTION_ASM_OP); \ +func_ptr __DTOR_END__[1] = { (func_ptr) 0 }; + +#define DO_GLOBAL_DTORS_BODY \ +do { \ + func_ptr *ptr = __DTOR_LIST__ + 1; \ + while (*ptr) \ + (*ptr++) (); \ +} while (0) +#define READONLY_DATA_SECTION readonly_data + +#define JUMP_TABLES_IN_TEXT_SECTION 1 + +#ifndef ARM_OS_NAME +#define ARM_OS_NAME "(generic)" +#endif + +/* For the AOF linker, we need to reference __main to force the standard + library to get linked in. */ + +#define ASM_FILE_START(STREAM) \ +{ \ + extern char *version_string; \ + fprintf ((STREAM), "%s Generated by gcc %s for ARM/%s\n", \ + ASM_COMMENT_START, version_string, ARM_OS_NAME); \ + fprintf ((STREAM), "__a1\tRN\t0\n"); \ + fprintf ((STREAM), "__a2\tRN\t1\n"); \ + fprintf ((STREAM), "__a3\tRN\t2\n"); \ + fprintf ((STREAM), "__a4\tRN\t3\n"); \ + fprintf ((STREAM), "__v1\tRN\t4\n"); \ + fprintf ((STREAM), "__v2\tRN\t5\n"); \ + fprintf ((STREAM), "__v3\tRN\t6\n"); \ + fprintf ((STREAM), "__v4\tRN\t7\n"); \ + fprintf ((STREAM), "__v5\tRN\t8\n"); \ + fprintf ((STREAM), "__v6\tRN\t9\n"); \ + fprintf ((STREAM), "__sl\tRN\t10\n"); \ + fprintf ((STREAM), "__fp\tRN\t11\n"); \ + fprintf ((STREAM), "__ip\tRN\t12\n"); \ + fprintf ((STREAM), "__sp\tRN\t13\n"); \ + fprintf ((STREAM), "__lr\tRN\t14\n"); \ + fprintf ((STREAM), "__pc\tRN\t15\n"); \ + fprintf ((STREAM), "__f0\tFN\t0\n"); \ + fprintf ((STREAM), "__f1\tFN\t1\n"); \ + fprintf ((STREAM), "__f2\tFN\t2\n"); \ + fprintf ((STREAM), "__f3\tFN\t3\n"); \ + fprintf ((STREAM), "__f4\tFN\t4\n"); \ + fprintf ((STREAM), "__f5\tFN\t5\n"); \ + fprintf ((STREAM), "__f6\tFN\t6\n"); \ + fprintf ((STREAM), "__f7\tFN\t7\n"); \ + text_section (); \ +} + +/* Some systems use __main in a way incompatible with its use in gcc, in these + cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to + give the same symbol without quotes for an alternative entry point. You + must define both, or niether. */ +#define NAME__MAIN "__gccmain" +#define SYMBOL__MAIN __gccmain + +#define ASM_FILE_END(STREAM) \ +do \ +{ \ + if (flag_pic) \ + aof_dump_pic_table (STREAM); \ + aof_dump_imports (STREAM); \ + fputs ("\tEND\n", (STREAM)); \ +} while (0); + +#define ASM_IDENTIFY_GCC(STREAM) fputs ("|gcc2_compiled.|\n", (STREAM)) + +#define ASM_COMMENT_START ";" + +#define ASM_APP_ON "" + +#define ASM_APP_OFF "" + +#define ASM_OUTPUT_LONG_DOUBLE(STREAM,VALUE) \ + ASM_OUTPUT_DOUBLE((STREAM),(VALUE)) + +#define ASM_OUTPUT_DOUBLE(STREAM,VALUE) \ +do { \ + char dstr[30]; \ + long l[2]; \ + REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), l); \ + REAL_VALUE_TO_DECIMAL ((VALUE), "%.14g", dstr); \ + fprintf ((STREAM), "\tDCD &%lx, &%lx\t%s double %s\n", \ + l[0], l[1], ASM_COMMENT_START, dstr); \ +} while (0) + +#define ASM_OUTPUT_FLOAT(STREAM,VALUE) \ +do { \ + char dstr[30]; \ + long l; \ + REAL_VALUE_TO_TARGET_SINGLE ((VALUE), l); \ + REAL_VALUE_TO_DECIMAL ((VALUE), "%.7g", dstr); \ + fprintf ((STREAM), "\tDCD &%lx\t%s double %s\n", \ + l, ASM_COMMENT_START, dstr); \ +} while (0) + +#define ASM_OUTPUT_INT(STREAM,VALUE) \ + (fprintf ((STREAM), "\tDCD\t"), \ + output_addr_const ((STREAM), (VALUE)), \ + fputc ('\n', (STREAM))) + +#define ASM_OUTPUT_SHORT(STREAM,VALUE) \ + (fprintf ((STREAM), "\tDCW\t"), \ + output_addr_const ((STREAM), (VALUE)), \ + fputc ('\n', (STREAM))) + +#define ASM_OUTPUT_CHAR(STREAM,VALUE) \ + (fprintf ((STREAM), "\tDCB\t"), \ + output_addr_const ((STREAM), (VALUE)), \ + fputc ('\n', (STREAM))) + +#define ASM_OUTPUT_BYTE(STREAM,VALUE) \ + fprintf ((STREAM), "\tDCB\t%d\n", (VALUE)) + +#define ASM_OUTPUT_ASCII(STREAM,PTR,LEN) \ +{ \ + int i; \ + char *ptr = (PTR); \ + fprintf ((STREAM), "\tDCB"); \ + for (i = 0; i < (LEN); i++) \ + fprintf ((STREAM), " &%02x%s", \ + (unsigned ) *(ptr++), \ + (i + 1 < (LEN) \ + ? ((i & 3) == 3 ? "\n\tDCB" : ",") \ + : "\n")); \ +} + +#define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '\n') + +#define ASM_OPEN_PAREN "(" +#define ASM_CLOSE_PAREN ")" + +/* Output of Uninitialized Variables */ + +#define ASM_OUTPUT_COMMON(STREAM,NAME,SIZE,ROUNDED) \ + (fprintf ((STREAM), "\tAREA "), \ + assemble_name ((STREAM), (NAME)), \ + fprintf ((STREAM), ", DATA, COMMON\n\t%% %d\t%s size=%d\n", \ + (ROUNDED), ASM_COMMENT_START, SIZE)) + +#define ASM_OUTPUT_LOCAL(STREAM,NAME,SIZE,ROUNDED) \ + (zero_init_section (), \ + assemble_name ((STREAM), (NAME)), \ + fprintf ((STREAM), "\n"), \ + fprintf ((STREAM), "\t%% %d\t%s size=%d\n", \ + (ROUNDED), ASM_COMMENT_START, SIZE)) + +/* Output and Generation of Labels */ + +extern int arm_main_function; + +#define ASM_GLOBALIZE_LABEL(STREAM,NAME) \ +do { \ + fprintf ((STREAM), "\tEXPORT\t"); \ + assemble_name ((STREAM), (NAME)); \ + fputc ('\n', (STREAM)); \ + if ((NAME)[0] == 'm' && ! strcmp ((NAME), "main")) \ + arm_main_function = 1; \ +} while (0) + +#define ARM_OUTPUT_LABEL(STREAM,NAME) \ +do { \ + assemble_name (STREAM,NAME); \ + fputs ("\n", STREAM); \ +} while (0) + +#define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \ +{ \ + if (output_bytecode) \ + BC_OUTPUT_LABEL (STREAM, NAME); \ + else \ + { \ + ASM_OUTPUT_LABEL (STREAM, NAME); \ + if (! TREE_PUBLIC (DECL)) \ + { \ + fputs ("\tKEEP ", STREAM); \ + ASM_OUTPUT_LABEL (STREAM, NAME); \ + } \ + aof_delete_import ((NAME)); \ + } \ +} + +#define ASM_DECLARE_OBJECT_NAME(STREAM,NAME,DECL) \ +{ \ + if (output_bytecode) \ + BC_OUTPUT_LABEL (STREAM, NAME); \ + else \ + { \ + ASM_OUTPUT_LABEL (STREAM, NAME); \ + if (! TREE_PUBLIC (DECL)) \ + { \ + fputs ("\tKEEP ", STREAM); \ + ASM_OUTPUT_LABEL (STREAM, NAME); \ + } \ + aof_delete_import ((NAME)); \ + } \ +} + +#define ASM_OUTPUT_EXTERNAL(STREAM,DECL,NAME) \ + aof_add_import ((NAME)) + +#define ASM_OUTPUT_EXTERNAL_LIBCALL(STREAM,SYMREF) \ + (fprintf ((STREAM), "\tIMPORT\t"), \ + assemble_name ((STREAM), XSTR ((SYMREF), 0)), \ + fputc ('\n', (STREAM))) + +#define ASM_OUTPUT_LABELREF(STREAM,NAME) \ + fprintf ((STREAM), "|%s|", NAME) + +#define ASM_GENERATE_INTERNAL_LABEL(STRING,PREFIX,NUM) \ + sprintf ((STRING), "*|%s..%d|", (PREFIX), (NUM)) + +#define ASM_FORMAT_PRIVATE_NAME(OUTVAR,NAME,NUMBER) \ + ((OUTVAR) = (char *) alloca (strlen ((NAME)) + 10), \ + sprintf ((OUTVAR), "%s.%d", (NAME), (NUMBER))) + +/* How initialization functions are handled */ + +#define CTORS_SECTION_ASM_OP "AREA\t|C$$gnu_ctorsvec|, DATA, READONLY" +#define DTORS_SECTION_ASM_OP "AREA\t|C$$gnu_dtorsvec|, DATA, READONLY" + +#define ASM_OUTPUT_CONSTRUCTOR(STREAM,NAME) \ +do { \ + ctor_section (); \ + fprintf ((STREAM), "\tDCD\t"); \ + assemble_name ((STREAM), (NAME)); \ + fputc ('\n', (STREAM)); \ +} while (0); + +#define ASM_OUTPUT_DESTRUCTOR(STREAM,NAME) \ +do { \ + dtor_section (); \ + fprintf ((STREAM), "\tDCD\t"); \ + assemble_name ((STREAM), (NAME)); \ + fputc ('\n', (STREAM)); \ +} while (0); + +/* Output of Assembler Instructions */ + +#define REGISTER_NAMES \ +{ \ + "a1", "a2", "a3", "a4", \ + "v1", "v2", "v3", "v4", \ + "v5", "v6", "sl", "fp", \ + "ip", "sp", "lr", "pc", \ + "f0", "f1", "f2", "f3", \ + "f4", "f5", "f6", "f7", \ + "cc", "sfp", "afp" \ +} + +#define ADDITIONAL_REGISTER_NAMES \ +{ \ + {"r0", 0}, {"a1", 0}, \ + {"r1", 1}, {"a2", 1}, \ + {"r2", 2}, {"a3", 2}, \ + {"r3", 3}, {"a4", 3}, \ + {"r4", 4}, {"v1", 4}, \ + {"r5", 5}, {"v2", 5}, \ + {"r6", 6}, {"v3", 6}, \ + {"r7", 7}, {"wr", 7}, \ + {"r8", 8}, {"v5", 8}, \ + {"r9", 9}, {"v6", 9}, \ + {"r10", 10}, {"sl", 10}, {"v7", 10}, \ + {"r11", 11}, {"fp", 11}, \ + {"r12", 12}, {"ip", 12}, \ + {"r13", 13}, {"sp", 13}, \ + {"r14", 14}, {"lr", 14}, \ + {"r15", 15}, {"pc", 15} \ +} + +#define REGISTER_PREFIX "__" +#define USER_LABEL_PREFIX "" +#define LOCAL_LABEL_PREFIX "" + +/* Output of Dispatch Tables */ + +#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM,VALUE,REL) \ + fprintf ((STREAM), "\tb\t|L..%d|\n", (VALUE)) + +#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM,VALUE) \ + fprintf ((STREAM), "\tDCD\t|L..%d|\n", (VALUE)) + +/* A label marking the start of a jump table is a data label. */ +#define ASM_OUTPUT_CASE_LABEL(STREAM,PREFIX,NUM,TABLE) \ + fprintf ((STREAM), "\tALIGN\n|%s..%d|\n", (PREFIX), (NUM)) + +/* Assembler Commands for Alignment */ + +#define ASM_OUTPUT_SKIP(STREAM,NBYTES) \ + fprintf ((STREAM), "\t%%\t%d\n", (NBYTES)) + +#define ASM_OUTPUT_ALIGN(STREAM,POWER) \ +do { \ + register int amount = 1 << (POWER); \ + if (amount == 2) \ + fprintf ((STREAM), "\tALIGN 2\n"); \ + else if (amount == 4) \ + fprintf ((STREAM), "\tALIGN\n"); \ + else \ + fprintf ((STREAM), "\tALIGN %d\n", amount); \ +} while (0) + +#include "arm/arm.h" + +#undef DBX_DEBUGGING_INFO diff --git a/gcc/config/arm/aout.h b/gcc/config/arm/aout.h new file mode 100644 index 00000000000..7a4f29fffb6 --- /dev/null +++ b/gcc/config/arm/aout.h @@ -0,0 +1,264 @@ +/* Definitions of target machine for GNU compiler, for ARM with a.out + Copyright (C) 1995 Free Software Foundation, Inc. + Contributed by Richard Earnshaw (rearnsha@armltd.co.uk) + +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. */ + +#ifndef ARM_OS_NAME +#define ARM_OS_NAME "(generic)" +#endif + +/* The text to go at the start of the assembler file */ +#define ASM_FILE_START(STREAM) \ +{ \ + extern char *version_string; \ + fprintf (STREAM,"%s Generated by gcc %s for ARM/%s\n", \ + ASM_COMMENT_START, version_string, ARM_OS_NAME); \ + fprintf (STREAM,"%srfp\t.req\t%sr9\n", REGISTER_PREFIX, REGISTER_PREFIX); \ + fprintf (STREAM,"%ssl\t.req\t%sr10\n", REGISTER_PREFIX, REGISTER_PREFIX); \ + fprintf (STREAM,"%sfp\t.req\t%sr11\n", REGISTER_PREFIX, REGISTER_PREFIX); \ + fprintf (STREAM,"%sip\t.req\t%sr12\n", REGISTER_PREFIX, REGISTER_PREFIX); \ + fprintf (STREAM,"%ssp\t.req\t%sr13\n", REGISTER_PREFIX, REGISTER_PREFIX); \ + fprintf (STREAM,"%slr\t.req\t%sr14\n", REGISTER_PREFIX, REGISTER_PREFIX); \ + fprintf (STREAM,"%spc\t.req\t%sr15\n", REGISTER_PREFIX, REGISTER_PREFIX); \ +} + +#define ASM_APP_ON "" +#define ASM_APP_OFF "" + +/* Switch to the text or data segment. */ +#define TEXT_SECTION_ASM_OP ".text" +#define DATA_SECTION_ASM_OP ".data" + +#define REGISTER_PREFIX "" +#define USER_LABEL_PREFIX "_" +#define LOCAL_LABEL_PREFIX "" + +/* The assembler's names for the registers. */ +#ifndef REGISTER_NAMES +#define REGISTER_NAMES \ +{ \ + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ + "r8", "r9", "sl", "fp", "ip", "sp", "lr", "pc", \ + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ + "cc", "sfp", "afp" \ +} +#endif + +#ifndef ADDITIONAL_REGISTER_NAMES +#define ADDITIONAL_REGISTER_NAMES \ +{ \ + {"a1", 0}, \ + {"a2", 1}, \ + {"a3", 2}, \ + {"a4", 3}, \ + {"v1", 4}, \ + {"v2", 5}, \ + {"v3", 6}, \ + {"v4", 7}, \ + {"v5", 8}, \ + {"v6", 9}, \ + {"rfp", 9}, /* Gcc used to call it this */ \ + {"sb", 9}, \ + {"v7", 10}, \ + {"r10", 10}, /* sl */ \ + {"r11", 11}, /* fp */ \ + {"r12", 12}, /* ip */ \ + {"r13", 13}, /* sp */ \ + {"r14", 14}, /* lr */ \ + {"r15", 15} /* pc */ \ +} +#endif + +/* Arm Assembler barfs on dollars */ +#define DOLLARS_IN_IDENTIFIERS 0 + +#define NO_DOLLAR_IN_LABEL + +/* DBX register number for a given compiler register number */ +#define DBX_REGISTER_NUMBER(REGNO) (REGNO) + +/* Generate DBX debugging information. riscix.h will undefine this because + the native assembler does not support stabs. */ +#define DBX_DEBUGGING_INFO 1 + +/* Acorn dbx moans about continuation chars, so don't use any. */ +#ifndef DBX_CONTIN_LENGTH +#define DBX_CONTIN_LENGTH 0 +#endif + +/* Output a source filename for the debugger. RISCiX dbx insists that the + ``desc'' field is set to compiler version number >= 315 (sic). */ +#define DBX_OUTPUT_MAIN_SOURCE_FILENAME(STREAM,NAME) \ +do { \ + fprintf (STREAM, ".stabs \"%s\",%d,0,315,%s\n", (NAME), N_SO, \ + <ext_label_name[1]); \ + text_section (); \ + ASM_OUTPUT_INTERNAL_LABEL (STREAM, "Ltext", 0); \ +} while (0) + +/* Output a function label definition. */ +#define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \ + ASM_OUTPUT_LABEL(STREAM, NAME) + +#define ARM_OUTPUT_LABEL(STREAM,NAME) \ +do { \ + assemble_name (STREAM,NAME); \ + fputs (":\n", STREAM); \ +} while (0) + +/* Output a globalising directive for a label. */ +#define ASM_GLOBALIZE_LABEL(STREAM,NAME) \ + (fprintf (STREAM, "\t.global\t"), \ + assemble_name (STREAM, NAME), \ + fputc ('\n',STREAM)) \ + +/* Output a reference to a label. */ +#define ASM_OUTPUT_LABELREF(STREAM,NAME) \ + fprintf (STREAM, "%s%s", USER_LABEL_PREFIX, NAME) + +/* Make an internal label into a string. */ +#define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \ + sprintf (STRING, "*%s%d", PREFIX, NUM) + +/* Nothing special is done about jump tables */ +/* #define ASM_OUTPUT_CASE_LABEL(STREAM,PREFIX,NUM,TABLE) */ +/* #define ASM_OUTPUT_CASE_END(STREAM,NUM,TABLE) */ + +/* Construct a private name. */ +#define ASM_FORMAT_PRIVATE_NAME(OUTVAR,NAME,NUMBER) \ + ((OUTVAR) = (char *) alloca (strlen (NAME) + 10), \ + sprintf ((OUTVAR), "%s.%d", (NAME), (NUMBER))) + +/* Output an element of a dispatch table. */ +#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM,VALUE) \ + fprintf (STREAM, "\t.word\tL%d\n", VALUE) + +#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM,VALUE,REL) \ + fprintf (STREAM, "\tb\tL%d\n", (VALUE)) + +/* Output various types of constants. For real numbers we output hex, with + a comment containing the "human" value, this allows us to pass NaN's which + the riscix assembler doesn't understand (it also makes cross-assembling + less likely to fail). */ + +#define ASM_OUTPUT_LONG_DOUBLE(STREAM,VALUE) \ +do { char dstr[30]; \ + long l[3]; \ + arm_increase_location (12); \ + REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \ + REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \ + fprintf (STREAM, "\t.long 0x%lx,0x%lx,0x%lx\t%s long double %s\n", \ + l[0], l[1], l[2], ASM_COMMENT_START, dstr); \ + } while (0) + + +#define ASM_OUTPUT_DOUBLE(STREAM, VALUE) \ +do { char dstr[30]; \ + long l[2]; \ + arm_increase_location (8); \ + REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \ + REAL_VALUE_TO_DECIMAL (VALUE, "%.14g", dstr); \ + fprintf (STREAM, "\t.long 0x%lx, 0x%lx\t%s double %s\n", l[0], \ + l[1], ASM_COMMENT_START, dstr); \ + } while (0) + +#define ASM_OUTPUT_FLOAT(STREAM, VALUE) \ +do { char dstr[30]; \ + long l; \ + arm_increase_location (4); \ + REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \ + REAL_VALUE_TO_DECIMAL (VALUE, "%.7g", dstr); \ + fprintf (STREAM, "\t.word 0x%lx\t%s float %s\n", l, \ + ASM_COMMENT_START, dstr); \ + } while (0); + +#define ASM_OUTPUT_INT(STREAM, EXP) \ + (fprintf (STREAM, "\t.word\t"), \ + output_addr_const (STREAM, (EXP)), \ + arm_increase_location (4), \ + fputc ('\n', STREAM)) + +#define ASM_OUTPUT_SHORT(STREAM, EXP) \ + (fprintf (STREAM, "\t.short\t"), \ + output_addr_const (STREAM, (EXP)), \ + arm_increase_location (2), \ + fputc ('\n', STREAM)) + +#define ASM_OUTPUT_CHAR(STREAM, EXP) \ + (fprintf (STREAM, "\t.byte\t"), \ + output_addr_const (STREAM, (EXP)), \ + arm_increase_location (1), \ + fputc ('\n', STREAM)) + +#define ASM_OUTPUT_BYTE(STREAM, VALUE) \ + (fprintf (STREAM, "\t.byte\t%d\n", VALUE), \ + arm_increase_location (1)) + +#define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \ + output_ascii_pseudo_op ((STREAM), (unsigned char *)(PTR), (LEN)) + +/* Output a gap. In fact we fill it with nulls. */ +#define ASM_OUTPUT_SKIP(STREAM, NBYTES) \ + (arm_increase_location (NBYTES), \ + fprintf (STREAM, "\t.space\t%d\n", NBYTES)) + +/* Align output to a power of two. Horrible /bin/as. */ +#define ASM_OUTPUT_ALIGN(STREAM, POWER) \ + do \ + { \ + register int amount = 1 << (POWER); \ + extern int arm_text_location; \ + \ + if (amount == 2) \ + fprintf (STREAM, "\t.even\n"); \ + else \ + fprintf (STREAM, "\t.align\t%d\n", amount - 4); \ + \ + if (in_text_section ()) \ + arm_text_location = ((arm_text_location + amount - 1) \ + & ~(amount - 1)); \ + } while (0) + +/* Output a common block */ +#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \ + (fprintf (STREAM, "\t.comm\t"), \ + assemble_name ((STREAM), (NAME)), \ + fprintf(STREAM, ", %d\t%s %d\n", ROUNDED, ASM_COMMENT_START, SIZE)) + +/* Output a local common block. /bin/as can't do this, so hack a `.space' into + the bss segment. Note that this is *bad* practice. */ +#define ASM_OUTPUT_LOCAL(STREAM,NAME,SIZE,ROUNDED) \ + output_lcomm_directive (STREAM, NAME, SIZE, ROUNDED) + +/* Output a source line for the debugger. */ +/* #define ASM_OUTPUT_SOURCE_LINE(STREAM,LINE) */ + +/* Output a #ident directive. */ +#define ASM_OUTPUT_IDENT(STREAM,STRING) \ + fprintf (STREAM,"- - - ident %s\n",STRING) + +/* The assembler's parentheses characters. */ +#define ASM_OPEN_PAREN "(" +#define ASM_CLOSE_PAREN ")" + +#ifndef ASM_COMMENT_START +#define ASM_COMMENT_START "@" +#endif + +#include "arm/arm.h" diff --git a/gcc/config/arm/semiaof.h b/gcc/config/arm/semiaof.h new file mode 100644 index 00000000000..cb13a33381c --- /dev/null +++ b/gcc/config/arm/semiaof.h @@ -0,0 +1,49 @@ +/* Definitions of target machine for GNU compiler. ARM on semi-hosted platform + AOF Syntax assembler. + Copyright (C) 1995 Free Software Foundation, Inc. + Contributed by Richard Earnshaw (richard.earnshaw@armltd.co.uk) + +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 CPP_PREDEFINES \ + "-Darm -Dsemi -Acpu(arm) -Amachine(arm)" + +#define CPP_SPEC "%{m6:-D__arm6__} \ +%{mcpu-*:-D__%*} \ +%{mcpu=*:-D__%*} \ +%{mapcs-32:-D__APCS_32__ -U__APCS_26__} \ +%{mapcs-26:-D__APCS_26__ -U__APCS_32__} \ +%{!mapcs-32: %{!mapcs-26:-D__APCS_32__}} \ +%{msoft-float:-D__SOFTFP__} \ +%{mhard-float:-U__SOFTFP__} \ +%{!mhard-float: %{!msoft-float:-U__SOFTFP__}} \ +" + +#define ASM_SPEC "%{g -g} -arch 4 \ +-apcs 3%{mapcs-32:/32bit}%{mapcs-26:/26bit}%{!mapcs-26:%{!macps-32:/32bit}}" + +#define LIB_SPEC "%{Eb: armlib_h.32b%s}%{!Eb: armlib_h.32l%s}" + +#define TARGET_VERSION fputs (" (ARM/semi-hosted)", stderr); + +#define TARGET_DEFAULT ARM_FLAG_APCS_32 + +/* The Norcroft C library defines size_t as "unsigned int" */ +#define SIZE_TYPE "unsigned int" + +#include "arm/aof.h" diff --git a/gcc/config/arm/t-semiaof b/gcc/config/arm/t-semiaof new file mode 100644 index 00000000000..6f1dfca081c --- /dev/null +++ b/gcc/config/arm/t-semiaof @@ -0,0 +1,63 @@ +OLDCC = armcc -w +# Don't build enquire +ENQUIRE= +CROSS_LIBGCC1 = libgcc1-aof.a +LIBGCC2 = libgcc2-aof.a +LIBGCC = libgcc-aof.a +LIBGCC2_CFLAGS = -O2 -fomit-frame-pointer +LIBGCC1_TEST = #libgcc1-atest +EXTRA_PARTS = crtbegin.o crtend.o + +# Rule to build libgcc1.a and libgcc2.a and libgcc.a, since the librarian +# for the ARM tools is somewhat quirky, and needs a special rule to use it. +libgcc1-aof.a: libgcc1.c $(CONFIG_H) config.status + -rm -rf tmplib libgcc1.a libgcc1-aof.a tmplibgcc1.a + mkdir tmplib + for name in $(LIB1FUNCS); \ + do \ + echo $${name}; \ + rm -f $${name}$(objext); \ + $(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} $(srcdir)/libgcc1.c; \ + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + mv libgcc1$(objext) tmplib/$${name}$(objext); \ + done + (cd tmplib; \ + armlib -c tmplibgcc1.a *; \ + mv tmplibgcc1.a ..) + mv tmplibgcc1.a libgcc1-aof.a + rm -rf tmplib + +libgcc2-aof.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(LIB2FUNCS_EXTRA) \ + machmode.h longlong.h gbl-ctors.h config.status + -rm -f tmplibgcc2.a + -rm -rf tmplib + mkdir tmplib + for name in $(LIB2FUNCS); \ + do \ + echo $${name}; \ + $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \ + $(srcdir)/libgcc2.c -o tmplib/$${name}$(objext); \ + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + done + (cd tmplib; \ + armlib -c tmplibgcc2.a *; \ + mv tmplibgcc2.a ..) + mv tmplibgcc2.a libgcc2-aof.a + rm -rf tmplib + +# Combine the various libraries into a single library, libgcc.a. +libgcc-aof.a: $(CROSS_LIBGCC1) $(LIBGCC2) + -rm -rf tmplibgcc.a libgcc.a tmpcopy libgcc-aof.a + mkdir tmpcopy + (cd tmpcopy; armlib -e ../$(LIBGCC1) \*) + -(cd tmpcopy; chmod +w * > /dev/null 2>&1) + (cd tmpcopy; armlib -e ../$(LIBGCC2) \*) + (cd tmpcopy; armlib -co ../tmplibgcc.a *$(objext)) + rm -rf tmpcopy + mv tmplibgcc.a libgcc.a + ln libgcc.a libgcc-aof.a + +libgcc1-atest: libgcc1-test.o native $(GCC_PARTS) $(EXTRA_PARTS) + @echo "Testing libgcc1. Ignore linker warning messages." + $(GCC_FOR_TARGET) $(GCC_CFLAGS) libgcc1-test.o -o libgcc1-test \ + -v -- 2.11.4.GIT