brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.8 KiB · c5818dd Raw
237 lines · plain
1# REQUIRES: riscv2## Test the ZICFILP func-sig feature.3## To lift maintenance burden, most tests are conducted only with 64-bit RISC-V4## Naming convention: *-s.s files enables ZICFILP func-sig.5## Naming convention: *-u.s files enables ZICFILP unlabeled.6# RUN: rm -rf %t && split-file %s %t && cd %t7# RUN: llvm-mc --filetype=obj --triple=riscv32 rv32-f1-s.s -o rv32-f1-s.o8# RUN: llvm-mc --filetype=obj --triple=riscv32 rv32-f2-s.s -o rv32-f2-s.o9# RUN: llvm-mc --filetype=obj --triple=riscv32 rv32-f3-s.s -o rv32-f3-s.o10 11# RUN: llvm-mc --filetype=obj --triple=riscv64 f1-s.s -o f1-s.o12# RUN: llvm-mc --filetype=obj --triple=riscv64 f2.s   -o f2.o13# RUN: llvm-mc --filetype=obj --triple=riscv64 f2-s.s -o f2-s.o14# RUN: llvm-mc --filetype=obj --triple=riscv64 f3.s   -o f3.o15# RUN: llvm-mc --filetype=obj --triple=riscv64 f3-s.s -o f3-s.o16# RUN: llvm-mc --filetype=obj --triple=riscv64 f3-u.s -o f3-u.o17 18## ZICFILP-func-sig should be enabled when it's enabled in all inputs or when19## it's forced on.20# RUN: ld.lld rv32-f1-s.o rv32-f2-s.o rv32-f3-s.o -o out.rv32 --fatal-warnings21# RUN: llvm-readelf -n out.rv32 | FileCheck --check-prefix=ZICFILP %s22# RUN: ld.lld f1-s.o f2-s.o f3-s.o -o out --fatal-warnings23# RUN: llvm-readelf -n out | FileCheck --check-prefix=ZICFILP %s24# RUN: ld.lld f1-s.o f3-s.o --shared -o out.so --fatal-warnings25# RUN: llvm-readelf -n out.so | FileCheck --check-prefix=ZICFILP %s26# RUN: ld.lld f1-s.o f2.o f3-s.o -o out.force -z zicfilp=func-sig --fatal-warnings27# RUN: llvm-readelf -n out.force | FileCheck --check-prefix=ZICFILP %s28# RUN: ld.lld f2-s.o f3.o --shared -o out.force.so -z zicfilp=never -z zicfilp=func-sig --fatal-warnings29# RUN: llvm-readelf -n out.force.so | FileCheck --check-prefix=ZICFILP %s30# ZICFILP: Properties: RISC-V feature: ZICFILP-func-sig31 32## ZICFILP-func-sig should not be enabled if it's not enabled in at least one33## input34# RUN: ld.lld f1-s.o f2.o f3-s.o -o out.no --fatal-warnings35# RUN: llvm-readelf -n out.no | count 036# RUN: ld.lld f2-s.o f3.o --shared -o out.no.so --fatal-warnings37# RUN: llvm-readelf -n out.no.so | count 038 39## ZICFILP-func-sig should be disabled with zicfilp=never, even if40## ZICFILP-func-sig is present in all inputs.41# RUN: ld.lld f1-s.o f2-s.o f3-s.o -z zicfilp=func-sig -z zicfilp=never -o out.never --fatal-warnings42# RUN: llvm-readelf -n out.never | count 043 44## zicfilp-func-sig-report should report any input files that don't have the45## ZICFILP-func-sig property46# RUN: ld.lld f1-s.o f2.o f3-s.o -z zicfilp-func-sig-report=warning 2>&1 | FileCheck --check-prefix=REPORT-WARN %s47# RUN: ld.lld f1-s.o f2.o f3-s.o -z zicfilp-func-sig-report=warning -z zicfilp=func-sig 2>&1 | FileCheck --check-prefix=REPORT-WARN %s48# RUN: ld.lld f1-s.o f2.o f3-s.o -z zicfilp-func-sig-report=warning -z zicfilp=never 2>&1 | FileCheck --check-prefix=REPORT-WARN %s49# RUN: not ld.lld f2-s.o f3.o --shared -z zicfilp-func-sig-report=error 2>&1 | FileCheck --check-prefix=REPORT-ERROR %s50# RUN: ld.lld f1-s.o f2-s.o f3-s.o -z zicfilp-func-sig-report=warning -z zicfilp=func-sig 2>&1 | count 051# REPORT-WARN: warning: f2.o: -z zicfilp-func-sig-report: file does not have GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG property52# REPORT-ERROR: error: f3.o: -z zicfilp-func-sig-report: file does not have GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG property53 54## An invalid -z zicfilp-func-sig-report option should give an error55# RUN: not ld.lld f2-s.o -z zicfilp-func-sig-report=x 2>&1 | FileCheck --check-prefix=INVALID %s56# INVALID: error: unknown -z zicfilp-func-sig-report= value: x57 58## ZICFILP-unlabeled and ZICFILP-func-sig should conflict with each other.59# RUN: ld.lld f3-u.o -o out.override -z zicfilp=func-sig 2>&1 | FileCheck --check-prefix=FORCE-CONFLICT %s60# FORCE-CONFLICT: warning: f3-u.o: -z zicfilp=func-sig: file has conflicting property: GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED61 62## -z zicfilp=func-sig should override and disable ZICFILP-unlabeled.63# RUN: llvm-readelf -n out.override | FileCheck --check-prefixes=ZICFILP,OVERRIDE %s64# OVERRIDE-NOT: ZICFILP-unlabeled65 66#--- rv32-f1-s.s67.section ".note.gnu.property", "a"68.balign 469.4byte 470.4byte (ndesc_end - ndesc_begin)71.4byte 0x5        // NT_GNU_PROPERTY_TYPE_072.asciz "GNU"73ndesc_begin:74.balign 475.4byte 0xc0000000 // GNU_PROPERTY_RISCV_FEATURE_1_AND76.4byte 477.4byte 4          // GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG78.balign 479ndesc_end:80 81.text82.globl _start83.type f1,%function84f1:85  call f286  ret87 88#--- f1-s.s89.section ".note.gnu.property", "a"90.balign 891.4byte 492.4byte (ndesc_end - ndesc_begin)93.4byte 0x5        // NT_GNU_PROPERTY_TYPE_094.asciz "GNU"95ndesc_begin:96.balign 897.4byte 0xc0000000 // GNU_PROPERTY_RISCV_FEATURE_1_AND98.4byte 499.4byte 4          // GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG100.balign 8101ndesc_end:102 103.text104.globl _start105.type f1,%function106f1:107  call f2108  ret109 110#--- f2.s111.text112.globl f2113.type f2,@function114f2:115  .globl f3116  .type f3, @function117  call f3118  ret119 120#--- rv32-f2-s.s121.section ".note.gnu.property", "a"122.balign 4123.4byte 4124.4byte (ndesc_end - ndesc_begin)125.4byte 0x5        // NT_GNU_PROPERTY_TYPE_0126.asciz "GNU"127ndesc_begin:128.balign 4129.4byte 0xc0000000 // GNU_PROPERTY_RISCV_FEATURE_1_AND130.4byte 4131.4byte 4          // GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG132.balign 4133ndesc_end:134 135.text136.globl f2137.type f2,@function138f2:139  .globl f3140  .type f3, @function141  call f3142  ret143 144#--- f2-s.s145.section ".note.gnu.property", "a"146.balign 8147.4byte 4148.4byte (ndesc_end - ndesc_begin)149.4byte 0x5        // NT_GNU_PROPERTY_TYPE_0150.asciz "GNU"151ndesc_begin:152.balign 8153.4byte 0xc0000000 // GNU_PROPERTY_RISCV_FEATURE_1_AND154.4byte 4155.4byte 4          // GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG156.balign 8157ndesc_end:158 159.text160.globl f2161.type f2,@function162f2:163  .globl f3164  .type f3, @function165  call f3166  ret167 168#--- f3.s169.text170.globl f3171.type f3,@function172f3:173  ret174 175#--- rv32-f3-s.s176.section ".note.gnu.property", "a"177.balign 4178.4byte 4179.4byte (ndesc_end - ndesc_begin)180.4byte 0x5        // NT_GNU_PROPERTY_TYPE_0181.asciz "GNU"182ndesc_begin:183.balign 4184.4byte 0xc0000000 // GNU_PROPERTY_RISCV_FEATURE_1_AND185.4byte 4186.4byte 4          // GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG187.balign 4188ndesc_end:189 190.text191.globl f3192.type f3,@function193f3:194  ret195 196#--- f3-s.s197.section ".note.gnu.property", "a"198.balign 8199.4byte 4200.4byte (ndesc_end - ndesc_begin)201.4byte 0x5        // NT_GNU_PROPERTY_TYPE_0202.asciz "GNU"203ndesc_begin:204.balign 8205.4byte 0xc0000000 // GNU_PROPERTY_RISCV_FEATURE_1_AND206.4byte 4207.4byte 4          // GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG208.balign 8209ndesc_end:210 211.text212.globl f3213.type f3,@function214f3:215  ret216 217#--- f3-u.s218.section ".note.gnu.property", "a"219.balign 8220.4byte 4221.4byte (ndesc_end - ndesc_begin)222.4byte 0x5        // NT_GNU_PROPERTY_TYPE_0223.asciz "GNU"224ndesc_begin:225.balign 8226.4byte 0xc0000000 // GNU_PROPERTY_RISCV_FEATURE_1_AND227.4byte 4228.4byte 1          // GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED229.balign 8230ndesc_end:231 232.text233.globl f3234.type f3,@function235f3:236  ret237