Skip to content

Commit

Permalink
Setup Linux X64 toolchain for non-X64 hosts.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmacnak-google committed Oct 25, 2023
1 parent 757f503 commit 613f7fd
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class CompilerResolver {
return aarch64LinuxGnuGcc;
case Architecture.ia32:
return i686LinuxGnuGcc;
case Architecture.x64:
return x86_64LinuxGnuGcc;
}
}

Expand Down Expand Up @@ -158,6 +160,8 @@ class CompilerResolver {
return aarch64LinuxGnuGccAr;
case Architecture.ia32:
return i686LinuxGnuGccAr;
case Architecture.x64:
return x86_64LinuxGnuGccAr;
}
}
if (host.os == OS.windows) {
Expand Down
9 changes: 9 additions & 0 deletions pkgs/native_toolchain_c/lib/src/native_toolchain/gcc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ final i686LinuxGnuGccAr = _gnuArchiver('i686-linux-gnu');
/// [gnuLinker] with [Tool.defaultResolver] for [Architecture.ia32].
final i686LinuxGnuLd = _gnuLinker('i686-linux-gnu');

/// [gcc] with [Tool.defaultResolver] for [Architecture.x64].
final x86_64LinuxGnuGcc = _gcc('x86_64-linux-gnu');

/// [gnuArchiver] with [Tool.defaultResolver] for [Architecture.x64].
final x86_64LinuxGnuGccAr = _gnuArchiver('x86_64-linux-gnu');

/// [gnuLinker] with [Tool.defaultResolver] for [Architecture.x64].
final x86_64LinuxGnuLd = _gnuLinker('x86_64-linux-gnu');

/// [gcc] with [Tool.defaultResolver] for [Architecture.arm].
final armLinuxGnueabihfGcc = _gcc('arm-linux-gnueabihf');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void main() {
Target.linuxArm,
Target.linuxArm64,
Target.linuxIA32,
Target.linuxX64
Target.linuxX64,
];

const readElfMachine = {
Expand Down
6 changes: 6 additions & 0 deletions pkgs/native_toolchain_c/test/native_toolchain/gcc_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,10 @@ void main() {
i686LinuxGnuGccAr,
i686LinuxGnuLd,
]);

testToolSet('x86_64LinuxGnuGcc', [
x86_64LinuxGnuGcc,
x86_64LinuxGnuGccAr,
x86_64LinuxGnuLd,
]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ void main() async {
RecognizerTest(link, LinkerRecognizer.new),
RecognizerTest(lld, LinkerRecognizer.new),
RecognizerTest(llvmAr, ArchiverRecognizer.new),
RecognizerTest(x86_64LinuxGnuGcc, CompilerRecognizer.new),
RecognizerTest(x86_64LinuxGnuGccAr, ArchiverRecognizer.new),
RecognizerTest(x86_64LinuxGnuLd, LinkerRecognizer.new),
];

for (final test in tests) {
Expand Down

0 comments on commit 613f7fd

Please sign in to comment.