@@ -41,43 +41,57 @@ var re = regexp.MustCompile
4141
4242var validCompilerFlags = []* regexp.Regexp {
4343 re (`-D([A-Za-z_].*)` ),
44+ re (`-F([^@\-].*)` ),
4445 re (`-I([^@\-].*)` ),
4546 re (`-O` ),
4647 re (`-O([^@\-].*)` ),
4748 re (`-W` ),
4849 re (`-W([^@,]+)` ), // -Wall but not -Wa,-foo.
4950 re (`-Wa,-mbig-obj` ),
51+ re (`-Wp,-D([A-Za-z_].*)` ),
5052 re (`-ansi` ),
53+ re (`-f(no-)?asynchronous-unwind-tables` ),
5154 re (`-f(no-)?blocks` ),
55+ re (`-f(no-)builtin-[a-zA-Z0-9_]*` ),
5256 re (`-f(no-)?common` ),
5357 re (`-f(no-)?constant-cfstrings` ),
5458 re (`-fdiagnostics-show-note-include-stack` ),
59+ re (`-f(no-)?eliminate-unused-debug-types` ),
5560 re (`-f(no-)?exceptions` ),
61+ re (`-f(no-)?fast-math` ),
5662 re (`-f(no-)?inline-functions` ),
5763 re (`-finput-charset=([^@\-].*)` ),
5864 re (`-f(no-)?fat-lto-objects` ),
65+ re (`-f(no-)?keep-inline-dllexport` ),
5966 re (`-f(no-)?lto` ),
6067 re (`-fmacro-backtrace-limit=(.+)` ),
6168 re (`-fmessage-length=(.+)` ),
6269 re (`-f(no-)?modules` ),
6370 re (`-f(no-)?objc-arc` ),
71+ re (`-f(no-)?objc-nonfragile-abi` ),
72+ re (`-f(no-)?objc-legacy-dispatch` ),
6473 re (`-f(no-)?omit-frame-pointer` ),
6574 re (`-f(no-)?openmp(-simd)?` ),
6675 re (`-f(no-)?permissive` ),
6776 re (`-f(no-)?(pic|PIC|pie|PIE)` ),
77+ re (`-f(no-)?plt` ),
6878 re (`-f(no-)?rtti` ),
6979 re (`-f(no-)?split-stack` ),
7080 re (`-f(no-)?stack-(.+)` ),
7181 re (`-f(no-)?strict-aliasing` ),
7282 re (`-f(un)signed-char` ),
7383 re (`-f(no-)?use-linker-plugin` ), // safe if -B is not used; we don't permit -B
84+ re (`-f(no-)?visibility-inlines-hidden` ),
7485 re (`-fsanitize=(.+)` ),
7586 re (`-ftemplate-depth-(.+)` ),
7687 re (`-fvisibility=(.+)` ),
7788 re (`-g([^@\-].*)?` ),
7889 re (`-m32` ),
7990 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,+]*` ),
8195 re (`-m(no-)?avx[0-9a-z.]*` ),
8296 re (`-m(no-)?ms-bitfields` ),
8397 re (`-m(no-)?stack-(.+)` ),
@@ -86,12 +100,16 @@ var validCompilerFlags = []*regexp.Regexp{
86100 re (`-miphoneos-version-min=(.+)` ),
87101 re (`-mnop-fun-dllimport` ),
88102 re (`-m(no-)?sse[0-9.]*` ),
103+ re (`-mthumb(-interwork)?` ),
104+ re (`-mthreads` ),
89105 re (`-mwindows` ),
106+ re (`--param=ssp-buffer-size=[0-9]*` ),
90107 re (`-pedantic(-errors)?` ),
91108 re (`-pipe` ),
92109 re (`-pthread` ),
93110 re (`-?-std=([^@\-].*)` ),
94111 re (`-?-stdlib=([^@\-].*)` ),
112+ re (`--sysroot=([^@\-].*)` ),
95113 re (`-w` ),
96114 re (`-x([^@\-].*)` ),
97115}
@@ -115,15 +133,20 @@ var validLinkerFlags = []*regexp.Regexp{
115133 re (`-O` ),
116134 re (`-O([^@\-].*)` ),
117135 re (`-f(no-)?(pic|PIC|pie|PIE)` ),
136+ re (`-f(no-)?openmp(-simd)?` ),
118137 re (`-fsanitize=([^@\-].*)` ),
119138 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=([^@\-].*)` ),
121142 re (`-mmacosx-(.+)` ),
122143 re (`-mios-simulator-version-min=(.+)` ),
123144 re (`-miphoneos-version-min=(.+)` ),
145+ re (`-mthreads` ),
124146 re (`-mwindows` ),
125147 re (`-(pic|PIC|pie|PIE)` ),
126148 re (`-pthread` ),
149+ re (`-rdynamic` ),
127150 re (`-shared` ),
128151 re (`-?-static([-a-z0-9+]*)` ),
129152 re (`-?-stdlib=([^@\-].*)` ),
@@ -134,29 +157,35 @@ var validLinkerFlags = []*regexp.Regexp{
134157 // in a wildcard would allow tunnelling arbitrary additional
135158 // linker arguments through one of these.
136159 re (`-Wl,--(no-)?allow-multiple-definition` ),
160+ re (`-Wl,--(no-)?allow-shlib-undefined` ),
137161 re (`-Wl,--(no-)?as-needed` ),
138162 re (`-Wl,-Bdynamic` ),
139163 re (`-Wl,-Bstatic` ),
164+ re (`-WL,-O([^@,\-][^,]*)?` ),
140165 re (`-Wl,-d[ny]` ),
141166 re (`-Wl,--disable-new-dtags` ),
167+ re (`-Wl,-e[=,][a-zA-Z0-9]*` ),
142168 re (`-Wl,--enable-new-dtags` ),
143169 re (`-Wl,--end-group` ),
144170 re (`-Wl,-framework,[^,@\-][^,]+` ),
145171 re (`-Wl,-headerpad_max_install_names` ),
146172 re (`-Wl,--no-undefined` ),
147- re (`-Wl,-rpath[=,]([^,@\-][^,]+)` ),
173+ re (`-Wl,-rpath(-link)?[=,]([^,@\-][^,]+)` ),
174+ re (`-Wl,-s` ),
148175 re (`-Wl,-search_paths_first` ),
149176 re (`-Wl,-sectcreate,([^,@\-][^,]+),([^,@\-][^,]+),([^,@\-][^,]+)` ),
150177 re (`-Wl,--start-group` ),
151178 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[=,]([^,@\-][^,]+)` ),
153181 re (`-Wl,-undefined[=,]([^,@\-][^,]+)` ),
154182 re (`-Wl,-?-unresolved-symbols=[^,]+` ),
155183 re (`-Wl,--(no-)?warn-([^,]+)` ),
156184 re (`-Wl,-z,(no)?execstack` ),
157185 re (`-Wl,-z,relro` ),
158186
159187 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)` ),
160189}
161190
162191var validLinkerFlagsWithNextArg = []string {
0 commit comments