OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [config/] [netbsd.h] - Blame information for rev 328

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 282 jeremybenn
/* Base configuration file for all NetBSD targets.
2
   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
3
   2007 Free Software Foundation, Inc.
4
 
5
This file is part of GCC.
6
 
7
GCC is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 3, or (at your option)
10
any later version.
11
 
12
GCC is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with GCC; see the file COPYING3.  If not see
19
<http://www.gnu.org/licenses/>.  */
20
 
21
/* TARGET_OS_CPP_BUILTINS() common to all NetBSD targets.  */
22
#define NETBSD_OS_CPP_BUILTINS_COMMON()         \
23
  do                                            \
24
    {                                           \
25
      builtin_define ("__NetBSD__");            \
26
      builtin_define ("__unix__");              \
27
      builtin_assert ("system=bsd");            \
28
      builtin_assert ("system=unix");           \
29
      builtin_assert ("system=NetBSD");         \
30
    }                                           \
31
  while (0)
32
 
33
/* CPP_SPEC parts common to all NetBSD targets.  */
34
#define NETBSD_CPP_SPEC                         \
35
  "%{posix:-D_POSIX_SOURCE} \
36
   %{pthread:-D_REENTRANT -D_PTHREADS}"
37
 
38
/* NETBSD_NATIVE is defined when gcc is integrated into the NetBSD
39
   source tree so it can be configured appropriately without using
40
   the GNU configure/build mechanism.  */
41
 
42
#ifdef NETBSD_NATIVE
43
 
44
/* Look for the include files in the system-defined places.  */
45
 
46
#undef GPLUSPLUS_INCLUDE_DIR
47
#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++"
48
 
49
#undef GCC_INCLUDE_DIR
50
#define GCC_INCLUDE_DIR "/usr/include"
51
 
52
#undef INCLUDE_DEFAULTS
53
#define INCLUDE_DEFAULTS                        \
54
  {                                             \
55
    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },     \
56
    { GCC_INCLUDE_DIR, "GCC", 0, 0 },             \
57
    { 0, 0, 0, 0 }                          \
58
  }
59
 
60
/* Under NetBSD, the normal location of the compiler back ends is the
61
   /usr/libexec directory.  */
62
 
63
#undef STANDARD_EXEC_PREFIX
64
#define STANDARD_EXEC_PREFIX            "/usr/libexec/"
65
 
66
/* Under NetBSD, the normal location of the various *crt*.o files is the
67
   /usr/lib directory.  */
68
 
69
#undef STANDARD_STARTFILE_PREFIX
70
#define STANDARD_STARTFILE_PREFIX       "/usr/lib/"
71
 
72
#endif /* NETBSD_NATIVE */
73
 
74
 
75
/* Provide a LIB_SPEC appropriate for NetBSD.  Here we:
76
 
77
   1. Select the appropriate set of libs, depending on whether we're
78
      profiling.
79
 
80
   2. Include the pthread library if -pthread is specified (only
81
      if threads are enabled).
82
 
83
   3. Include the posix library if -posix is specified.
84
 
85
   FIXME: Could eliminate the duplication here if we were allowed to
86
   use string concatenation.  */
87
 
88
#ifdef NETBSD_ENABLE_PTHREADS
89
#define NETBSD_LIB_SPEC         \
90
  "%{pthread:                   \
91
     %{!p:                      \
92
       %{!pg:-lpthread}}        \
93
     %{p:-lpthread_p}           \
94
     %{pg:-lpthread_p}}         \
95
   %{posix:                     \
96
     %{!p:                      \
97
       %{!pg:-lposix}}          \
98
     %{p:-lposix_p}             \
99
     %{pg:-lposix_p}}           \
100
   %{!shared:                   \
101
     %{!symbolic:               \
102
       %{!p:                    \
103
         %{!pg:-lc}}            \
104
       %{p:-lc_p}               \
105
       %{pg:-lc_p}}}"
106
#else
107
#define NETBSD_LIB_SPEC         \
108
  "%{posix:                     \
109
     %{!p:                      \
110
       %{!pg:-lposix}}          \
111
     %{p:-lposix_p}             \
112
     %{pg:-lposix_p}}           \
113
   %{!shared:                   \
114
     %{!symbolic:               \
115
       %{!p:                    \
116
         %{!pg:-lc}}            \
117
       %{p:-lc_p}               \
118
       %{pg:-lc_p}}}"
119
#endif
120
 
121
#undef LIB_SPEC
122
#define LIB_SPEC NETBSD_LIB_SPEC
123
 
124
/* Provide a LIBGCC_SPEC appropriate for NetBSD.  We also want to exclude
125
   libgcc with -symbolic.  */
