teak-llvm/clang/test/Sema/pragma-clang-section.c
Javed Absar 2a67c9ee39 Add support for #pragma clang section
This patch provides a means to specify section-names for global variables, 
functions and static variables, using #pragma directives. 
This feature is only defined to work sensibly for ELF targets.
One can specify section names as:
#pragma clang section bss="myBSS" data="myData" rodata="myRodata" text="myText"
One can "unspecify" a section name with empty string e.g.
#pragma clang section bss="" data="" text="" rodata=""

Reviewers: Roger Ferrer, Jonathan Roelofs, Reid Kleckner
Differential Revision: https://reviews.llvm.org/D33412

llvm-svn: 304705
2017-06-05 10:11:57 +00:00

18 lines
1.4 KiB
C

// RUN: %clang_cc1 -fsyntax-only -verify %s -triple arm-none-eabi
#pragma clang section bss="mybss.1" data="mydata.1" rodata="myrodata.1" text="mytext.1"
#pragma clang section bss="" data="" rodata="" text=""
#pragma clang section
#pragma clang section dss="mybss.2" // expected-error {{expected one of [bss|data|rodata|text] section kind in '#pragma clang section'}}
#pragma clang section deta="mydata.2" // expected-error {{expected one of [bss|data|rodata|text] section kind in '#pragma clang section'}}
#pragma clang section rodeta="rodata.2" // expected-error {{expected one of [bss|data|rodata|text] section kind in '#pragma clang section'}}
#pragma clang section taxt="text.2" // expected-error {{expected one of [bss|data|rodata|text] section kind in '#pragma clang section'}}
#pragma clang section section bss="mybss.2" // expected-error {{expected one of [bss|data|rodata|text] section kind in '#pragma clang section'}}
#pragma clang section bss "mybss.2" // expected-error {{expected '=' following '#pragma clang section bss'}}
#pragma clang section data "mydata.2" // expected-error {{expected '=' following '#pragma clang section data'}}
#pragma clang section rodata "myrodata.2" // expected-error {{expected '=' following '#pragma clang section rodata'}}
#pragma clang section bss="" data="" rodata="" text="" more //expected-error {{expected one of [bss|data|rodata|text] section kind in '#pragma clang section'}}
int a;