comparison gcc/config/openbsd.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 /* Base configuration file for all OpenBSD targets. 1 /* Base configuration file for all OpenBSD targets.
2 Copyright (C) 1999, 2000, 2004, 2005, 2007, 2009, 2010 2 Copyright (C) 1999-2017 Free Software Foundation, Inc.
3 Free Software Foundation, Inc.
4 3
5 This file is part of GCC. 4 This file is part of GCC.
6 5
7 GCC is free software; you can redistribute it and/or modify 6 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 7 it under the terms of the GNU General Public License as published by
57 #define INCLUDE_DEFAULTS \ 56 #define INCLUDE_DEFAULTS \
58 { \ 57 { \
59 { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \ 58 { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \
60 { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1 }, \ 59 { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1 }, \
61 { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1 }, \ 60 { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1 }, \
62 { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0 }, \ 61 { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0 }, \
63 { 0, 0, 0, 0 } \ 62 { 0, 0, 0, 0 } \
64 } 63 }
65 64
66 /* Under OpenBSD, the normal location of the various *crt*.o files is the 65 /* Under OpenBSD, the normal location of the various *crt*.o files is the
67 /usr/lib directory. */ 66 /usr/lib directory. */
125 #ifdef OBSD_OLD_GAS 124 #ifdef OBSD_OLD_GAS
126 /* ASM_SPEC appropriate for OpenBSD. For some architectures, OpenBSD 125 /* ASM_SPEC appropriate for OpenBSD. For some architectures, OpenBSD
127 still uses a special flavor of gas that needs to be told when generating 126 still uses a special flavor of gas that needs to be told when generating
128 pic code. */ 127 pic code. */
129 #undef ASM_SPEC 128 #undef ASM_SPEC
130 #define ASM_SPEC "%{fpic|fpie:-k} %{fPIC|fPIE:-k -K}" 129 #define ASM_SPEC "%{" FPIE1_OR_FPIC1_SPEC ":-k} %{" FPIE2_OR_FPIC2_SPEC ":-k -K}"
131 #endif 130 #endif
132 131
133 /* Since we use gas, stdin -> - is a good idea. */ 132 /* Since we use gas, stdin -> - is a good idea. */
134 #define AS_NEEDS_DASH_FOR_PIPED_INPUT 133 #define AS_NEEDS_DASH_FOR_PIPED_INPUT
135 134
136 #undef LIB_SPEC 135 #undef LIB_SPEC
137 #define LIB_SPEC OBSD_LIB_SPEC 136 #define LIB_SPEC OBSD_LIB_SPEC
138 137
139 #if defined(HAVE_LD_EH_FRAME_HDR) 138 #if defined(HAVE_LD_EH_FRAME_HDR)
140 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " 139 #define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
141 #endif 140 #endif
142 141
143 #undef LIB_SPEC 142 #undef LIB_SPEC
144 #define LIB_SPEC OBSD_LIB_SPEC 143 #define LIB_SPEC OBSD_LIB_SPEC
145 #endif 144 #endif
146 145
147 #define TARGET_POSIX_IO 146 #define TARGET_POSIX_IO
147
148 /* All new versions of OpenBSD have C99 functions. We redefine this hook
149 so the version from elfos.h header won't be used. */
150 #undef TARGET_LIBC_HAS_FUNCTION
151 #define TARGET_LIBC_HAS_FUNCTION default_libc_has_function
152
148 153
149 /* Runtime target specification. */ 154 /* Runtime target specification. */
150 155
151 /* Miscellaneous parameters. */ 156 /* Miscellaneous parameters. */
152 157
279 #endif 284 #endif
280 285
281 /* Storage layout. */ 286 /* Storage layout. */
282 287
283 288
284 /* Stack is explicitly denied execution rights on OpenBSD platforms. */ 289 #define HAVE_ENABLE_EXECUTE_STACK
285 #define ENABLE_EXECUTE_STACK \
286 extern void __enable_execute_stack (void *); \
287 void \
288 __enable_execute_stack (void *addr) \
289 { \
290 long size = getpagesize (); \
291 long mask = ~(size-1); \
292 char *page = (char *) (((long) addr) & mask); \
293 char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \
294 \
295 if (mprotect (page, end - page, PROT_READ | PROT_WRITE | PROT_EXEC) < 0) \
296 perror ("mprotect of trampoline code"); \
297 }
298
299 #include <sys/types.h>
300 #include <sys/mman.h>