-
Notifications
You must be signed in to change notification settings - Fork 259
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
investigate strange lld behavior reported on SO #927
Comments
This seems like a fairly common error in lld. Do a google search for "in global part of symbol table" (and also in internal bug tracker. b/77634281 for when we saw it in the Android platform). The ideal resolution is to link everything with LLD. Since that's not always feasible, other workarounds are to use --no-fatal-warnings or remove --gc-sections. I am not entirely sure why the latter matters for this error. |
Is there a third workaround? Or maybe a fix? Android really needs |
Here is a simple way to reproduce the problem.
To build it, In short,
Workaround is to remove |
I just checked ndk-19 -fuse-ld=lld with android toolchain.cmake readelf -s libgc_sections.so | grep bss CMakeLists.txt .cc
Build ninja -v |
Thanks everyone for helping me out. Feel free to close the issue. |
AFIR binutils ld is the default linker still, but im not sure if bfd was the proper default for aarch64, afir there at some point was gold set as default for aarch64. I use from ndk 17 as default linker lld for my project. -fuse-ld=gold -fuse-ld=bfd |
And if you build on windows with lld dont forget to disable threads if(CMAKE_HOST_WIN32 ) |
If you use cmake to build the library, you can use following command to fix the problem: cmake -DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=lld .. |
We are transitioning to LLD, and it sounds like there isn't much else to be done about this, since it's a bfd bug and LLD is just warning about it. (I'd love to be able to selectively enable and disable warnings/werror for the linker like I can for the compiler, but that's well outside the scope of this bug and out of our control.) |
I have similar problem with ndk22/23(beta) ld.lld, |
From #927 (comment), it sounds like those dependencies need to be rebuilt (with LLD). Unfortunately there isn't anything we can do to fix bfd codegen bugs that have already shipped. LLD is correct in emitting the warning because it's handling a suspicious input. You can disable linker warnings in your project ( |
Thanks, unfortunately experiment with "no-fatal-warnings" failed: [arm64-v8a] SharedLibrary : libsomething-jni.so ... list of object files and static libs ... -lgcc -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -latomic -Wl,--exclude-libs,libatomic.a ... list of shared libs ... -target aarch64-none-linux-androidNN -no-canonical-prefixes -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--no-fatal-warnings -nostdlib++ -Wl,--no-undefined -Wl,--fatal-warnings ... list of -lXXX ... -o path-to/libsomething-jni.so What is the best way to remove/suppress built-it "-Wl,--fatal-warnings" ? |
fixed by these lines: LOCAL_DISABLE_FATAL_LINKER_WARNINGS := true in my JNI lib's Android.mk. |
ndk-r21e (latest LTS version) doesn't seem to have this bug. ndk-21b(latest stable version) also doesn't have this bug, but its maximum supported native api level is 29, if you need to work with api 30, go with ndk-21e. ndk-22b, 23 beta both have this bug. --- Above results were tested on ubuntu18, not sure if same results apply on windows or other OS. |
If it is in fact the same bug then the answer hasn't changed: #927 (comment) If it's a new bug please file a new bug with repro instructions. |
Bump its been 2 months and this bug is still on ive been trying to build an arm64-v8a libfmod.so and still get the in global part of symbol table, have tried every latest NDK and CMake and every argument option there is but to no avail :( |
Same answer as the comment before yours. |
ld: error: found local symbol '__bss_end__' in global part of symbol table in file C:/Users/ccxxxi/projects/ecg_monitor/build/app/pytorch_android-1.10.0.aar/jni/arm64-v8a\libpytorch_jni.so android/ndk#927 (comment) https://stackoverflow.com/questions/57175936/how-to-set-local-ldflags-local-cppflags-with-cmake-in-ndk
ld: error: found local symbol '__bss_end__' in global part of symbol table in file C:/Users/ccxxxi/projects/ecg_monitor/build/app/pytorch_android-1.10.0.aar/jni/arm64-v8a\libpytorch_jni.so android/ndk#927 (comment) https://stackoverflow.com/questions/57175936/how-to-set-local-ldflags-local-cppflags-with-cmake-in-ndk
ld: error: found local symbol '__bss_end__' in global part of symbol table in file C:/Users/ccxxxi/projects/ecg_monitor/build/app/pytorch_android-1.10.0.aar/jni/arm64-v8a\libpytorch_jni.so android/ndk#927 (comment) https://stackoverflow.com/questions/57175936/how-to-set-local-ldflags-local-cppflags-with-cmake-in-ndk
ld: error: found local symbol '__bss_end__' in global part of symbol table in file C:/Users/ccxxxi/projects/ecg_monitor/build/app/pytorch_android-1.10.0.aar/jni/arm64-v8a\libpytorch_jni.so android/ndk#927 (comment) https://stackoverflow.com/questions/57175936/how-to-set-local-ldflags-local-cppflags-with-cmake-in-ndk
ld: error: found local symbol '__bss_end__' in global part of symbol table in file C:/Users/ccxxxi/projects/ecg_monitor/build/app/pytorch_android-1.10.0.aar/jni/arm64-v8a\libpytorch_jni.so android/ndk#927 (comment) https://stackoverflow.com/questions/57175936/how-to-set-local-ldflags-local-cppflags-with-cmake-in-ndk
ld: error: found local symbol '__bss_end__' in global part of symbol table in file C:/Users/ccxxxi/projects/ecg_monitor/build/app/pytorch_android-1.10.0.aar/jni/arm64-v8a\libpytorch_jni.so android/ndk#927 (comment) https://stackoverflow.com/questions/57175936/how-to-set-local-ldflags-local-cppflags-with-cmake-in-ndk
@DanAlbert Hello, can you please help me with the following error.
I am getting this error while I am trying to link an external .so file in my project. I have tried using different versions of ndk but still getting the same error. Note: .so file is stripped
any help will be appreciated. |
@everyone any updates? |
You need to file a new bug with the appropriate context.
|
https://stackoverflow.com/q/55014879/632035
Whatever is going on in this bug is strange. Looks like the user was using lld and having issues with
--gc-sections
. Should see if we can figure out what's causing that...The text was updated successfully, but these errors were encountered: