llvm-project/llvm/test/CodeGen/RISCV/module-target-abi3.ll
Yunze Zhu 3846e3970f [RISCV] Generate correct ELF abi flag when empty .ll file has target-abi attribute
In patch D121183, target abi is get from .ll file's target-abi
attribute and set in RISCVAsmPrinter::emitFunctionEntryLabel
function. In https://github.com/llvm/llvm-project/issues/57242,
an api mismatch error may be caused by failing to call function
RISCVAsmPrinter::emitFunctionEntryLabel to set target-abi to
correct one when the .ll is empty or a module has no function.

This patch move setting target-abi part to function
RISCVAsmPrinter::emitStartOfAsmFile, make sure all .ll file and
module in LTO read target-abi from module flag and set, with or
without function.

Signed-off-by: xiaojing.zhang <xiaojing.zhang@xcalibyte.com>
Signed-off-by: jianxin.lai <jianxin.lai@xcalibyte.com>

Reviewed By: luismarques

Differential Revision: https://reviews.llvm.org/D132204
2022-08-26 14:39:39 +08:00

8 lines
232 B
LLVM

; RUN: llc -mtriple=riscv32 -filetype=obj < %s | llvm-readelf -h - | FileCheck %s
; CHECK: Flags: 0x2, single-float ABI
attributes #0 = { "target-features"="+f" }
!llvm.module.flags = !{!0}
!0 = !{i32 1, !"target-abi", !"ilp32f"}