brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.7 KiB · 20491f0 Raw
264 lines · plain
1# REQUIRES: riscv2## Test the ZICFILP unlabeled feature.3## To lift maintenance burden, most tests are conducted only with 64-bit RISC-V4## Naming convention: *-s.s files enables ZICFILP unlabeled.5## Naming convention: *-f.s files enables ZICFILP func-sig.6## Naming convention: *-c.s files enables both of the conflicting ZICFILP unlabeled and ZICFILP func-sig features.7# RUN: rm -rf %t && split-file %s %t && cd %t8# RUN: llvm-mc --filetype=obj --triple=riscv32 rv32-f1-s.s -o rv32-f1-s.o9# RUN: llvm-mc --filetype=obj --triple=riscv32 rv32-f2-s.s -o rv32-f2-s.o10# RUN: llvm-mc --filetype=obj --triple=riscv32 rv32-f3-s.s -o rv32-f3-s.o11 12# RUN: llvm-mc --filetype=obj --triple=riscv64 f1-s.s -o f1-s.o13# RUN: llvm-mc --filetype=obj --triple=riscv64 f1-c.s -o f1-c.o14# RUN: llvm-mc --filetype=obj --triple=riscv64 f2.s   -o f2.o15# RUN: llvm-mc --filetype=obj --triple=riscv64 f2-s.s -o f2-s.o16# RUN: llvm-mc --filetype=obj --triple=riscv64 f3.s   -o f3.o17# RUN: llvm-mc --filetype=obj --triple=riscv64 f3-s.s -o f3-s.o18# RUN: llvm-mc --filetype=obj --triple=riscv64 f3-f.s -o f3-f.o19 20## ZICFILP-unlabeled should be enabled when it's enabled in all inputs or when21## it's forced on.22# RUN: ld.lld rv32-f1-s.o rv32-f2-s.o rv32-f3-s.o -o out.rv32 --fatal-warnings23# RUN: llvm-readelf -n out.rv32 | FileCheck --check-prefix=ZICFILP %s24# RUN: ld.lld f1-s.o f2-s.o f3-s.o -o out --fatal-warnings25# RUN: llvm-readelf -n out | FileCheck --check-prefix=ZICFILP %s26# RUN: ld.lld f1-s.o f3-s.o --shared -o out.so --fatal-warnings27# RUN: llvm-readelf -n out.so | FileCheck --check-prefix=ZICFILP %s28# RUN: ld.lld f1-s.o f2.o f3-s.o -o out.force -z zicfilp=unlabeled --fatal-warnings29# RUN: llvm-readelf -n out.force | FileCheck --check-prefix=ZICFILP %s30# RUN: ld.lld f2-s.o f3.o --shared -o out.force.so -z zicfilp=never -z zicfilp=unlabeled --fatal-warnings31# RUN: llvm-readelf -n out.force.so | FileCheck --check-prefix=ZICFILP %s32# ZICFILP: Properties: RISC-V feature: ZICFILP-unlabeled33 34## ZICFILP-unlabeled should not be enabled if it's not enabled in at least one35## input36# RUN: ld.lld f1-s.o f2.o f3-s.o -o out.no --fatal-warnings37# RUN: llvm-readelf -n out.no | count 038# RUN: ld.lld f2-s.o f3.o --shared -o out.no.so --fatal-warnings39# RUN: llvm-readelf -n out.no.so | count 040 41## ZICFILP-unlabeled should be disabled with zicfilp=never, even if42## ZICFILP-unlabeled is present in all inputs.43# RUN: ld.lld f1-s.o f2-s.o f3-s.o -z zicfilp=unlabeled -z zicfilp=never -o out.never --fatal-warnings44# RUN: llvm-readelf -n out.never | count 045 46## zicfilp-unlabeled-report should report any input files that don't have the47## ZICFILP-unlabeled property48# RUN: ld.lld f1-s.o f2.o f3-s.o -z zicfilp-unlabeled-report=warning 2>&1 | FileCheck --check-prefix=REPORT-WARN %s49# RUN: ld.lld f1-s.o f2.o f3-s.o -z zicfilp-unlabeled-report=warning -z zicfilp=unlabeled 2>&1 | FileCheck --check-prefix=REPORT-WARN %s50# RUN: ld.lld f1-s.o f2.o f3-s.o -z zicfilp-unlabeled-report=warning -z zicfilp=never 2>&1 | FileCheck --check-prefix=REPORT-WARN %s51# RUN: not ld.lld f2-s.o f3.o --shared -z zicfilp-unlabeled-report=error 2>&1 | FileCheck --check-prefix=REPORT-ERROR %s52# RUN: ld.lld f1-s.o f2-s.o f3-s.o -z zicfilp-unlabeled-report=warning -z zicfilp=never 2>&1 | count 053# REPORT-WARN: warning: f2.o: -z zicfilp-unlabeled-report: file does not have GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED property54# REPORT-ERROR: error: f3.o: -z zicfilp-unlabeled-report: file does not have GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED property55 56## An invalid -z zicfilp-unlabeled-report option should give an error57# RUN: not ld.lld f2-s.o -z zicfilp=x -z zicfilp-unlabeled-report=x 2>&1 | FileCheck --check-prefix=INVALID %s58# INVALID: error: unknown -z zicfilp= value: x59# INVALID: error: unknown -z zicfilp-unlabeled-report= value: x60 61## ZICFILP-unlabeled and ZICFILP-func-sig should conflict with each other62# RUN: not ld.lld f1-c.o 2>&1 | FileCheck --check-prefix=CONFLICT %s63# RUN: ld.lld f3-f.o -o out.override -z zicfilp=unlabeled 2>&1 | FileCheck --check-prefix=FORCE-CONFLICT %s64# CONFLICT: error: f1-c.o: file has conflicting properties: GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED and GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG65# FORCE-CONFLICT: warning: f3-f.o: -z zicfilp=unlabeled: file has conflicting property: GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG66 67## -z zicfilp=unlabeled should override and disable ZICFILP-func-sig.68# RUN: llvm-readelf -n out.override | FileCheck --check-prefixes=ZICFILP,OVERRIDE %s69# OVERRIDE-NOT: ZICFILP-func-sig70 71#--- rv32-f1-s.s72.section ".note.gnu.property", "a"73.balign 474.4byte 475.4byte (ndesc_end - ndesc_begin)76.4byte 0x5        // NT_GNU_PROPERTY_TYPE_077.asciz "GNU"78ndesc_begin:79.balign 480.4byte 0xc0000000 // GNU_PROPERTY_RISCV_FEATURE_1_AND81.4byte 482.4byte 1          // GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED83.balign 484ndesc_end:85 86.text87.globl _start88.type f1,%function89f1:90  call f291  ret92 93#--- f1-s.s94.section ".note.gnu.property", "a"95.balign 896.4byte 497.4byte (ndesc_end - ndesc_begin)98.4byte 0x5        // NT_GNU_PROPERTY_TYPE_099.asciz "GNU"100ndesc_begin:101.balign 8102.4byte 0xc0000000 // GNU_PROPERTY_RISCV_FEATURE_1_AND103.4byte 4104.4byte 1          // GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED105.balign 8106ndesc_end:107 108.text109.globl _start110.type f1,%function111f1:112  call f2113  ret114 115#--- f1-c.s116.section ".note.gnu.property", "a"117.balign 8118.4byte 4119.4byte (ndesc_end - ndesc_begin)120.4byte 0x5        // NT_GNU_PROPERTY_TYPE_0121.asciz "GNU"122ndesc_begin:123.balign 8124.4byte 0xc0000000 // GNU_PROPERTY_RISCV_FEATURE_1_AND125.4byte 4126.4byte 5          // GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED | GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG127.balign 8128ndesc_end:129 130.text131.globl _start132.type f1,%function133f1:134  call f2135  ret136 137#--- f2.s138.text139.globl f2140.type f2,@function141f2:142  .globl f3143  .type f3, @function144  call f3145  ret146 147#--- rv32-f2-s.s148.section ".note.gnu.property", "a"149.balign 4150.4byte 4151.4byte (ndesc_end - ndesc_begin)152.4byte 0x5        // NT_GNU_PROPERTY_TYPE_0153.asciz "GNU"154ndesc_begin:155.balign 4156.4byte 0xc0000000 // GNU_PROPERTY_RISCV_FEATURE_1_AND157.4byte 4158.4byte 1          // GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED159.balign 4160ndesc_end:161 162.text163.globl f2164.type f2,@function165f2:166  .globl f3167  .type f3, @function168  call f3169  ret170 171#--- f2-s.s172.section ".note.gnu.property", "a"173.balign 8174.4byte 4175.4byte (ndesc_end - ndesc_begin)176.4byte 0x5        // NT_GNU_PROPERTY_TYPE_0177.asciz "GNU"178ndesc_begin:179.balign 8180.4byte 0xc0000000 // GNU_PROPERTY_RISCV_FEATURE_1_AND181.4byte 4182.4byte 1          // GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED183.balign 8184ndesc_end:185 186.text187.globl f2188.type f2,@function189f2:190  .globl f3191  .type f3, @function192  call f3193  ret194 195#--- f3.s196.text197.globl f3198.type f3,@function199f3:200  ret201 202#--- rv32-f3-s.s203.section ".note.gnu.property", "a"204.balign 4205.4byte 4206.4byte (ndesc_end - ndesc_begin)207.4byte 0x5        // NT_GNU_PROPERTY_TYPE_0208.asciz "GNU"209ndesc_begin:210.balign 4211.4byte 0xc0000000 // GNU_PROPERTY_RISCV_FEATURE_1_AND212.4byte 4213.4byte 1          // GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED214.balign 4215ndesc_end:216 217.text218.globl f3219.type f3,@function220f3:221  ret222 223#--- f3-s.s224.section ".note.gnu.property", "a"225.balign 8226.4byte 4227.4byte (ndesc_end - ndesc_begin)228.4byte 0x5        // NT_GNU_PROPERTY_TYPE_0229.asciz "GNU"230ndesc_begin:231.balign 8232.4byte 0xc0000000 // GNU_PROPERTY_RISCV_FEATURE_1_AND233.4byte 4234.4byte 1          // GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED235.balign 8236ndesc_end:237 238.text239.globl f3240.type f3,@function241f3:242  ret243 244#--- f3-f.s245.section ".note.gnu.property", "a"246.balign 8247.4byte 4248.4byte (ndesc_end - ndesc_begin)249.4byte 0x5        // NT_GNU_PROPERTY_TYPE_0250.asciz "GNU"251ndesc_begin:252.balign 8253.4byte 0xc0000000 // GNU_PROPERTY_RISCV_FEATURE_1_AND254.4byte 4255.4byte 4          // GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG256.balign 8257ndesc_end:258 259.text260.globl f3261.type f3,@function262f3:263  ret264