brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 379b0c0 Raw
42 lines · c
1// RUN: %clang_cc1 -x c -emit-llvm -triple arm-none-eabi -o - %s | FileCheck %s2 3// Test that section attributes are attached to C tentative definitions as per4// '#pragma clang section' directives.5 6#pragma clang section bss = ".bss.1"7int x; // bss.18 9#pragma clang section bss = ""10int x; // stays in .bss.111int y; // not assigned a section attribute12int z; // not assigned a section attribute13 14#pragma clang section bss = ".bss.2"15int x; // stays in .bss.116int y; // .bss.217 18// Test the same for `const` declarations.19#pragma clang section rodata = ".rodata.1"20const int cx; // rodata.121 22#pragma clang section rodata = ""23const int cx; // stays in .rodata.124const int cy; // not assigned a section attribute25const int cz; // not assigned a rodata section attribute26 27#pragma clang section rodata = ".rodata.2"28const int cx; // stays in .rodata.129const int cy; // .rodata.230 31// CHECK: @x ={{.*}} global i32 0, align 4 #032// CHECK: @y ={{.*}} global i32 0, align 4 #133// CHECK: @z ={{.*}} global i32 0, align 434// CHECK: @cx ={{.*}} constant i32 0, align 4 #235// CHECK: @cy ={{.*}} constant i32 0, align 4 #336// CHECK: @cz ={{.*}} constant i32 0, align 4 #137 38// CHECK: attributes #0 = { "bss-section"=".bss.1" }39// CHECK: attributes #1 = { "bss-section"=".bss.2" }40// CHECK: attributes #2 = { "bss-section"=".bss.2" "rodata-section"=".rodata.1" }41// CHECK: attributes #3 = { "bss-section"=".bss.2" "rodata-section"=".rodata.2" }42