-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Linker Warning: Hard-float 'd' ABI can't be used for a target that doesn't support the D instruction set extension (ignoring target-abi) #69780
Comments
@llvm/issue-subscribers-backend-risc-v Author: AdityaK (hiraditya)
This happens while building aosp with lto. A reduced case of building libziparchive also gives this warning. Here is the linker invocation.
> "clang/host/linux-x86/clang-r498229b/bin/ld.lld" -z now -z relro --hash-style=gnu --eh-frame-hdr -m elf64lriscv -X -shared -o out/soong/.intermediates/system/libziparchive/libziparchive/android_vendor_ramdisk_riscv64_shared_cfi/unstripped/libziparchive.so -Lclang/host/linux-x86/clang-r498229b/lib/clang/17/lib/linux/riscv64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/lib -L/usr/lib -plugin-opt=mcpu=generic-rv64 --no-demangle --export-dynamic-symbol=__cfi_check out/soong/.intermediates/bionic/libc/crtbegin_so/android_vendor_ramdisk_riscv64/crtbegin_so.o out/soong/.intermediates/system/libziparchive/libziparchive/android_vendor_ramdisk_riscv64_static_cfi_lto-none/obj/system/libziparchive/zip_archive.o out/soong/.intermediates/system/libziparchive/libziparchive/android_vendor_ramdisk_riscv64_static_cfi_lto-none/obj/system/libziparchive/zip_archive_stream_entry.o out/soong/.intermediates/system/libziparchive/libziparchive/android_vendor_ramdisk_riscv64_static_cfi_lto-none/obj/system/libziparchive/zip_cd_entry_map.o out/soong/.intermediates/system/libziparchive/libziparchive/android_vendor_ramdisk_riscv64_static_cfi_lto-none/obj/system/libziparchive/zip_error.o out/soong/.intermediates/system/libziparchive/libziparchive/android_vendor_ramdisk_riscv64_static_cfi_lto-none/obj/system/libziparchive/zip_writer.o out/soong/.intermediates/external/libcxxabi/libc++demangle/android_vendor_ramdisk_riscv64_static_lto-none/libc++demangle.a prebuilts/clang/host/linux-x86/clang-r498229b/lib/clang/17/lib/linux/libclang_rt.ubsan_minimal-riscv64-android.a prebuilts/clang/host/linux-x86/clang-r498229b/lib/clang/17/lib/linux/libclang_rt.builtins-riscv64-android.a out/soong/.intermediates/system/logging/liblog/liblog/android_vendor_ramdisk_riscv64_shared/liblog.so out/soong/.intermediates/system/libbase/libbase/android_vendor_ramdisk_riscv64_shared/libbase.so out/soong/.intermediates/external/zlib/libz/android_vendor_ramdisk_riscv64_shared/libz.so out/soong/.intermediates/external/libcxx/libc++/android_vendor_ramdisk_riscv64_shared/libc++.so out/soong/.intermediates/bionic/libc/libc/android_vendor_ramdisk_riscv64_shared/libc.so out/soong/.intermediates/bionic/libm/libm/android_vendor_ramdisk_riscv64_shared/libm.so out/soong/.intermediates/bionic/libdl/libdl/android_vendor_ramdisk_riscv64_shared/libdl.so out/soong/.intermediates/bionic/libc/crtend_so/android_vendor_ramdisk_riscv64/crtend_so.o -z noexecstack -z relro -z now --build-id=md5 --fatal-warnings --no-undefined-version --exclude-libs libgcc.a --exclude-libs libgcc_stripped.a --exclude-libs libunwind_llvm.a --exclude-libs libunwind.a -mllvm -regalloc-enable-advisor=release --icf=safe --pack-dyn-relocs=android+relr --no-undefined --hash-style=gnu -z max-page-size=4096 -plugin-opt -emulated-tls=0 --gc-sections -soname libziparchive.so -plugin-opt O1 --exclude-libs=libclang_rt.builtins-riscv64-android.a --exclude-libs=libclang_rt.ubsan_minimal-riscv64-android.a All the binary files (including the ones in .a) have 'double-float ABI'. it could be that the bitcode files 'out/soong/.intermediates/system/libziparchive/libziparchive/android_vendor_ramdisk_riscv64_static_cfi_lto-none/obj/system/libziparchive/*.o' are not getting compiled with the double-float flag? Related discussions/PR: |
Maybe we should also improve the warning to include the offending file that is causing the issue? The warning comes from:
|
The warning is only emitted from (IIUC) compiler generated functions like define void @__cfi_check(i64 %0, ptr %1, ptr %2) align 4096
define private void @.cfi.jumptable() #46 align 8 Seems like the bug is in functions like Currently arm has a hacky way of adding llvm-project/llvm/lib/Transforms/IPO/CrossDSOCFI.cpp Lines 94 to 100 in 4ed543d
Seems like we are missing something like a 'target-feature-unification' pass as the final binary can only support a specific ABI. |
Related patch #98673 |
Module can be used to query target-abi (follow up patch) which can be used to populate default subtarget features. It is currently not possible to provide any reasonable target-features for compiler generated functions (See: llvm#69780) Having a target-abi will provide a way to add minimal requirements for target-features like `+d` for RISC-V.
…tFeatures It is currently not possible to provide any reasonable target-features for compiler generated functions (See: llvm#69780) Having a target-abi will provide a way to add minimal requirements for target-features like `+d` for RISC-V.
…tFeatures It is currently not possible to provide any reasonable target-features for compiler generated functions (See: llvm#69780) Having a target-abi will provide a way to add minimal requirements for target-features like `+d` for RISC-V.
…tFeatures It is currently not possible to provide any reasonable target-features for compiler generated functions (See: llvm#69780) Having a target-abi will provide a way to add minimal requirements for target-features like `+d` for RISC-V.
…tFeatures It is currently not possible to provide any reasonable target-features for compiler generated functions (See: llvm#69780) Having a target-abi will provide a way to add minimal requirements for target-features like `+d` for RISC-V.
…tFeatures It is currently not possible to provide any reasonable target-features for compiler generated functions (See: llvm#69780) Having a target-abi will provide a way to add minimal requirements for target-features like `+d` for RISC-V.
…tFeatures It is currently not possible to provide any reasonable target-features for compiler generated functions (See: llvm#69780) Having a target-abi will provide a way to add minimal requirements for target-features like `+d` for RISC-V.
…tFeatures It is currently not possible to provide any reasonable target-features for compiler generated functions (See: llvm#69780) Having a target-abi will provide a way to add minimal requirements for target-features like `+d` for RISC-V.
…tFeatures It is currently not possible to provide any reasonable target-features for compiler generated functions (See: llvm#69780) Having a target-abi will provide a way to add minimal requirements for target-features like `+d` for RISC-V.
…tFeatures It is currently not possible to provide any reasonable target-features for compiler generated functions (See: llvm#69780) Having a target-abi will provide a way to add minimal requirements for target-features like `+d` for RISC-V.
…tFeatures It is currently not possible to provide any reasonable target-features for compiler generated functions (See: llvm#69780) Having a target-abi will provide a way to add minimal requirements for target-features like `+d` for RISC-V.
…tFeatures It is currently not possible to provide any reasonable target-features for compiler generated functions (See: llvm#69780) Having a target-abi will provide a way to add minimal requirements for target-features like `+d` for RISC-V.
…tFeatures It is currently not possible to provide any reasonable target-features for compiler generated functions (See: llvm#69780) Having a target-abi will provide a way to add minimal requirements for target-features like `+d` for RISC-V.
…tFeatures It is currently not possible to provide any reasonable target-features for compiler generated functions (See: llvm#69780) Having a target-abi will provide a way to add minimal requirements for target-features like `+d` for RISC-V.
…tFeatures It is currently not possible to provide any reasonable target-features for compiler generated functions (See: llvm#69780) Having a target-abi will provide a way to add minimal requirements for target-features like `+d` for RISC-V.
I've been seeing this warning with some llvm-test-suite compiles, and believe I have a case where it occurs that's not addressed by any of the in-flight patches. I've narrowed it down to the GlobalOpt pass: tc.ll:
./bin/opt < tc2.ll -S -passes=globalopt >/dev/null
Hard-float 'd' ABI can't be used for a target that doesn't support the D instruction set extension (ignoring target-abi) |
It appears we're trying to get the TTI for an llvm.memcpy declaration. We should probably get TTI for the caller instead.
|
Querying TTI creates a Subtarget object, but an llvm.memcpy declaration doesn't have target-cpu and target-feature attributes like functions with definitions. This can cause a warning to be printed on RISC-V because the target-abi in the Module requires floating point, but the subtarget features don't enable floating point. So far we've only seen this in LTO when an -mcpu is not supplied for the TargetMachine. To fix this, get TTI for the calling function instead. Fixes the issue reported here #69780 (comment)
…(#127760) Querying TTI creates a Subtarget object, but an llvm.memcpy declaration doesn't have target-cpu and target-feature attributes like functions with definitions. This can cause a warning to be printed on RISC-V because the target-abi in the Module requires floating point, but the subtarget features don't enable floating point. So far we've only seen this in LTO when an -mcpu is not supplied for the TargetMachine. To fix this, get TTI for the calling function instead. Fixes the issue reported here llvm/llvm-project#69780 (comment)
This happens while building aosp with lto. A reduced case of building libziparchive also gives this warning. Here is the linker invocation.
All the binary files (including the ones in .a) have 'double-float ABI'. it could be that the bitcode files 'out/soong/.intermediates/system/libziparchive/libziparchive/android_vendor_ramdisk_riscv64_static_cfi_lto-none/obj/system/libziparchive/*.o' are not getting compiled with the double-float flag?
Repro steps if you one can download aosp.
$ lunch aosp_riscv64-userdebug $ cd system/libziparchive $ mm
Related discussions/PRs/issues:
The text was updated successfully, but these errors were encountered: