Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[native_toolchain_c] Enable relocations in RO sections on clang #132

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 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,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',
Expand Down