Skip to content

Commit

Permalink
Only add flag on clang (not apple clang)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcharkes committed Sep 14, 2023
1 parent ee96750 commit 8b5ceeb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkgs/native_toolchain_c/lib/src/cbuilder/run_cbuilder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> runClangLike({required Uri compiler}) async {
Future<void> runClangLike({required ToolInstance compiler}) async {
final isStaticLib = staticLibrary != null;
Uri? archiver_;
if (isStaticLib) {
Expand All @@ -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?
Expand Down Expand Up @@ -160,8 +160,10 @@ class RunCBuilder {
] else ...[
'-fno-PIC',
'-fno-PIE',
'-z',
'notext',
if (compiler.tool == clang) ...[
'-z',
'notext',
]
],
for (final MapEntry(key: name, :value) in defines.entries)
if (value == null) '-D$name' else '-D$name=$value',
Expand Down

0 comments on commit 8b5ceeb

Please sign in to comment.