@@ -46,12 +46,19 @@ var validCompilerFlags = []*regexp.Regexp{
46
46
re (`-O([^@\-].*)` ),
47
47
re (`-W` ),
48
48
re (`-W([^@,]+)` ), // -Wall but not -Wa,-foo.
49
+ re (`-Wa,-mbig-obj` ),
50
+ re (`-ansi` ),
49
51
re (`-f(no-)?blocks` ),
50
52
re (`-f(no-)?common` ),
51
53
re (`-f(no-)?constant-cfstrings` ),
54
+ re (`-fdiagnostics-show-note-include-stack` ),
52
55
re (`-f(no-)?exceptions` ),
56
+ re (`-f(no-)?inline-functions` ),
53
57
re (`-finput-charset=([^@\-].*)` ),
58
+ re (`-f(no-)?fat-lto-objects` ),
54
59
re (`-f(no-)?lto` ),
60
+ re (`-fmacro-backtrace-limit=(.+)` ),
61
+ re (`-fmessage-length=(.+)` ),
55
62
re (`-f(no-)?modules` ),
56
63
re (`-f(no-)?objc-arc` ),
57
64
re (`-f(no-)?omit-frame-pointer` ),
@@ -62,71 +69,108 @@ var validCompilerFlags = []*regexp.Regexp{
62
69
re (`-f(no-)?split-stack` ),
63
70
re (`-f(no-)?stack-(.+)` ),
64
71
re (`-f(no-)?strict-aliasing` ),
72
+ re (`-f(un)signed-char` ),
73
+ re (`-f(no-)?use-linker-plugin` ), // safe if -B is not used; we don't permit -B
65
74
re (`-fsanitize=(.+)` ),
75
+ re (`-ftemplate-depth-(.+)` ),
76
+ re (`-fvisibility=(.+)` ),
66
77
re (`-g([^@\-].*)?` ),
78
+ re (`-m32` ),
79
+ re (`-m64` ),
67
80
re (`-m(arch|cpu|fpu|tune)=([^@\-].*)` ),
68
81
re (`-m(no-)?avx[0-9a-z.]*` ),
69
82
re (`-m(no-)?ms-bitfields` ),
70
83
re (`-m(no-)?stack-(.+)` ),
71
84
re (`-mmacosx-(.+)` ),
85
+ re (`-mios-simulator-version-min=(.+)` ),
86
+ re (`-miphoneos-version-min=(.+)` ),
72
87
re (`-mnop-fun-dllimport` ),
73
88
re (`-m(no-)?sse[0-9.]*` ),
89
+ re (`-mwindows` ),
74
90
re (`-pedantic(-errors)?` ),
75
91
re (`-pipe` ),
76
92
re (`-pthread` ),
77
93
re (`-?-std=([^@\-].*)` ),
94
+ re (`-?-stdlib=([^@\-].*)` ),
95
+ re (`-w` ),
78
96
re (`-x([^@\-].*)` ),
79
97
}
80
98
81
99
var validCompilerFlagsWithNextArg = []string {
100
+ "-arch" ,
82
101
"-D" ,
83
102
"-I" ,
84
- "-isystem" ,
85
103
"-framework" ,
104
+ "-isysroot" ,
105
+ "-isystem" ,
106
+ "--sysroot" ,
107
+ "-target" ,
86
108
"-x" ,
87
109
}
88
110
89
111
var validLinkerFlags = []* regexp.Regexp {
90
112
re (`-F([^@\-].*)` ),
91
113
re (`-l([^@\-].*)` ),
92
114
re (`-L([^@\-].*)` ),
115
+ re (`-O` ),
116
+ re (`-O([^@\-].*)` ),
93
117
re (`-f(no-)?(pic|PIC|pie|PIE)` ),
94
118
re (`-fsanitize=([^@\-].*)` ),
95
119
re (`-g([^@\-].*)?` ),
96
120
re (`-m(arch|cpu|fpu|tune)=([^@\-].*)` ),
121
+ re (`-mmacosx-(.+)` ),
122
+ re (`-mios-simulator-version-min=(.+)` ),
123
+ re (`-miphoneos-version-min=(.+)` ),
124
+ re (`-mwindows` ),
97
125
re (`-(pic|PIC|pie|PIE)` ),
98
126
re (`-pthread` ),
127
+ re (`-shared` ),
99
128
re (`-?-static([-a-z0-9+]*)` ),
129
+ re (`-?-stdlib=([^@\-].*)` ),
100
130
101
131
// Note that any wildcards in -Wl need to exclude comma,
102
132
// since -Wl splits its argument at commas and passes
103
133
// them all to the linker uninterpreted. Allowing comma
104
134
// in a wildcard would allow tunnelling arbitrary additional
105
135
// linker arguments through one of these.
136
+ re (`-Wl,--(no-)?allow-multiple-definition` ),
106
137
re (`-Wl,--(no-)?as-needed` ),
107
138
re (`-Wl,-Bdynamic` ),
108
139
re (`-Wl,-Bstatic` ),
140
+ re (`-Wl,-d[ny]` ),
109
141
re (`-Wl,--disable-new-dtags` ),
110
142
re (`-Wl,--enable-new-dtags` ),
111
143
re (`-Wl,--end-group` ),
112
144
re (`-Wl,-framework,[^,@\-][^,]+` ),
113
145
re (`-Wl,-headerpad_max_install_names` ),
114
146
re (`-Wl,--no-undefined` ),
115
- re (`-Wl,-rpath, ([^,@\-][^,]+)` ),
147
+ re (`-Wl,-rpath[=,] ([^,@\-][^,]+)` ),
116
148
re (`-Wl,-search_paths_first` ),
149
+ re (`-Wl,-sectcreate,([^,@\-][^,]+),([^,@\-][^,]+),([^,@\-][^,]+)` ),
117
150
re (`-Wl,--start-group` ),
151
+ re (`-Wl,-?-static` ),
152
+ re (`-Wl,--subsystem,(native|windows|console|posix|xbox)` ),
153
+ re (`-Wl,-undefined[=,]([^,@\-][^,]+)` ),
118
154
re (`-Wl,-?-unresolved-symbols=[^,]+` ),
119
155
re (`-Wl,--(no-)?warn-([^,]+)` ),
156
+ re (`-Wl,-z,(no)?execstack` ),
157
+ re (`-Wl,-z,relro` ),
120
158
121
159
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)
122
160
}
123
161
124
162
var validLinkerFlagsWithNextArg = []string {
163
+ "-arch" ,
125
164
"-F" ,
126
165
"-l" ,
127
166
"-L" ,
128
167
"-framework" ,
168
+ "-isysroot" ,
169
+ "--sysroot" ,
170
+ "-target" ,
129
171
"-Wl,-framework" ,
172
+ "-Wl,-rpath" ,
173
+ "-Wl,-undefined" ,
130
174
}
131
175
132
176
func checkCompilerFlags (name , source string , list []string ) error {
0 commit comments