comparison gcc/config/sparc/freebsd.h @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Definitions for Sun SPARC64 running FreeBSD using the ELF format 1 /* Definitions for Sun SPARC64 running FreeBSD using the ELF format
2 Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2010, 2011 2 Copyright (C) 2001-2017 Free Software Foundation, Inc.
3 Free Software Foundation, Inc.
4 Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi. 3 Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
5 4
6 This file is part of GCC. 5 This file is part of GCC.
7 6
8 GCC is free software; you can redistribute it and/or modify 7 GCC is free software; you can redistribute it and/or modify
22 #undef SUBTARGET_EXTRA_SPECS 21 #undef SUBTARGET_EXTRA_SPECS
23 #define SUBTARGET_EXTRA_SPECS \ 22 #define SUBTARGET_EXTRA_SPECS \
24 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER } 23 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
25 24
26 /* FreeBSD needs the platform name (sparc64) defined. 25 /* FreeBSD needs the platform name (sparc64) defined.
27 Emacs needs to know if the arch is 64 or 32-bits. */ 26 Emacs etc needs to know if the arch is 64 or 32-bits.
27 This also selects which targets are available via -mcpu. */
28 28
29 #undef CPP_CPU64_DEFAULT_SPEC 29 #undef FBSD_TARGET_CPU_CPP_BUILTINS
30 #define CPP_CPU64_DEFAULT_SPEC \ 30 #define FBSD_TARGET_CPU_CPP_BUILTINS() \
31 "-D__sparc64__ -D__sparc_v9__ -D__sparcv9 -D__arch64__" 31 do \
32 { \
33 builtin_define ("__sparc64__"); \
34 builtin_define ("__sparc__"); \
35 builtin_define ("__sparc_v9__"); \
36 builtin_define ("__sparcv9"); \
37 } \
38 while (0)
32 39
33 #undef ASM_SPEC 40 #undef ASM_SPEC
34 #define ASM_SPEC "%{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_cpu)" 41 #define ASM_SPEC "%{" FPIE_OR_FPIC_SPEC ":-K PIC} %(asm_cpu)"
35 42
36 #define LINK_SPEC "%(link_arch) \ 43 #define LINK_SPEC "%(link_arch) \
37 %{!mno-relax:%{!r:-relax}} \ 44 %{!mno-relax:%{!r:-relax}} \
38 %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \ 45 %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
39 %{assert*} %{R*} %{rpath*} %{defsym*} \ 46 %{assert*} %{R*} %{rpath*} %{defsym*} \
62 /* Define for support of TFmode long double. 69 /* Define for support of TFmode long double.
63 SPARC ABI says that long double is 4 words. */ 70 SPARC ABI says that long double is 4 words. */
64 #undef LONG_DOUBLE_TYPE_SIZE 71 #undef LONG_DOUBLE_TYPE_SIZE
65 #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64) 72 #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
66 73
67 /* Define this to set long double type size to use in libgcc2.c, which can
68 not depend on target_flags. */
69 #if defined(__arch64__) || defined(__LONG_DOUBLE_128__)
70 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
71 #else
72 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
73 #endif
74
75 /* Definitions for 64-bit SPARC running systems with ELF. */ 74 /* Definitions for 64-bit SPARC running systems with ELF. */
76
77 #undef TARGET_VERSION
78 #define TARGET_VERSION fprintf (stderr, " (FreeBSD/sparc64 ELF)");
79 75
80 #define TARGET_ELF 1 76 #define TARGET_ELF 1
81 77
82 /* XXX */ 78 /* XXX */
83 /* A 64 bit v9 compiler with stack-bias, 79 /* A 64 bit v9 compiler with stack-bias,
91 87
92 /* The default code model. */ 88 /* The default code model. */
93 #undef SPARC_DEFAULT_CMODEL 89 #undef SPARC_DEFAULT_CMODEL
94 #define SPARC_DEFAULT_CMODEL CM_MEDLOW 90 #define SPARC_DEFAULT_CMODEL CM_MEDLOW
95 91
96 #define ENABLE_EXECUTE_STACK \ 92 #define HAVE_ENABLE_EXECUTE_STACK
97 static int need_enable_exec_stack; \
98 static void check_enabling(void) __attribute__ ((constructor)); \
99 static void check_enabling(void) \
100 { \
101 extern int sysctlbyname(const char *, void *, size_t *, void *, size_t);\
102 int prot = 0; \
103 size_t len = sizeof(prot); \
104 \
105 sysctlbyname ("kern.stackprot", &prot, &len, NULL, 0); \
106 if (prot != 7) \
107 need_enable_exec_stack = 1; \
108 } \
109 extern void __enable_execute_stack (void *); \
110 void __enable_execute_stack (void *addr) \
111 { \
112 if (!need_enable_exec_stack) \
113 return; \
114 else { \
115 /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \
116 if (mprotect (addr, TRAMPOLINE_SIZE, 7) < 0) \
117 perror ("mprotect of trampoline code"); \
118 } \
119 }
120
121 93
122 /************************[ Assembler stuff ]********************************/ 94 /************************[ Assembler stuff ]********************************/
123 95
124 #undef LOCAL_LABEL_PREFIX 96 #undef LOCAL_LABEL_PREFIX
125 #define LOCAL_LABEL_PREFIX "." 97 #define LOCAL_LABEL_PREFIX "."
150 with their spec. On a 64-bit system, only 64-bit relocs become 122 with their spec. On a 64-bit system, only 64-bit relocs become
151 RELATIVE relocations. */ 123 RELATIVE relocations. */
152 124
153 /* #define DWARF_OFFSET_SIZE PTR_SIZE */ 125 /* #define DWARF_OFFSET_SIZE PTR_SIZE */
154 126
127 #ifdef HAVE_AS_TLS
128 #undef TARGET_SUN_TLS
129 #undef TARGET_GNU_TLS
130 #define TARGET_SUN_TLS 0
131 #define TARGET_GNU_TLS 1
132 #endif
133
155 #undef ENDFILE_SPEC 134 #undef ENDFILE_SPEC
156 #define ENDFILE_SPEC \ 135 #define ENDFILE_SPEC \
157 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \ 136 "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \
158 FBSD_ENDFILE_SPEC 137 FBSD_ENDFILE_SPEC
159 138
160 /* We use GNU ld so undefine this so that attribute((init_priority)) works. */ 139 /* We use GNU ld so undefine this so that attribute((init_priority)) works. */
161 #undef CTORS_SECTION_ASM_OP 140 #undef CTORS_SECTION_ASM_OP
162 #undef DTORS_SECTION_ASM_OP 141 #undef DTORS_SECTION_ASM_OP