[8833] | 1 | /* Definitions of various defaults for how to do assembler output |
---|
| 2 | (most of which are designed to be appropriate for GAS or for |
---|
| 3 | some BSD assembler). |
---|
| 4 | |
---|
| 5 | Written by Ron Guilmette (rfg@netcom.com) |
---|
| 6 | |
---|
| 7 | Copyright (C) 1992 Free Software Foundation, Inc. |
---|
| 8 | |
---|
| 9 | This file is part of GNU CC. |
---|
| 10 | |
---|
| 11 | GNU CC is free software; you can redistribute it and/or modify |
---|
| 12 | it under the terms of the GNU General Public License as published by |
---|
| 13 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 14 | any later version. |
---|
| 15 | |
---|
| 16 | GNU CC is distributed in the hope that it will be useful, |
---|
| 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 19 | GNU General Public License for more details. |
---|
| 20 | |
---|
| 21 | You should have received a copy of the GNU General Public License |
---|
| 22 | along with GNU CC; see the file COPYING. If not, write to |
---|
| 23 | the Free Software Foundation, 59 Temple Place - Suite 330, |
---|
| 24 | Boston, MA 02111-1307, USA. */ |
---|
| 25 | |
---|
| 26 | /* Store in OUTPUT a string (made with alloca) containing |
---|
| 27 | an assembler-name for a local static variable or function named NAME. |
---|
| 28 | LABELNO is an integer which is different for each call. */ |
---|
| 29 | |
---|
| 30 | #ifndef ASM_FORMAT_PRIVATE_NAME |
---|
| 31 | #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ |
---|
| 32 | do { \ |
---|
| 33 | int len = strlen (NAME); \ |
---|
| 34 | char *temp = (char *) alloca (len + 3); \ |
---|
| 35 | temp[0] = 'L'; \ |
---|
| 36 | strcpy (&temp[1], (NAME)); \ |
---|
| 37 | temp[len + 1] = '.'; \ |
---|
| 38 | temp[len + 2] = 0; \ |
---|
| 39 | (OUTPUT) = (char *) alloca (strlen (NAME) + 11); \ |
---|
| 40 | ASM_GENERATE_INTERNAL_LABEL (OUTPUT, temp, LABELNO); \ |
---|
| 41 | } while (0) |
---|
| 42 | #endif |
---|
| 43 | |
---|
| 44 | #ifndef ASM_STABD_OP |
---|
| 45 | #define ASM_STABD_OP ".stabd" |
---|
| 46 | #endif |
---|
| 47 | |
---|
| 48 | /* This is how to output an element of a case-vector that is absolute. |
---|
| 49 | Some targets don't use this, but we have to define it anyway. */ |
---|
| 50 | |
---|
| 51 | #ifndef ASM_OUTPUT_ADDR_VEC_ELT |
---|
| 52 | #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ |
---|
| 53 | do { fprintf (FILE, "\t%s\t", ASM_LONG); \ |
---|
| 54 | ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", (VALUE)); \ |
---|
| 55 | fputc ('\n', FILE); \ |
---|
| 56 | } while (0) |
---|
| 57 | #endif |
---|
| 58 | |
---|
| 59 | /* This is how to output an element of a case-vector that is relative. |
---|
| 60 | Some targets don't use this, but we have to define it anyway. */ |
---|
| 61 | |
---|
| 62 | #ifndef ASM_OUTPUT_ADDR_DIFF_ELT |
---|
| 63 | #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \ |
---|
| 64 | do { fprintf (FILE, "\t%s\t", ASM_SHORT); \ |
---|
| 65 | ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", (VALUE)); \ |
---|
| 66 | fputc ('-', FILE); \ |
---|
| 67 | ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", (REL)); \ |
---|
| 68 | fputc ('\n', FILE); \ |
---|
| 69 | } while (0) |
---|
| 70 | #endif |
---|
| 71 | |
---|
| 72 | /* choose a reasonable default for ASM_OUTPUT_ASCII. */ |
---|
| 73 | |
---|
| 74 | #ifndef ASM_OUTPUT_ASCII |
---|
| 75 | #define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \ |
---|
| 76 | do { \ |
---|
| 77 | FILE *_hide_asm_out_file = (MYFILE); \ |
---|
| 78 | unsigned char *_hide_p = (unsigned char *) (MYSTRING); \ |
---|
| 79 | int _hide_thissize = (MYLENGTH); \ |
---|
| 80 | { \ |
---|
| 81 | FILE *asm_out_file = _hide_asm_out_file; \ |
---|
| 82 | unsigned char *p = _hide_p; \ |
---|
| 83 | int thissize = _hide_thissize; \ |
---|
| 84 | int i; \ |
---|
| 85 | fprintf (asm_out_file, "\t.ascii \""); \ |
---|
| 86 | \ |
---|
| 87 | for (i = 0; i < thissize; i++) \ |
---|
| 88 | { \ |
---|
| 89 | register int c = p[i]; \ |
---|
| 90 | if (c == '\"' || c == '\\') \ |
---|
| 91 | putc ('\\', asm_out_file); \ |
---|
| 92 | if (c >= ' ' && c < 0177) \ |
---|
| 93 | putc (c, asm_out_file); \ |
---|
| 94 | else \ |
---|
| 95 | { \ |
---|
| 96 | fprintf (asm_out_file, "\\%o", c); \ |
---|
| 97 | /* After an octal-escape, if a digit follows, \ |
---|
| 98 | terminate one string constant and start another. \ |
---|
| 99 | The Vax assembler fails to stop reading the escape \ |
---|
| 100 | after three digits, so this is the only way we \ |
---|
| 101 | can get it to parse the data properly. */ \ |
---|
| 102 | if (i < thissize - 1 \ |
---|
| 103 | && p[i + 1] >= '0' && p[i + 1] <= '9') \ |
---|
| 104 | fprintf (asm_out_file, "\"\n\t.ascii \""); \ |
---|
| 105 | } \ |
---|
| 106 | } \ |
---|
| 107 | fprintf (asm_out_file, "\"\n"); \ |
---|
| 108 | } \ |
---|
| 109 | } \ |
---|
| 110 | while (0) |
---|
| 111 | #endif |
---|
| 112 | |
---|
| 113 | #ifndef ASM_IDENTIFY_GCC |
---|
| 114 | /* Default the definition, only if ASM_IDENTIFY_GCC is not set, |
---|
| 115 | because if it is set, we might not want ASM_IDENTIFY_LANGUAGE |
---|
| 116 | outputting labels, if we do want it to, then it must be defined |
---|
| 117 | in the tm.h file. */ |
---|
| 118 | #ifndef ASM_IDENTIFY_LANGUAGE |
---|
| 119 | #define ASM_IDENTIFY_LANGUAGE(FILE) output_lang_identify (FILE); |
---|
| 120 | #endif |
---|
| 121 | #endif |
---|
| 122 | |
---|
| 123 | /* This is how we tell the assembler to equate two values. */ |
---|
| 124 | #ifdef SET_ASM_OP |
---|
| 125 | #ifndef ASM_OUTPUT_DEF |
---|
| 126 | #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ |
---|
| 127 | do { fprintf ((FILE), "\t%s\t", SET_ASM_OP); \ |
---|
| 128 | assemble_name (FILE, LABEL1); \ |
---|
| 129 | fprintf (FILE, ","); \ |
---|
| 130 | assemble_name (FILE, LABEL2); \ |
---|
| 131 | fprintf (FILE, "\n"); \ |
---|
| 132 | } while (0) |
---|
| 133 | #endif |
---|
| 134 | #endif |
---|
| 135 | |
---|
| 136 | /* This determines whether or not we support weak symbols. */ |
---|
| 137 | #ifndef SUPPORTS_WEAK |
---|
| 138 | #ifdef ASM_WEAKEN_LABEL |
---|
| 139 | #define SUPPORTS_WEAK 1 |
---|
| 140 | #else |
---|
| 141 | #define SUPPORTS_WEAK 0 |
---|
| 142 | #endif |
---|
| 143 | #endif |
---|