1 /* Base configuration file for all DragonFly targets.
2    Copyright (C) 2014-2018 Free Software Foundation, Inc.
3    Contributed by John Marino <gnugcc@marino.st>
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 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
20 
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24 <http://www.gnu.org/licenses/>.  */
25 
26 #undef  TARGET_OS_CPP_BUILTINS
27 #define TARGET_OS_CPP_BUILTINS()            \
28   do                                        \
29     {                                       \
30        builtin_define_std ("unix");         \
31        builtin_define ("__DragonFly__");    \
32        builtin_assert ("system=unix");      \
33        builtin_assert ("system=bsd");       \
34        builtin_assert ("system=DragonFly"); \
35     }                                       \
36   while (0)
37 
38 #undef  CPP_SPEC
39 #define CPP_SPEC \
40  "%(cpp_cpu) %(cpp_arch) %{posix:-D_POSIX_SOURCE}"
41 
42 #undef  STARTFILE_SPEC
43 #define STARTFILE_SPEC	\
44   "%{!shared: \
45      %{pg:gcrt1.o%s} \
46      %{!pg: \
47        %{p:gcrt1.o%s} \
48        %{!p: \
49          %{profile: gcrt1.o%s} \
50          %{!profile: \
51            %{pie: Scrt1.o%s;:crt1.o%s}}}}} \
52    crti.o%s \
53    %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
54 
55 #undef  ENDFILE_SPEC
56 #define ENDFILE_SPEC \
57   "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
58 
59 #undef  LIB_SPEC
60 #define LIB_SPEC \
61   "%{pthread:-lpthread} -lc"
62 
63 #if defined(HAVE_LD_EH_FRAME_HDR)
64 #define LINK_EH_SPEC "--eh-frame-hdr"
65 #endif
66 
67 /* Provide a LINK_SPEC appropriate for DragonFly.  Here we provide support
68    for the special GCC options -static and -shared, which allow us to
69    link things in one of these three modes by applying the appropriate
70    combinations of options at link-time.
71 
72    When the -shared link option is used a final link is not being
73    done.  */
74 
75 #define DFBSD_LINK_SPEC \
76  "%{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
77   %{v:-V} \
78   %{assert*} %{R*} %{rpath*} %{defsym*} \
79   %{shared:-Bshareable %{h*} %{soname*}} \
80   %{!shared: \
81    %{!static: \
82     %{rdynamic:-export-dynamic} \
83     -dynamic-linker %(dfbsd_dynamic_linker) \
84    } \
85    %{static:-Bstatic} \
86   } \
87   %{!static:--hash-style=gnu} \
88   %{symbolic:-Bsymbolic}"
89 
90 #undef  LINK_SPEC
91 #define LINK_SPEC DFBSD_LINK_SPEC
92 
93 #if 1  /* DragonFly base: Prefer to use /libexec/ for dynamic linker */
94 #define DFBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.2"
95 #else
96 #define DFBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.2"
97 #endif
98 
99 
100 /* Use --as-needed -lgcc_s for eh support.  */
101 #ifdef HAVE_LD_AS_NEEDED
102 #define USE_LD_AS_NEEDED 1
103 #endif
104 
105 /************************[  Target stuff  ]***********************************/
106 
107 /* All DragonFly Architectures support the ELF object file format.  */
108 #undef  OBJECT_FORMAT_ELF
109 #define OBJECT_FORMAT_ELF
110 
111 /* Don't assume anything about the header files.  */
112 #undef  NO_IMPLICIT_EXTERN_C
113 #define NO_IMPLICIT_EXTERN_C	1
114 
115 /* Follow DragonFly's standard headers (<machine/stdint.h>, etc...).  */
116 
117 #undef  WCHAR_TYPE
118 #define WCHAR_TYPE "int"
119 
120 #undef  WINT_TYPE
121 #define WINT_TYPE "int"
122 
123 /* Code generation parameters.  */
124 
125 /* Use periods rather than dollar signs in special g++ assembler names.
126    This ensures the configuration knows our system correctly so we can link
127    with libraries compiled with the native cc.  */
128 #undef NO_DOLLAR_IN_LABEL
129 
130 /* Used by libgcc2.c.  We support file locking with fcntl / F_SETLKW.
131    This enables the test coverage code to use file locking when exiting a
132    program, which avoids race conditions if the program has forked.  */
133 #define TARGET_POSIX_IO
134