51 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s | FileCheck %s --check-prefix=LLVM2// RUN: %clang_cc1 -triple x86_64-linux -S -o - %s | FileCheck %s --check-prefix=ASM3// Actually, any ELF target would do4// REQUIRES: x86-registered-target5 6#pragma clang section bss = "B$$" data = "d@t@" rodata = "r0d@t@"7 8const int a = 1;9const int *f() { return &a; }10 11int init();12const int b = init();13 14int c = 2;15 16int d = init();17 18int e;19 20// LLVM: @_ZL1a = internal constant i32 1, align 4 #[[#A:]]21// LLVM: @_ZL1b = internal global i32 0, align 4 #[[#A]]22// LLVM: @c = {{.*}}global i32 2, align 4 #[[#A]]23// LLVM: @d = {{.*}}global i32 0, align 4 #[[#A]]24// LLVM: @e = {{.*}}global i32 0, align 4 #[[#A]]25 26// LLVM: attributes #[[#A]] = { "bss-section"="B$$" "data-section"="d@t@" "rodata-section"="r0d@t@" }27 28// ASM: .section "r0d@t@","a",@progbits29// ASM-NOT: .section30// ASM-LABEL: _ZL1a:31// ASM-NEXT: .long 132 33// ASM: .section "B$$","aw",@nobits34// ASM-NOT: .section35// ASM-LABEL: _ZL1b:36// ASM-NEXT: .long 037 38// ASM: .section "d@t@","aw",@progbits39// ASM-NOT: .section40// ASM-LABEL: c:41// ASM: .long 242 43// ASM: .section "B$$","aw",@nobits44// ASM-NOT: .section45// ASM-LABEL: d:46// ASM: .long 047 48// ASM-NOT: .section49// ASM-LABEL: e:50// ASM .long 051