126
 
127
#ifdef NETBSD_NATIVE
128
#define NETBSD_LIBGCC_SPEC      \
129
  "%{!symbolic:                 \
130
     %{!shared:                 \
131
       %{!p:                    \
132
         %{!pg: -lgcc}}}        \
133
     %{shared: -lgcc_pic}       \
134
     %{p: -lgcc_p}              \
135
     %{pg: -lgcc_p}}"
136
#else
137
#define NETBSD_LIBGCC_SPEC "%{!shared:%{!symbolic: -lgcc}}"
138
#endif
139
 
140
#undef LIBGCC_SPEC
141
#define LIBGCC_SPEC NETBSD_LIBGCC_SPEC
142
 
143
/* When building shared libraries, the initialization and finalization
144
   functions for the library are .init and .fini respectively.  */
145
 
146
#define COLLECT_SHARED_INIT_FUNC(STREAM,FUNC)                           \
147
  do {                                                                  \
148
    fprintf ((STREAM), "void __init() __asm__ (\".init\");");           \
149
    fprintf ((STREAM), "void __init() {\n\t%s();\n}\n", (FUNC));        \
150
  } while (0)
151
 
152
#define COLLECT_SHARED_FINI_FUNC(STREAM,FUNC)                           \
153
  do {                                                                  \
154
    fprintf ((STREAM), "void __fini() __asm__ (\".fini\");");           \
155
    fprintf ((STREAM), "void __fini() {\n\t%s();\n}\n", (FUNC));        \
156
  } while (0)
157
 
158
#undef TARGET_POSIX_IO
159
#define TARGET_POSIX_IO
160
 
161
/* Handle #pragma weak and #pragma pack.  */
162
 
163
#define HANDLE_SYSV_PRAGMA 1
164
 
165
/* Don't assume anything about the header files.  */
166
#undef  NO_IMPLICIT_EXTERN_C
167
#define NO_IMPLICIT_EXTERN_C    1
168
 
169
/* Define some types that are the same on all NetBSD platforms,
170
   making them agree with <machine/ansi.h>.  */
171
 
172
#undef WCHAR_TYPE
173
#define WCHAR_TYPE "int"
174
 
175
#undef WCHAR_TYPE_SIZE
176
#define WCHAR_TYPE_SIZE 32
177
 
178
#undef WINT_TYPE
179
#define WINT_TYPE "int"
180
 
181
 
182
/* Attempt to turn on execute permission for the stack.  This may be
183
   used by TARGET_TRAMPOLINE_INIT if the target needs it (that is,
184
   if the target machine can change execute permissions on a page).
185
 
186
   There is no way to query the execute permission of the stack, so
187
   we always issue the mprotect() call.
188
 
189
   Note that we go out of our way to use namespace-non-invasive calls
190
   here.  Unfortunately, there is no libc-internal name for mprotect().
191
 
192
   Also note that no errors should be emitted by this code; it is considered
193
   dangerous for library calls to send messages to stdout/stderr.  */
194
 
195
#define NETBSD_ENABLE_EXECUTE_STACK                                     \
196
extern void __enable_execute_stack (void *);                            \
197
void                                                                    \
198
__enable_execute_stack (void *addr)                                     \
199
{                                                                       \
200
  extern int mprotect (void *, size_t, int);                            \
201
  extern int __sysctl (int *, unsigned int, void *, size_t *,           \
202
                       void *, size_t);                                 \
203
                                                                        \
204
  static int size;                                                      \
205
  static long mask;                                                     \
206
                                                                        \
207
  char *page, *end;                                                     \
208
                                                                        \
209
  if (size == 0)                                                 \
210
    {                                                                   \
211
      int mib[2];                                                       \
212
      size_t len;                                                       \
213
                                                                        \
214
      mib[0] = 6; /* CTL_HW */                                           \
215
      mib[1] = 7; /* HW_PAGESIZE */                                     \
216
      len = sizeof (size);                                              \
217
      (void) __sysctl (mib, 2, &size, &len, NULL, 0);                    \
218
      mask = ~((long) size - 1);                                        \
219
    }                                                                   \
220
                                                                        \
221
  page = (char *) (((long) addr) & mask);                               \
222
  end  = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size);  \
223
                                                                        \
224
  /* 7 == PROT_READ | PROT_WRITE | PROT_EXEC */                         \
225
  (void) mprotect (page, end - page, 7);                                \
226
}
227
 
228
/* Define this so we can compile MS code for use with WINE.  */
229
#define HANDLE_PRAGMA_PACK_PUSH_POP 1

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.