diff --git a/pkgs/native_toolchain_c/lib/src/cbuilder/run_cbuilder.dart b/pkgs/native_toolchain_c/lib/src/cbuilder/run_cbuilder.dart index 89d0f3eb3..171f89e3c 100644 --- a/pkgs/native_toolchain_c/lib/src/cbuilder/run_cbuilder.dart +++ b/pkgs/native_toolchain_c/lib/src/cbuilder/run_cbuilder.dart @@ -85,14 +85,14 @@ class RunCBuilder { if (compilerTool == appleClang || compilerTool == clang || compilerTool == gcc) { - await runClangLike(compiler: compiler_.uri); + await runClangLike(compiler: compiler_); return; } assert(compilerTool == cl); await runCl(compiler: compiler_); } - Future runClangLike({required Uri compiler}) async { + Future runClangLike({required ToolInstance compiler}) async { final isStaticLib = staticLibrary != null; Uri? archiver_; if (isStaticLib) { @@ -105,7 +105,7 @@ class RunCBuilder { } await runProcess( - executable: compiler, + executable: compiler.uri, arguments: [ if (target.os == OS.android) ...[ // TODO(dacoharkes): How to solve linking issues? @@ -160,6 +160,10 @@ class RunCBuilder { ] else ...[ '-fno-PIC', '-fno-PIE', + if (compiler.tool == clang) ...[ + '-z', + 'notext', + ] ], for (final MapEntry(key: name, :value) in defines.entries) if (value == null) '-D$name' else '-D$name=$value',