@@ -41,43 +41,57 @@ var re = regexp.MustCompile
41
41
42
42
var validCompilerFlags = []* regexp.Regexp {
43
43
re (`-D([A-Za-z_].*)` ),
44
+ re (`-F([^@\-].*)` ),
44
45
re (`-I([^@\-].*)` ),
45
46
re (`-O` ),
46
47
re (`-O([^@\-].*)` ),
47
48
re (`-W` ),
48
49
re (`-W([^@,]+)` ), // -Wall but not -Wa,-foo.
49
50
re (`-Wa,-mbig-obj` ),
51
+ re (`-Wp,-D([A-Za-z_].*)` ),
50
52
re (`-ansi` ),
53
+ re (`-f(no-)?asynchronous-unwind-tables` ),
51
54
re (`-f(no-)?blocks` ),
55
+ re (`-f(no-)builtin-[a-zA-Z0-9_]*` ),
52
56
re (`-f(no-)?common` ),
53
57
re (`-f(no-)?constant-cfstrings` ),
54
58
re (`-fdiagnostics-show-note-include-stack` ),
59
+ re (`-f(no-)?eliminate-unused-debug-types` ),
55
60
re (`-f(no-)?exceptions` ),
61
+ re (`-f(no-)?fast-math` ),
56
62
re (`-f(no-)?inline-functions` ),
57
63
re (`-finput-charset=([^@\-].*)` ),
58
64
re (`-f(no-)?fat-lto-objects` ),
65
+ re (`-f(no-)?keep-inline-dllexport` ),
59
66
re (`-f(no-)?lto` ),
60
67
re (`-fmacro-backtrace-limit=(.+)` ),
61
68
re (`-fmessage-length=(.+)` ),
62
69
re (`-f(no-)?modules` ),
63
70
re (`-f(no-)?objc-arc` ),
71
+ re (`-f(no-)?objc-nonfragile-abi` ),
72
+ re (`-f(no-)?objc-legacy-dispatch` ),
64
73
re (`-f(no-)?omit-frame-pointer` ),
65
74
re (`-f(no-)?openmp(-simd)?` ),
66
75
re (`-f(no-)?permissive` ),
67
76
re (`-f(no-)?(pic|PIC|pie|PIE)` ),
77
+ re (`-f(no-)?plt` ),
68
78
re (`-f(no-)?rtti` ),
69
79
re (`-f(no-)?split-stack` ),
70
80
re (`-f(no-)?stack-(.+)` ),
71
81
re (`-f(no-)?strict-aliasing` ),
72
82
re (`-f(un)signed-char` ),
73
83
re (`-f(no-)?use-linker-plugin` ), // safe if -B is not used; we don't permit -B
84
+ re (`-f(no-)?visibility-inlines-hidden` ),
74
85
re (`-fsanitize=(.+)` ),
75
86
re (`-ftemplate-depth-(.+)` ),
76
87
re (`-fvisibility=(.+)` ),
77
88
re (`-g([^@\-].*)?` ),
78
89
re (`-m32` ),
79
90
re (`-m64` ),
80
- re (`-m(arch|cpu|fpu|tune)=([^@\-].*)` ),
91
+ re (`-m(abi|arch|cpu|fpu|tune)=([^@\-].*)` ),
92
+ re (`-marm` ),
93
+ re (`-mfloat-abi=([^@\-].*)` ),
94
+ re (`-mfpmath=[0-9a-z,+]*` ),
81
95
re (`-m(no-)?avx[0-9a-z.]*` ),
82
96
re (`-m(no-)?ms-bitfields` ),
83
97
re (`-m(no-)?stack-(.+)` ),
@@ -86,12 +100,16 @@ var validCompilerFlags = []*regexp.Regexp{
86
100
re (`-miphoneos-version-min=(.+)` ),
87
101
re (`-mnop-fun-dllimport` ),
88
102
re (`-m(no-)?sse[0-9.]*` ),
103
+ re (`-mthumb(-interwork)?` ),
104
+ re (`-mthreads` ),
89
105
re (`-mwindows` ),
106
+ re (`--param=ssp-buffer-size=[0-9]*` ),
90
107
re (`-pedantic(-errors)?` ),
91
108
re (`-pipe` ),
92
109
re (`-pthread` ),
93
110
re (`-?-std=([^@\-].*)` ),
94
111
re (`-?-stdlib=([^@\-].*)` ),
112
+ re (`--sysroot=([^@\-].*)` ),
95
113
re (`-w` ),
96
114
re (`-x([^@\-].*)` ),
97
115
}
@@ -115,15 +133,20 @@ var validLinkerFlags = []*regexp.Regexp{
115
133
re (`-O` ),
116
134
re (`-O([^@\-].*)` ),
117
135
re (`-f(no-)?(pic|PIC|pie|PIE)` ),
136
+ re (`-f(no-)?openmp(-simd)?` ),
118
137
re (`-fsanitize=([^@\-].*)` ),
119
138
re (`-g([^@\-].*)?` ),
120
- re (`-m(arch|cpu|fpu|tune)=([^@\-].*)` ),
139
+ re (`-headerpad_max_install_names` ),
140
+ re (`-m(abi|arch|cpu|fpu|tune)=([^@\-].*)` ),
141
+ re (`-mfloat-abi=([^@\-].*)` ),
121
142
re (`-mmacosx-(.+)` ),
122
143
re (`-mios-simulator-version-min=(.+)` ),
123
144
re (`-miphoneos-version-min=(.+)` ),
145
+ re (`-mthreads` ),
124
146
re (`-mwindows` ),
125
147
re (`-(pic|PIC|pie|PIE)` ),
126
148
re (`-pthread` ),
149
+ re (`-rdynamic` ),
127
150
re (`-shared` ),
128
151
re (`-?-static([-a-z0-9+]*)` ),
129
152
re (`-?-stdlib=([^@\-].*)` ),
@@ -134,29 +157,35 @@ var validLinkerFlags = []*regexp.Regexp{
134
157
// in a wildcard would allow tunnelling arbitrary additional
135
158
// linker arguments through one of these.
136
159
re (`-Wl,--(no-)?allow-multiple-definition` ),
160
+ re (`-Wl,--(no-)?allow-shlib-undefined` ),
137
161
re (`-Wl,--(no-)?as-needed` ),
138
162
re (`-Wl,-Bdynamic` ),
139
163
re (`-Wl,-Bstatic` ),
164
+ re (`-WL,-O([^@,\-][^,]*)?` ),
140
165
re (`-Wl,-d[ny]` ),
141
166
re (`-Wl,--disable-new-dtags` ),
167
+ re (`-Wl,-e[=,][a-zA-Z0-9]*` ),
142
168
re (`-Wl,--enable-new-dtags` ),
143
169
re (`-Wl,--end-group` ),
144
170
re (`-Wl,-framework,[^,@\-][^,]+` ),
145
171
re (`-Wl,-headerpad_max_install_names` ),
146
172
re (`-Wl,--no-undefined` ),
147
- re (`-Wl,-rpath[=,]([^,@\-][^,]+)` ),
173
+ re (`-Wl,-rpath(-link)?[=,]([^,@\-][^,]+)` ),
174
+ re (`-Wl,-s` ),
148
175
re (`-Wl,-search_paths_first` ),
149
176
re (`-Wl,-sectcreate,([^,@\-][^,]+),([^,@\-][^,]+),([^,@\-][^,]+)` ),
150
177
re (`-Wl,--start-group` ),
151
178
re (`-Wl,-?-static` ),
152
- re (`-Wl,--subsystem,(native|windows|console|posix|xbox)` ),
179
+ re (`-Wl,-?-subsystem,(native|windows|console|posix|xbox)` ),
180
+ re (`-Wl,-syslibroot[=,]([^,@\-][^,]+)` ),
153
181
re (`-Wl,-undefined[=,]([^,@\-][^,]+)` ),
154
182
re (`-Wl,-?-unresolved-symbols=[^,]+` ),
155
183
re (`-Wl,--(no-)?warn-([^,]+)` ),
156
184
re (`-Wl,-z,(no)?execstack` ),
157
185
re (`-Wl,-z,relro` ),
158
186
159
187
re (`[a-zA-Z0-9_/].*\.(a|o|obj|dll|dylib|so)` ), // direct linker inputs: x.o or libfoo.so (but not -foo.o or @foo.o)
188
+ re (`\./.*\.(a|o|obj|dll|dylib|so)` ),
160
189
}
161
190
162
191
var validLinkerFlagsWithNextArg = []string {
0 commit comments