1 /* Base configuration file for all FreeBSD targets.
2    Copyright (C) 1999-2021 Free Software Foundation, Inc.
3 
4 This file is part of GCC.
5 
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
10 
11 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3.  If not see
18 <http://www.gnu.org/licenses/>.  */
19 
20 /* Common FreeBSD configuration.
21    All FreeBSD architectures should include this file, which will specify
22    their commonalities.
23    Adapted from gcc/config/i386/freebsd-elf.h by
24    David O'Brien <obrien@FreeBSD.org>.
25    Further work by David O'Brien <obrien@FreeBSD.org> and
26    Loren J. Rittle <ljrittle@acm.org>.  */
27 
28 
29 /* In case we need to know.  */
30 #define USING_CONFIG_FREEBSD 1
31 
32 #undef  TARGET_OS_CPP_BUILTINS
33 #define TARGET_OS_CPP_BUILTINS() FBSD_TARGET_OS_CPP_BUILTINS()
34 
35 #undef  CPP_SPEC
36 #define CPP_SPEC FBSD_CPP_SPEC
37 
38 #undef  STARTFILE_SPEC
39 #define STARTFILE_SPEC FBSD_STARTFILE_SPEC
40 
41 #undef  ENDFILE_SPEC
42 #define ENDFILE_SPEC FBSD_ENDFILE_SPEC
43 
44 #undef  LIB_SPEC
45 #define LIB_SPEC FBSD_LIB_SPEC
46 
47 #if defined(HAVE_LD_EH_FRAME_HDR)
48 #define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
49 #endif
50 
51 #ifdef TARGET_LIBC_PROVIDES_SSP
52 #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
53 		       "|fstack-protector-strong|fstack-protector-explicit" \
54 		       ":-lssp_nonshared}"
55 #endif
56 
57 #undef TARGET_LIBC_HAS_FUNCTION
58 #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
59 
60 /* Use --as-needed -lgcc_s for eh support.  */
61 #ifdef HAVE_LD_AS_NEEDED
62 #define USE_LD_AS_NEEDED 1
63 #endif
64 
65 /* Link -lasan early on the command line.  For -static-libasan, don't link
66    it for -shared link, the executable should be compiled with -static-libasan
67    in that case, and for executable link with --{,no-}whole-archive around
68    it to force everything into the executable.  And similarly for -ltsan
69    and -llsan.  */
70 #if defined(HAVE_LD_STATIC_DYNAMIC)
71 #undef LIBASAN_EARLY_SPEC
72 #define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \
73   "%{static-libasan:%{!shared:" \
74   LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
75   LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan -lpthread}"
76 #undef LIBTSAN_EARLY_SPEC
77 #define LIBTSAN_EARLY_SPEC "%{static-libtsan:%{!shared:" \
78   LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \
79   LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan -lpthread}"
80 #undef LIBLSAN_EARLY_SPEC
81 #define LIBLSAN_EARLY_SPEC "%{static-liblsan:%{!shared:" \
82   LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \
83   LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan -lpthread}"
84 #endif
85 
86 /************************[  Target stuff  ]***********************************/
87 
88 /* All FreeBSD Architectures support the ELF object file format.  */
89 #undef  OBJECT_FORMAT_ELF
90 #define OBJECT_FORMAT_ELF
91 
92 /* Follow FreeBSD's standard headers (<sys/_types.h> etc...).  */
93 
94 #undef  WCHAR_TYPE
95 #define WCHAR_TYPE "int"
96 
97 #undef  WINT_TYPE
98 #define WINT_TYPE "int"
99 
100 #define MATH_LIBRARY_PROFILE    "m_p"
101 
102 /* Code generation parameters.  */
103 
104 /* Use periods rather than dollar signs in special g++ assembler names.
105    This ensures the configuration knows our system correctly so we can link
106    with libraries compiled with the native cc.  */
107 #undef NO_DOLLAR_IN_LABEL
108 
109 /* Used by libgcc2.c.  We support file locking with fcntl / F_SETLKW.
110    This enables the test coverage code to use file locking when exiting a
111    program, which avoids race conditions if the program has forked.  */
112 #define TARGET_POSIX_IO
113