Skip to content

Commit bbcbc1f

Browse files
authored
[native_toolchain_c] Enable relocations in RO sections on clang (#132)
1 parent 5177659 commit bbcbc1f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
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,6 +160,10 @@ class RunCBuilder {
160160
] else ...[
161161
'-fno-PIC',
162162
'-fno-PIE',
163+
if (compiler.tool == clang) ...[
164+
'-z',
165+
'notext',
166+
]
163167
],
164168
for (final MapEntry(key: name, :value) in defines.entries)
165169
if (value == null) '-D$name' else '-D$name=$value',

0 commit comments

Comments
 (0)