aboutsummaryrefslogtreecommitdiff
path: root/src/linker.cpp
diff options
context:
space:
mode:
authorIllusionMan1212 <hisham.abourgheba@gmail.com>2025-04-05 02:18:06 +0200
committerIllusionMan1212 <hisham.abourgheba@gmail.com>2025-04-05 02:20:06 +0200
commit44950d5f37f1a288182179b9b106f3510f51704e (patch)
tree3ced254b0089b2ff6d019ef6cc93e1865df4fe43 /src/linker.cpp
parent19e056a80619f91fad04ce73950ed122c2a11881 (diff)
fix: cross-compilation for android on linux
add `-nodefaultlibs` when cross-linking for android to prevent clang from linking with libgcc check build mode first before calling `init_android_values` to prevent printing a message that tells the user to set `-android-keystore` if its not set and build mode is exe
Diffstat (limited to 'src/linker.cpp')
-rw-r--r--src/linker.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/linker.cpp b/src/linker.cpp
index 5c0fe446f..8f484f734 100644
--- a/src/linker.cpp
+++ b/src/linker.cpp
@@ -143,7 +143,7 @@ gb_internal i32 linker_stage(LinkerData *gen) {
LIT(target_arch_names[build_context.metrics.arch])
);
#endif
- } else if (build_context.cross_compiling && build_context.different_os) {
+ } else if (build_context.cross_compiling) {
switch (selected_subtarget) {
case Subtarget_Android:
is_cross_linking = true;
@@ -840,6 +840,7 @@ try_cross_linking:;
if (is_android) {
link_command_line = gb_string_append_fmt(link_command_line, " --target=aarch64-linux-android%d ", ODIN_ANDROID_API_LEVEL);
+ link_command_line = gb_string_appendc(link_command_line, " -nodefaultlibs");
}
link_command_line = gb_string_appendc(link_command_line, " -Wno-unused-command-line-argument ");
link_command_line = gb_string_appendc(link_command_line, object_files);