(prefix_list_option "Wl,",
(help "Pass options to linker")),
(prefix_list_option "Wo,",
- (help "Pass options to opt"))
+ (help "Pass options to opt")),
+ (prefix_list_option "m",
+ (help "Enable or disable various extensions (-mmmx, -msse, etc.)"),
+ (hidden))
]>;
// Option preprocessor.
(not_empty "march"), (forward "march"),
(not_empty "mtune"), (forward "mtune"),
(not_empty "mcpu"), (forward "mcpu"),
+ (not_empty "m"), (forward "m"),
(switch_on "m32"), (forward "m32"),
(switch_on "m64"), (forward "m64"),
(switch_on "O1"), (forward "O1"),
(not_empty "march"), (forward "mcpu"),
(not_empty "mtune"), (forward "mcpu"),
(not_empty "mcpu"), (forward "mcpu"),
+ (not_empty "m"), (forward_transformed_value "m", "ConvertToMAttr"),
(not_empty "Wllc,"), (unpack_values "Wllc,")))
]>;
--- /dev/null
+#include <string>
+#include <vector>
+
+namespace hooks {
+typedef std::vector<std::string> StrVec;
+
+/// ConvertToMAttr - Convert -m* and -mno-* to -mattr=+*,-*
+std::string ConvertToMAttr(const StrVec& Opts) {
+ std::string out("-mattr=");
+
+ bool firstIter = true;
+ for (StrVec::const_iterator B = Opts.begin(), E = Opts.end(); B!=E; ++B) {
+ const std::string& Arg = *B;
+
+ if (firstIter)
+ firstIter = false;
+ else
+ out += ",";
+
+ if (Arg.find("no-") == 0 && Arg[3] != 0) {
+ out += '-';
+ out += Arg.c_str() + 3;
+ }
+ else {
+ out += '+';
+ out += Arg;
+ }
+ }
+
+ return out;
+}
+
+}