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

Why does the unused DT entry appear? #26

Open
Bokili-2022 opened this issue Oct 20, 2023 · 3 comments
Open

Why does the unused DT entry appear? #26

Bokili-2022 opened this issue Oct 20, 2023 · 3 comments

Comments

@Bokili-2022
Copy link

Can someone briefly explain why "WARNING: linker: unused DT entry" appears in compiled programs in Termux?
I have no problem using "termux-elf-cleaner", but can this error be avoided by changing the configuration for "gcc" or "clang"?
Thank you.

@syphyr
Copy link

syphyr commented Oct 20, 2023

It depends on what NDK version you use in combination what Android version you use. If you use Android 7.1 and go back to NDK 21.4.7075529, then the issue should go away by itself.

@Bokili-2022
Copy link
Author

OK. Thank you for this answer, but my confusion is as follows:
I'm using Android 5.1, and on it I compile directly through the terminal commands.
Here is an example of my configuration for nginx:

./configure --prefix=/data/data/com.termux/files/usr/src/nginx
--with-cc=arm-linux-androideabi-clang
--with-cpp=arm-linux-androideabi-cpp
--with-ld-opt='-march=armv7-a -Wl,-z,relro,-z,now'
--with-cc-opt='-I/data/data/com.termux/files/usr/include -DIOV_MAX=1024 -march=armv7-a -mfpu=neon -mfloat-abi=softfp -mthumb -Oz -fstack-protector-strong'
--with-openssl=/data/data/com.termux/files/usr/src/openssl-1.1.1v
--with-zlib=/data/data/com.termux/files/usr/src/zlib-1.3
--with-pcre=/data/data/com.termux/files/usr/src/pcre2-10.42
--with-pcre-jit
--with-threads
--with-stream
--with-stream_ssl_module
--with-stream_realip_module
--with-stream_ssl_preread_module
--with-mail
--with-mail_ssl_module
--with-http_ssl_module
--with-http_v2_module
--with-http_realip_module
--with-http_addition_module
--with-http_sub_module
--with-http_dav_module
--with-http_flv_module
--with-http_mp4_module
--with-http_gunzip_module
--with-http_gzip_static_module
--with-http_auth_request_module
--with-http_random_index_module
--with-http_secure_link_module
--with-http_degradation_module
--with-http_slice_module
--with-http_stub_status_module

As you can see, everything is included for compilation in one program, this time the latest nginx. In the compilation I directly include: "glob.c", "crypt.c", as well as the latest openssl-1.1.1v, zlib-1.3 and pcre2-10.42 from the configuration. So I don't use Termux's libraries, like: "libandroid-glob.so" (I have glob.h and glob.c), "libcrypt.so" (I have crypt.h and crypt.c), "libssl.so.1.1" and "libcrypto.so.1.1" (I have openssl-1.1.1v source code) , "libz.so.1" (I have zlib-1.3 source code) and "libpcre.so" (I have pcre2-10.42 source code). So I only use Termux's compilers "arm-linux-androideabi-clang" and "arm-linux-androideabi-cpp" from "https://packages.termux.dev/termux-main-21/", and everything runs on a device running Android 5.1. Compiled ELF always starts with "WARNING: linker: unused DT entry...".
Could it be because these compilers are older than Android 5.1, or vice versa?

Thank you very much.

@syphyr
Copy link

syphyr commented Oct 20, 2023

Your versions of arm-linux-androideabi-clang and arm-linux-androideabi-cpp are newer than Android 5.1 and add extra ELF flags for newer versions of android. Use a compiler that is from an older NDK, like NDK 21.4.7075529, if you want those ELF warnings to go away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants