Skip to content

Commit 9cb18b3

Browse files
tieruyadorno
authored andcommitted
build: do not pass target toolchain flags to host toolchain
Fixes target toolchain arguments being passed to the host toolchain when cross-compiling. For example, -m64 is not available on aarch64. PR-URL: #48597 Reviewed-By: Richard Lau <rlau@redhat.com>
1 parent 4826379 commit 9cb18b3

File tree

1 file changed

+48
-20
lines changed

1 file changed

+48
-20
lines changed

common.gypi

+48-20
Original file line numberDiff line numberDiff line change
@@ -411,28 +411,56 @@
411411
'cflags': [ '-I/usr/local/include' ],
412412
'ldflags': [ '-Wl,-z,wxneeded' ],
413413
}],
414-
],
415-
'conditions': [
416-
[ 'target_arch=="ia32"', {
417-
'cflags': [ '-m32' ],
418-
'ldflags': [ '-m32' ],
419-
}],
420-
[ 'target_arch=="x64"', {
421-
'cflags': [ '-m64' ],
422-
'ldflags': [ '-m64' ],
423-
}],
424-
[ 'target_arch=="ppc" and OS not in "aix os400"', {
425-
'cflags': [ '-m32' ],
426-
'ldflags': [ '-m32' ],
427-
}],
428-
[ 'target_arch=="ppc64" and OS not in "aix os400"', {
429-
'cflags': [ '-m64', '-mminimal-toc' ],
430-
'ldflags': [ '-m64' ],
414+
['_toolset=="host"', {
415+
'conditions': [
416+
[ 'host_arch=="ia32"', {
417+
'cflags': [ '-m32' ],
418+
'ldflags': [ '-m32' ],
419+
}],
420+
[ 'host_arch=="x64"', {
421+
'cflags': [ '-m64' ],
422+
'ldflags': [ '-m64' ],
423+
}],
424+
[ 'host_arch=="ppc" and OS not in "aix os400"', {
425+
'cflags': [ '-m32' ],
426+
'ldflags': [ '-m32' ],
427+
}],
428+
[ 'host_arch=="ppc64" and OS not in "aix os400"', {
429+
'cflags': [ '-m64', '-mminimal-toc' ],
430+
'ldflags': [ '-m64' ],
431+
}],
432+
[ 'host_arch=="s390x" and OS=="linux"', {
433+
'cflags': [ '-m64', '-march=z196' ],
434+
'ldflags': [ '-m64', '-march=z196' ],
435+
}],
436+
],
431437
}],
432-
[ 'target_arch=="s390x" and OS=="linux"', {
433-
'cflags': [ '-m64', '-march=z196' ],
434-
'ldflags': [ '-m64', '-march=z196' ],
438+
['_toolset=="target"', {
439+
'conditions': [
440+
[ 'target_arch=="ia32"', {
441+
'cflags': [ '-m32' ],
442+
'ldflags': [ '-m32' ],
443+
}],
444+
[ 'target_arch=="x64"', {
445+
'cflags': [ '-m64' ],
446+
'ldflags': [ '-m64' ],
447+
}],
448+
[ 'target_arch=="ppc" and OS not in "aix os400"', {
449+
'cflags': [ '-m32' ],
450+
'ldflags': [ '-m32' ],
451+
}],
452+
[ 'target_arch=="ppc64" and OS not in "aix os400"', {
453+
'cflags': [ '-m64', '-mminimal-toc' ],
454+
'ldflags': [ '-m64' ],
455+
}],
456+
[ 'target_arch=="s390x" and OS=="linux"', {
457+
'cflags': [ '-m64', '-march=z196' ],
458+
'ldflags': [ '-m64', '-march=z196' ],
459+
}],
460+
],
435461
}],
462+
],
463+
'conditions': [
436464
[ 'OS=="solaris"', {
437465
'cflags': [ '-pthreads' ],
438466
'ldflags': [ '-pthreads' ],

0 commit comments

Comments
 (0)