Skip to content

Commit

Permalink
Exclude libgcc and libunwind from linked library on Android.
Browse files Browse the repository at this point in the history
As said in [1], unwinder is linked automatically by Clang and shared
library must not re-export it.

ndk after r23 (we are using r21) should be this. Else we must take care to
not re-export it.

From [2], we should pass the flags `Wl,--exclude-libs,libgcc.a` and
`-Wl,--exclude-libs,libunwind.a` to avoid re-export `_Unwind_Resume` methods.

Fix kiwix/kiwix-android#3661

[1] https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#Unwinding
[2] android/ndk#889 (comment)
  • Loading branch information
mgautierfr committed Jun 4, 2024
1 parent f4e2f0a commit 81e80c9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kiwixbuild/configs/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ def install_path(self):
return self.ndk_builder.install_path

def get_cross_config(self):
extra_libs = ["-llog"]
extra_libs = [
"-llog",
"-Wl,--exclude-libs,libgcc.a",
"-Wl,--exclude-libs,libunwind.a",
]
extra_cflags = [
"-I{}".format(include_dir) for include_dir in self.get_include_dirs()
]
Expand Down

0 comments on commit 81e80c9

Please sign in to comment.