Skip to content

Commit 8b5ceeb

Browse files
committed
Only add flag on clang (not apple clang)
1 parent ee96750 commit 8b5ceeb

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

pkgs/native_toolchain_c/lib/src/cbuilder/run_cbuilder.dart

+7-5
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ class RunCBuilder {
8585
if (compilerTool == appleClang ||
8686
compilerTool == clang ||
8787
compilerTool == gcc) {
88-
await runClangLike(compiler: compiler_.uri);
88+
await runClangLike(compiler: compiler_);
8989
return;
9090
}
9191
assert(compilerTool == cl);
9292
await runCl(compiler: compiler_);
9393
}
9494

95-
Future<void> runClangLike({required Uri compiler}) async {
95+
Future<void> runClangLike({required ToolInstance compiler}) async {
9696
final isStaticLib = staticLibrary != null;
9797
Uri? archiver_;
9898
if (isStaticLib) {
@@ -105,7 +105,7 @@ class RunCBuilder {
105105
}
106106

107107
await runProcess(
108-
executable: compiler,
108+
executable: compiler.uri,
109109
arguments: [
110110
if (target.os == OS.android) ...[
111111
// TODO(dacoharkes): How to solve linking issues?
@@ -160,8 +160,10 @@ class RunCBuilder {
160160
] else ...[
161161
'-fno-PIC',
162162
'-fno-PIE',
163-
'-z',
164-
'notext',
163+
if (compiler.tool == clang) ...[
164+
'-z',
165+
'notext',
166+
]
165167
],
166168
for (final MapEntry(key: name, :value) in defines.entries)
167169
if (value == null) '-D$name' else '-D$name=$value',

0 commit comments

Comments
 (0)