summaryrefslogtreecommitdiff
path: root/share/man/man1/clang-local.1
blob: 9e02e6972a199ca4a62162276b7a336f77acdff8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
.\" $OpenBSD: clang-local.1,v 1.23 2022/02/18 00:39:18 jca Exp $
.\"
.\" Copyright (c) 2016 Pascal Stumpf <pascal@stumpf.co>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\"
.Dd $Mdocdate: February 18 2022 $
.Dt CLANG-LOCAL 1
.Os
.Sh NAME
.Nm clang-local
.Nd OpenBSD-specific behavior of LLVM/clang
.Sh DESCRIPTION
On
.Ox ,
the LLVM/clang compiler exhibits the following characteristics:
.Bl -dash
.It
.Nm clang
does not search under
.Pa /usr/local
for include files or libraries:
as a system compiler, it only searches the system paths by default.
.It
.Nm clang
comes with stack protection enabled by default, equivalent to the
.Fl fstack-protector-strong
option on other systems.
The system will report any violation of the stack protector cookie along
with the function name via
.Xr syslog 3
at
.Dv LOG_CRIT
priority.
.It
.Nm clang
will generate PIE code by default, allowing the system to load the resulting
binary at a random location.
This behavior can be turned off by passing
.Fl fno-pie
to the compiler and
.Fl nopie
to the linker.
It is also turned off when the
.Fl pg
flag is used.
.It
The
.Fl fstrict-aliasing
option is turned off by default unless
.Fl Ofast
has been selected.
.It
.Nm clang
does not store its version string in objects.
There is no option to control this.
.It
The
.Fl p
flag is an alias of
.Fl pg .
.It
.Nm clang
does not warn for passing pointer arguments or assignment with
different signedness outside of
.Fl pedantic .
This can be
re-enabled with the
.Fl Wpointer-sign
flag.
.It
The warning option
.Fl Waddress-of-packed-member
is disabled by default.
.It
Color diagnostic messages are disabled by default and can be re-enabled with
.Fl fdiagnostics-color .
.It
The
.Fl fwrapv
option to treat signed integer overflows as defined is enabled by default to
prevent dangerous optimizations which could remove security critical overflow
checks.
.It
The base system includes the ubsan_minimal sanitizer runtime
but not the fully-featured ubsan runtime.
See the documentation for the
.Fl fsanitize-minimal-runtime
flag.
.It
The
.Xr malloc 3 ,
.Xr calloc 3 ,
.Xr realloc 3 ,
.Xr strdup 3 ,
.Xr strndup 3 ,
.Xr valloc 3
and
.Xr free 3
builtins are disabled to prevent undesirable optimizations of calls to
these functions.
.It
.Nm clang
includes a security pass that exchanges some ROP-friendly instructions
with safer alternatives on i386 and amd64.
This can be disabled with the
.Fl fno-fixup-gadgets
option.
.It
.Nm clang
includes the retguard security feature on amd64, arm64, mips64, powerpc
and powerpc64.
This feature can be disabled with the
.Fl fno-ret-protector
or
.Fl fno-stack-protector
options.
.It
.Nm clang
has
.Fl mretpoline
enabled by default on amd64 to protect against branch target injection attacks.
It can be disabled with
.Fl mno-retpoline .
.It
A new warning for
.Cm %n
format specifier usage in
.Xr printf 3
family functions has been added.
.El
.Sh SEE ALSO
.Xr clang 1