@@ -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
re (`-v` ),
@@ -116,15 +134,20 @@ var validLinkerFlags = []*regexp.Regexp{
116
134
re (`-O` ),
117
135
re (`-O([^@\-].*)` ),
118
136
re (`-f(no-)?(pic|PIC|pie|PIE)` ),
137
+ re (`-f(no-)?openmp(-simd)?` ),
119
138
re (`-fsanitize=([^@\-].*)` ),
120
139
re (`-g([^@\-].*)?` ),
121
- re (`-m(arch|cpu|fpu|tune)=([^@\-].*)` ),
140
+ re (`-headerpad_max_install_names` ),
141
+ re (`-m(abi|arch|cpu|fpu|tune)=([^@\-].*)` ),
142
+ re (`-mfloat-abi=([^@\-].*)` ),
122
143
re (`-mmacosx-(.+)` ),
123
144
re (`-mios-simulator-version-min=(.+)` ),
124
145
re (`-miphoneos-version-min=(.+)` ),
146
+ re (`-mthreads` ),
125
147
re (`-mwindows` ),
126
148
re (`-(pic|PIC|pie|PIE)` ),
127
149
re (`-pthread` ),
150
+ re (`-rdynamic` ),
128
151
re (`-shared` ),
129
152
re (`-?-static([-a-z0-9+]*)` ),
130
153
re (`-?-stdlib=([^@\-].*)` ),
@@ -136,29 +159,35 @@ var validLinkerFlags = []*regexp.Regexp{
136
159
// in a wildcard would allow tunnelling arbitrary additional
137
160
// linker arguments through one of these.
138
161
re (`-Wl,--(no-)?allow-multiple-definition` ),
162
+ re (`-Wl,--(no-)?allow-shlib-undefined` ),
139
163
re (`-Wl,--(no-)?as-needed` ),
140
164
re (`-Wl,-Bdynamic` ),
141
165
re (`-Wl,-Bstatic` ),
166
+ re (`-WL,-O([^@,\-][^,]*)?` ),
142
167
re (`-Wl,-d[ny]` ),
143
168
re (`-Wl,--disable-new-dtags` ),
169
+ re (`-Wl,-e[=,][a-zA-Z0-9]*` ),
144
170
re (`-Wl,--enable-new-dtags` ),
145
171
re (`-Wl,--end-group` ),
146
172
re (`-Wl,-framework,[^,@\-][^,]+` ),
147
173
re (`-Wl,-headerpad_max_install_names` ),
148
174
re (`-Wl,--no-undefined` ),
149
- re (`-Wl,-rpath[=,]([^,@\-][^,]+)` ),
175
+ re (`-Wl,-rpath(-link)?[=,]([^,@\-][^,]+)` ),
176
+ re (`-Wl,-s` ),
150
177
re (`-Wl,-search_paths_first` ),
151
178
re (`-Wl,-sectcreate,([^,@\-][^,]+),([^,@\-][^,]+),([^,@\-][^,]+)` ),
152
179
re (`-Wl,--start-group` ),
153
180
re (`-Wl,-?-static` ),
154
- re (`-Wl,--subsystem,(native|windows|console|posix|xbox)` ),
181
+ re (`-Wl,-?-subsystem,(native|windows|console|posix|xbox)` ),
182
+ re (`-Wl,-syslibroot[=,]([^,@\-][^,]+)` ),
155
183
re (`-Wl,-undefined[=,]([^,@\-][^,]+)` ),
156
184
re (`-Wl,-?-unresolved-symbols=[^,]+` ),
157
185
re (`-Wl,--(no-)?warn-([^,]+)` ),
158
186
re (`-Wl,-z,(no)?execstack` ),
159
187
re (`-Wl,-z,relro` ),
160
188
161
189
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)
190
+ re (`\./.*\.(a|o|obj|dll|dylib|so)` ),
162
191
}
163
192
164
193
var validLinkerFlagsWithNextArg = []string {
0 commit comments