termux-packages icon indicating copy to clipboard operation
termux-packages copied to clipboard

[Bug]: Mold linker is implicitly passed unsupported flag by Clang/LLVM

Open StDymphna opened this issue 6 months ago • 1 comments

Problem description

When targeting SDK >=28, (i.e., -target aarch64-unknown-linux-android35), mold will error out from "--use-android-relr-tags" being an unsupported flag.

What steps will reproduce the bug?

#include <stdio.h>

int main(void) {
    printf("This might be more of a mold problem, as not having an obvious way"
           "to ignore unknown flsgs without terminating is... a special design choice.");
}

clang -o repro test.c -fuse-ld=mold -target aarch64-unknown-linux-android35

What is the expected behavior?

It should compile without error, either by warning about ignored flags, or not implicitly passing unsupported flags.

System information

Termux Variables:
TERMUX_API_APP__VERSION_NAME=0.50.1+c553bc2
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP__AM_SOCKET_SERVER_ENABLED=true
TERMUX_APP__APK_PATH=xxxxx
TERMUX_APP__APK_RELEASE=GITHUB
TERMUX_APP__FILES_DIR=/data/user/0/com.termux/files
TERMUX_APP__IS_DEBUGGABLE_BUILD=true
TERMUX_APP__IS_INSTALLED_ON_EXTERNAL_STORAGE=false
TERMUX_APP__PACKAGE_MANAGER=apt
TERMUX_APP__PACKAGE_NAME=com.termux
TERMUX_APP__PACKAGE_VARIANT=apt-android-7
TERMUX_APP__PID=29502
TERMUX_APP__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c79,c258,c512,c768
TERMUX_APP__SE_INFO=default:targetSdkVersion=28:complete
TERMUX_APP__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c79,c258,c512,c768
TERMUX_APP__TARGET_SDK=28
TERMUX_APP__UID=10591
TERMUX_APP__USER_ID=0
TERMUX_APP__VERSION_CODE=118
TERMUX_APP__VERSION_NAME=0.118.0+0314259
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0+0314259
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://mirror.fcix.net/termux/termux-main stable main
# glibc-repo (sources.list.d/glibc.list)
deb https://packages-cf.termux.dev/apt/termux-glibc/ glibc stable
# x11-repo (sources.list.d/x11.list)
deb https://mirror.fcix.net/termux/termux-x11 x11 main
# tur-repo (sources.list.d/tur.list)
deb https://tur.kcubeterm.com tur-packages tur tur-on-device tur-continuous
Updatable packages:
bazel/tur-packages 8.2.1 aarch64 [upgradable from: 8.2.1]
termux-tools version:
1.45.0
Android version:
15
Kernel build information:
xxxxx
Device manufacturer:
xxxxx
Device model:
xxxxx
Supported ABIs:
SUPPORTED_ABIS: arm64-v8a,armeabi-v7a,armeabi
SUPPORTED_32_BIT_ABIS: armeabi-v7a,armeabi
SUPPORTED_64_BIT_ABIS: arm64-v8a
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec-ld-preload.so
Installed termux plugins:
com.termux.x11 versionCode:15
com.termux.styling versionCode:1000
com.termux.api versionCode:51

StDymphna avatar Jun 15 '25 18:06 StDymphna

The same as binutils/bfd. ~~I think it should be reported to llvm-project.~~ It seems that clang/llvm only supports using lld as Android's linker, see https://github.com/llvm/llvm-project/blob/b16d43a874748a496da5cd774dd864c95b78d6b0/clang/lib/Driver/ToolChains/Linux.cpp#L253.

licy183 avatar Jun 15 '25 18:06 licy183