| 1 |
282 |
jeremybenn |
/* Definitions of MCore target.
|
| 2 |
|
|
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2007
|
| 3 |
|
|
Free Software Foundation, Inc.
|
| 4 |
|
|
Contributed by Cygnus Solutions.
|
| 5 |
|
|
|
| 6 |
|
|
This file is part of GCC.
|
| 7 |
|
|
|
| 8 |
|
|
GCC is free software; you can redistribute it and/or modify
|
| 9 |
|
|
it under the terms of the GNU General Public License as published by
|
| 10 |
|
|
the Free Software Foundation; either version 3, or (at your option)
|
| 11 |
|
|
any later version.
|
| 12 |
|
|
|
| 13 |
|
|
GCC is distributed in the hope that it will be useful,
|
| 14 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 15 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 16 |
|
|
GNU General Public License for more details.
|
| 17 |
|
|
|
| 18 |
|
|
You should have received a copy of the GNU General Public License
|
| 19 |
|
|
along with GCC; see the file COPYING3. If not see
|
| 20 |
|
|
<http://www.gnu.org/licenses/>. */
|
| 21 |
|
|
|
| 22 |
|
|
#ifndef __MCORE_ELF_H__
|
| 23 |
|
|
#define __MCORE_ELF_H__
|
| 24 |
|
|
|
| 25 |
|
|
/* Run-time Target Specification. */
|
| 26 |
|
|
#define TARGET_VERSION fputs (" (Motorola MCORE/elf)", stderr)
|
| 27 |
|
|
|
| 28 |
|
|
/* Use DWARF2 debugging info. */
|
| 29 |
|
|
#define DWARF2_DEBUGGING_INFO 1
|
| 30 |
|
|
|
| 31 |
|
|
#undef PREFERRED_DEBUGGING_TYPE
|
| 32 |
|
|
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
|
| 33 |
|
|
|
| 34 |
|
|
#define MCORE_EXPORT_NAME(STREAM, NAME) \
|
| 35 |
|
|
do \
|
| 36 |
|
|
{ \
|
| 37 |
|
|
fprintf (STREAM, "\t.section .exports\n"); \
|
| 38 |
|
|
fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \
|
| 39 |
|
|
(* targetm.strip_name_encoding) (NAME)); \
|
| 40 |
|
|
in_section = NULL; \
|
| 41 |
|
|
} \
|
| 42 |
|
|
while (0);
|
| 43 |
|
|
|
| 44 |
|
|
/* Write the extra assembler code needed to declare a function properly.
|
| 45 |
|
|
Some svr4 assemblers need to also have something extra said about the
|
| 46 |
|
|
function's return value. We allow for that here. */
|
| 47 |
|
|
#undef ASM_DECLARE_FUNCTION_NAME
|
| 48 |
|
|
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
|
| 49 |
|
|
do \
|
| 50 |
|
|
{ \
|
| 51 |
|
|
if (mcore_dllexport_name_p (NAME)) \
|
| 52 |
|
|
{ \
|
| 53 |
|
|
MCORE_EXPORT_NAME (FILE, NAME); \
|
| 54 |
|
|
switch_to_section (function_section (DECL)); \
|
| 55 |
|
|
} \
|
| 56 |
|
|
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
|
| 57 |
|
|
ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
|
| 58 |
|
|
ASM_OUTPUT_LABEL (FILE, NAME); \
|
| 59 |
|
|
} \
|
| 60 |
|
|
while (0)
|
| 61 |
|
|
|
| 62 |
|
|
/* Write the extra assembler code needed to declare an object properly. */
|
| 63 |
|
|
#undef ASM_DECLARE_OBJECT_NAME
|
| 64 |
|
|
#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
|
| 65 |
|
|
do \
|
| 66 |
|
|
{ \
|
| 67 |
|
|
HOST_WIDE_INT size; \
|
| 68 |
|
|
if (mcore_dllexport_name_p (NAME)) \
|
| 69 |
|
|
{ \
|
| 70 |
|
|
section *save_section = in_section; \
|
| 71 |
|
|
MCORE_EXPORT_NAME (FILE, NAME); \
|
| 72 |
|
|
switch_to_section (save_section); \
|
| 73 |
|
|
} \
|
| 74 |
|
|
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
|
| 75 |
|
|
size_directive_output = 0; \
|
| 76 |
|
|
if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
|
| 77 |
|
|
{ \
|
| 78 |
|
|
size_directive_output = 1; \
|
| 79 |
|
|
size = int_size_in_bytes (TREE_TYPE (DECL)); \
|
| 80 |
|
|
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
|
| 81 |
|
|
} \
|
| 82 |
|
|
ASM_OUTPUT_LABEL(FILE, NAME); \
|
| 83 |
|
|
} \
|
| 84 |
|
|
while (0)
|
| 85 |
|
|
|
| 86 |
|
|
/* Output the size directive for a decl in rest_of_decl_compilation
|
| 87 |
|
|
in the case where we did not do so before the initializer.
|
| 88 |
|
|
Once we find the error_mark_node, we know that the value of
|
| 89 |
|
|
size_directive_output was set
|
| 90 |
|
|
by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
|
| 91 |
|
|
#undef ASM_FINISH_DECLARE_OBJECT
|
| 92 |
|
|
#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
|
| 93 |
|
|
do \
|
| 94 |
|
|
{ \
|
| 95 |
|
|
const char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
|
| 96 |
|
|
HOST_WIDE_INT size; \
|
| 97 |
|
|
if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
|
| 98 |
|
|
&& ! AT_END && TOP_LEVEL \
|
| 99 |
|
|
&& DECL_INITIAL (DECL) == error_mark_node \
|
| 100 |
|
|
&& !size_directive_output) \
|
| 101 |
|
|
{ \
|
| 102 |
|
|
size_directive_output = 1; \
|
| 103 |
|
|
size = int_size_in_bytes (TREE_TYPE (DECL)); \
|
| 104 |
|
|
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
|
| 105 |
|
|
} \
|
| 106 |
|
|
} \
|
| 107 |
|
|
while (0)
|
| 108 |
|
|
|
| 109 |
|
|
|
| 110 |
|
|
#undef STARTFILE_SPEC
|
| 111 |
|
|
#define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
|
| 112 |
|
|
|
| 113 |
|
|
/* Include the OS stub library, so that the code can be simulated.
|
| 114 |
|
|
This is not the right way to do this. Ideally this kind of thing
|
| 115 |
|
|
should be done in the linker script - but I have not worked out how
|
| 116 |
|
|
to specify the location of a linker script in a gcc command line yet. */
|
| 117 |
|
|
#undef ENDFILE_SPEC
|
| 118 |
|
|
#define ENDFILE_SPEC "%{!mno-lsim:-lsim} crtend.o%s crtn.o%s"
|
| 119 |
|
|
|
| 120 |
|
|
/* The subroutine calls in the .init and .fini sections create literal
|
| 121 |
|
|
pools which must be jumped around.... */
|
| 122 |
|
|
#define FORCE_CODE_SECTION_ALIGN asm ("br 1f ; .literals ; 1:");
|
| 123 |
|
|
|
| 124 |
|
|
#undef CTORS_SECTION_ASM_OP
|
| 125 |
|
|
#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\""
|
| 126 |
|
|
#undef DTORS_SECTION_ASM_OP
|
| 127 |
|
|
#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\""
|
| 128 |
|
|
|
| 129 |
|
|
#endif /* __MCORE_ELF_H__ */
|