diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2010-02-17 13:44:32 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2010-02-17 13:44:32 +0000 |
commit | 6224148fdd809170d138216d72b8e6180d626aec (patch) | |
tree | f67127b4ab6026f5e29d0b6aa69bec4f8a223fb2 /test/regression/pragmas.c | |
parent | f9ebf19ba3ca4c3ee67cc88bbea407d4dd734249 (diff) | |
download | compcert-6224148fdd809170d138216d72b8e6180d626aec.tar.gz compcert-6224148fdd809170d138216d72b8e6180d626aec.zip |
Reorganization test directory
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1253 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test/regression/pragmas.c')
-rw-r--r-- | test/regression/pragmas.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/regression/pragmas.c b/test/regression/pragmas.c new file mode 100644 index 00000000..43daa32a --- /dev/null +++ b/test/regression/pragmas.c @@ -0,0 +1,48 @@ +/* Default sections */ + +int a; /* small data */ +const double b = 2.718; /* ro small data */ +int c[4]; /* large data */ +const char d[12]; /* ro large data */ + +double g(void) { return a + b; } + +/* Custom sections */ + +#pragma section MYCODE ".mycode" ".mycode" standard RX +#pragma section MYDATA ".mydata_i" ".mydata_u" far-absolute RW +#pragma section MYCONST ".myconst" ".myconst" far-absolute R +#pragma section MYSDA ".mysda_i" ".mysda_u" near-data RW + +#pragma use_section MYDATA x, y +int x; +double y = 3.14; + +#pragma use_section MYCONST z +char z[4] = { 'a', 'b', 'c', 'd' }; + +#pragma use_section MYSDA u +int u; + +#pragma use_section MYCODE f +int f(int n) +{ + x += n; + u -= n; + return z[n]; +} + +/* Redefining some standard sections */ + +#pragma section SCONST ".myconst" ".myconst" far-absolute R +#pragma section DATA ".mysda_i" ".mysda_u" near-data RW +#pragma section CODE ".mycode" ".mycode" standard RX + +const double v = 1.414; +int w[10]; + +double h(int n) +{ + w[n] ++; + return v; +} |