[lld] [LLD][ELF][RISCV] Handle .note.gnu.property sections for Zicfilp/Zicfiss features (PR #127193)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 19 09:46:31 PST 2025
================
@@ -0,0 +1,237 @@
+# REQUIRES: riscv
+# RUN: rm -rf %t && split-file %s %t && cd %t
+# RUN: llvm-mc --filetype=obj --triple=riscv32 rv32-func1-zicfilp.s -o rv32-func1-zicfilp.o
+# RUN: llvm-mc --filetype=obj --triple=riscv32 func2.s -o rv32-func2.o
+# RUN: llvm-mc --filetype=obj --triple=riscv32 rv32-func2-zicfilp.s -o rv32-func2-zicfilp.o
+# RUN: llvm-mc --filetype=obj --triple=riscv32 func3.s -o rv32-func3.o
+# RUN: llvm-mc --filetype=obj --triple=riscv32 rv32-func3-zicfilp.s -o rv32-func3-zicfilp.o
+
+# RUN: llvm-mc --filetype=obj --triple=riscv64 rv64-func1-zicfilp.s -o rv64-func1-zicfilp.o
+# RUN: llvm-mc --filetype=obj --triple=riscv64 func2.s -o rv64-func2.o
+# RUN: llvm-mc --filetype=obj --triple=riscv64 rv64-func2-zicfilp.s -o rv64-func2-zicfilp.o
+# RUN: llvm-mc --filetype=obj --triple=riscv64 func3.s -o rv64-func3.o
+# RUN: llvm-mc --filetype=obj --triple=riscv64 rv64-func3-zicfilp.s -o rv64-func3-zicfilp.o
+
+## ZICFILP-func-sig should be enabled when it's enabled in all inputs
+# RUN: ld.lld rv32-func1-zicfilp.o rv32-func2-zicfilp.o rv32-func3-zicfilp.o \
+# RUN: -o - | llvm-readelf -n - | FileCheck --check-prefix ZICFILP %s
+# RUN: ld.lld rv32-func1-zicfilp.o rv32-func3-zicfilp.o --shared \
+# RUN: -o - | llvm-readelf -n - | FileCheck --check-prefix ZICFILP %s
+# RUN: ld.lld rv64-func1-zicfilp.o rv64-func2-zicfilp.o rv64-func3-zicfilp.o \
+# RUN: -o - | llvm-readelf -n - | FileCheck --check-prefix ZICFILP %s
+# RUN: ld.lld rv64-func1-zicfilp.o rv64-func3-zicfilp.o --shared \
+# RUN: -o - | llvm-readelf -n - | FileCheck --check-prefix ZICFILP %s
+# ZICFILP: Properties: RISC-V feature: ZICFILP-func-sig
+
+## ZICFILP-func-sig should not be enabled if it's not enabled in at least one
+## input
+# RUN: ld.lld rv32-func1-zicfilp.o rv32-func2.o rv32-func3-zicfilp.o \
+# RUN: -o - | llvm-readelf -n - | count 0
+# RUN: ld.lld rv32-func2-zicfilp.o rv32-func3.o --shared \
+# RUN: -o - | llvm-readelf -n - | count 0
+# RUN: ld.lld rv64-func1-zicfilp.o rv64-func2.o rv64-func3-zicfilp.o \
+# RUN: -o - | llvm-readelf -n - | count 0
+# RUN: ld.lld rv64-func2-zicfilp.o rv64-func3.o --shared \
+# RUN: -o - | llvm-readelf -n - | count 0
+
+## zicfilp-func-sig-report should report any input files that don't have the
+## zicfilp-func-sig property
+# RUN: ld.lld rv32-func1-zicfilp.o rv32-func2.o rv32-func3-zicfilp.o \
+# RUN: -z zicfilp-func-sig-report=warning -o /dev/null 2>&1 \
+# RUN: | FileCheck --check-prefix=MISS-LP-WARN %s
+# RUN: not ld.lld rv32-func2-zicfilp.o rv32-func3.o --shared \
+# RUN: -z zicfilp-func-sig-report=error 2>&1 \
+# RUN: | FileCheck --check-prefix=MISS-LP-ERROR %s
+
+# RUN: ld.lld rv32-func1-zicfilp.o rv32-func2-zicfilp.o rv32-func3-zicfilp.o \
+# RUN: -z zicfilp-func-sig-report=warning -o /dev/null 2>&1 | count 0
----------------
MaskRay wrote:
`-o /dev/null` unneeded after `cd %t` see 0ffe270d0e1dadc3e16f8fa79882fc3b31d28559
https://github.com/llvm/llvm-project/pull/127193
More information about the llvm-commits
mailing list