xref: /llvm-project/llvm/test/CodeGen/RISCV/sdata-sections.ll (revision 4d348f72d3ac4289821f944a99cdb4b6af21aa7b)
1*4d348f72SKaiWeng; RUN: llc -mtriple=riscv32 -data-sections < %s | FileCheck -check-prefix=RV32 %s
2*4d348f72SKaiWeng; RUN: llc -mtriple=riscv64 -data-sections < %s | FileCheck -check-prefix=RV64 %s
3*4d348f72SKaiWeng
4*4d348f72SKaiWeng; Append an unique name to each sdata/sbss section when -data-section.
5*4d348f72SKaiWeng
6*4d348f72SKaiWeng@v = dso_local global i32 0, align 4
7*4d348f72SKaiWeng@r = dso_local global i64 7, align 8
8*4d348f72SKaiWeng
9*4d348f72SKaiWeng; If a symbol has an explicit section name, we should honor it.
10*4d348f72SKaiWeng@vv = dso_local global i32 0, section ".sbss", align 4
11*4d348f72SKaiWeng@rr = dso_local global i64 7, section ".sdata", align 8
12*4d348f72SKaiWeng@bb = dso_local global i32 0, section ".sbss_like", align 4
13*4d348f72SKaiWeng@tt = dso_local global i64 7, section ".sdata_like", align 8
14*4d348f72SKaiWeng@nn = dso_local global i32 0, section ".custom_a", align 4
15*4d348f72SKaiWeng@yy = dso_local global i64 7, section ".custom_b", align 8
16*4d348f72SKaiWeng
17*4d348f72SKaiWeng; SmallDataLimit set to 8, so we expect @v will be put in sbss
18*4d348f72SKaiWeng; and @r will be put in sdata.
19*4d348f72SKaiWeng!llvm.module.flags = !{!0}
20*4d348f72SKaiWeng!0 = !{i32 8, !"SmallDataLimit", i32 8}
21*4d348f72SKaiWeng
22*4d348f72SKaiWeng; RV32:    .section        .sbss.v,"aw"
23*4d348f72SKaiWeng; RV32:    .section        .sdata.r,"aw"
24*4d348f72SKaiWeng; RV32:    .section        .sbss,"aw"
25*4d348f72SKaiWeng; RV32:    .section        .sdata,"aw"
26*4d348f72SKaiWeng; RV32:    .section        .sbss_like,"aw"
27*4d348f72SKaiWeng; RV32:    .section        .sdata_like,"aw"
28*4d348f72SKaiWeng; RV32:    .section        .custom_a,"aw"
29*4d348f72SKaiWeng; RV32:    .section        .custom_b,"aw"
30*4d348f72SKaiWeng
31*4d348f72SKaiWeng; RV64:    .section        .sbss.v,"aw"
32*4d348f72SKaiWeng; RV64:    .section        .sdata.r,"aw"
33*4d348f72SKaiWeng; RV64:    .section        .sbss,"aw"
34*4d348f72SKaiWeng; RV64:    .section        .sdata,"aw"
35*4d348f72SKaiWeng; RV64:    .section        .sbss_like,"aw"
36*4d348f72SKaiWeng; RV64:    .section        .sdata_like,"aw"
37*4d348f72SKaiWeng; RV64:    .section        .custom_a,"aw"
38*4d348f72SKaiWeng; RV64:    .section        .custom_b,"aw"
39