xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/glibc-d.c (revision 4c3eb207d36f67d31994830c0a694161fc1ca39b)
1627f7eb2Smrg /* Glibc support needed only by D front-end.
2*4c3eb207Smrg    Copyright (C) 2017-2020 Free Software Foundation, Inc.
3627f7eb2Smrg 
4627f7eb2Smrg GCC is free software; you can redistribute it and/or modify it under
5627f7eb2Smrg the terms of the GNU General Public License as published by the Free
6627f7eb2Smrg Software Foundation; either version 3, or (at your option) any later
7627f7eb2Smrg version.
8627f7eb2Smrg 
9627f7eb2Smrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
10627f7eb2Smrg WARRANTY; without even the implied warranty of MERCHANTABILITY or
11627f7eb2Smrg FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12627f7eb2Smrg for more details.
13627f7eb2Smrg 
14627f7eb2Smrg You should have received a copy of the GNU General Public License
15627f7eb2Smrg along with GCC; see the file COPYING3.  If not see
16627f7eb2Smrg <http://www.gnu.org/licenses/>.  */
17627f7eb2Smrg 
18627f7eb2Smrg #include "config.h"
19627f7eb2Smrg #include "system.h"
20627f7eb2Smrg #include "coretypes.h"
21627f7eb2Smrg #include "tm.h"
22627f7eb2Smrg #include "memmodel.h"
23627f7eb2Smrg #include "tm_p.h"
24627f7eb2Smrg #include "d/d-target.h"
25627f7eb2Smrg #include "d/d-target-def.h"
26627f7eb2Smrg 
27627f7eb2Smrg /* Implement TARGET_D_OS_VERSIONS for Glibc targets.  */
28627f7eb2Smrg 
29627f7eb2Smrg static void
glibc_d_os_builtins(void)30627f7eb2Smrg glibc_d_os_builtins (void)
31627f7eb2Smrg {
32627f7eb2Smrg   d_add_builtin_version ("Posix");
33627f7eb2Smrg 
34627f7eb2Smrg #define builtin_version(TXT) d_add_builtin_version (TXT)
35627f7eb2Smrg 
36627f7eb2Smrg #ifdef GNU_USER_TARGET_D_OS_VERSIONS
37627f7eb2Smrg   GNU_USER_TARGET_D_OS_VERSIONS ();
38627f7eb2Smrg #endif
39627f7eb2Smrg 
40627f7eb2Smrg #ifdef EXTRA_TARGET_D_OS_VERSIONS
41627f7eb2Smrg   EXTRA_TARGET_D_OS_VERSIONS ();
42627f7eb2Smrg #endif
43627f7eb2Smrg }
44627f7eb2Smrg 
45627f7eb2Smrg /* Implement TARGET_D_CRITSEC_SIZE for Glibc targets.  */
46627f7eb2Smrg 
47627f7eb2Smrg static unsigned
glibc_d_critsec_size(void)48627f7eb2Smrg glibc_d_critsec_size (void)
49627f7eb2Smrg {
50627f7eb2Smrg   /* This is the sizeof pthread_mutex_t.  */
51627f7eb2Smrg #ifdef GNU_USER_TARGET_D_CRITSEC_SIZE
52627f7eb2Smrg   return GNU_USER_TARGET_D_CRITSEC_SIZE;
53627f7eb2Smrg #else
54627f7eb2Smrg   return (POINTER_SIZE == 64) ? 40 : 24;
55627f7eb2Smrg #endif
56627f7eb2Smrg }
57627f7eb2Smrg 
58627f7eb2Smrg #undef TARGET_D_OS_VERSIONS
59627f7eb2Smrg #define TARGET_D_OS_VERSIONS glibc_d_os_builtins
60627f7eb2Smrg 
61627f7eb2Smrg #undef TARGET_D_CRITSEC_SIZE
62627f7eb2Smrg #define TARGET_D_CRITSEC_SIZE glibc_d_critsec_size
63627f7eb2Smrg 
64627f7eb2Smrg struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;
65