diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-03-23 16:19:44 -0700 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-03-29 09:10:06 +0000 |
commit | 5742084945434d94488a3cc98cfaa02fcfec7420 (patch) | |
tree | bb1828100735a3a37544e7d6f5b8b1e435ffd9c9 /share/qbs/modules/cpp/gcc.js | |
parent | 985664bf1944c5e480ccccf1930afac173bc898a (diff) |
Fix assembler invocation with older Xcode
Xcode prior to 7 uses GNU as, not the Apple clang-based driver which
supports the -target option.
Now: Clang as uses -target, GNU as uses -arch, no other options.
Change-Id: I389a43cf7118f3b6330a2aea16d47d7f21dbb2e6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'share/qbs/modules/cpp/gcc.js')
-rw-r--r-- | share/qbs/modules/cpp/gcc.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js index fbcca23b0..3d3e69827 100644 --- a/share/qbs/modules/cpp/gcc.js +++ b/share/qbs/modules/cpp/gcc.js @@ -1143,3 +1143,30 @@ function dumpDefaultPaths(env, compilerFilePath, args, nullDevice, pathListSepar p.close(); } } + +function targetFlags(tool, hasTargetOption, target, targetArch, machineType) { + var args = []; + if (hasTargetOption) { + if (target) + args.push("-target", target); + } else { + var archArgs = { + "compiler": { + "i386": ["-m32"], + "x86_64": ["-m64"], + }, + "assembler": { + "i386": ["--32"], + "x86_64": ["--64"], + }, + }; + + var flags = archArgs[tool] ? archArgs[tool][targetArch] : undefined; + if (flags) + args = args.concat(flags); + + if (machineType && tool !== "linker") + args.push("-march=" + machineType); + } + return args; +} |