~ubuntu-branches/ubuntu/quantal/enigmail/quantal-security

« back to all changes in this revision

Viewing changes to build/unix/elfhack/test.c

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2013-09-13 16:02:15 UTC
  • mfrom: (0.12.16)
  • Revision ID: package-import@ubuntu.com-20130913160215-u3g8nmwa0pdwagwc
Tags: 2:1.5.2-0ubuntu0.12.10.1
* New upstream release v1.5.2 for Thunderbird 24

* Build enigmail using a stripped down Thunderbird 17 build system, as it's
  now quite difficult to build the way we were doing previously, with the
  latest Firefox build system
* Add debian/patches/no_libxpcom.patch - Don't link against libxpcom, as it
  doesn't exist anymore (but exists in the build system)
* Add debian/patches/use_sdk.patch - Use the SDK version of xpt.py and
  friends
* Drop debian/patches/ipc-pipe_rename.diff (not needed anymore)
* Drop debian/patches/makefile_depth.diff (not needed anymore)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
 
 
5
 
#ifdef DEF
6
 
DEF(This)
7
 
DEF(is)
8
 
DEF(a)
9
 
DEF(test)
10
 
DEF(of)
11
 
DEF(string)
12
 
DEF(array)
13
 
DEF(for)
14
 
DEF(use)
15
 
DEF(with)
16
 
DEF(elfhack)
17
 
DEF(to)
18
 
DEF(see)
19
 
DEF(whether)
20
 
DEF(it)
21
 
DEF(breaks)
22
 
DEF(anything)
23
 
DEF(but)
24
 
DEF(one)
25
 
DEF(needs)
26
 
DEF(quite)
27
 
DEF(some)
28
 
DEF(strings)
29
 
DEF(before)
30
 
DEF(the)
31
 
DEF(program)
32
 
DEF(can)
33
 
DEF(do)
34
 
DEF(its)
35
 
DEF(work)
36
 
DEF(efficiently)
37
 
DEF(Without)
38
 
DEF(enough)
39
 
DEF(data)
40
 
DEF(relocation)
41
 
DEF(sections)
42
 
DEF(are)
43
 
DEF(not)
44
 
DEF(sufficiently)
45
 
DEF(large)
46
 
DEF(and)
47
 
DEF(injected)
48
 
DEF(code)
49
 
DEF(wouldnt)
50
 
DEF(fit)
51
 
DEF(Said)
52
 
DEF(otherwise)
53
 
DEF(we)
54
 
DEF(need)
55
 
DEF(more)
56
 
DEF(words)
57
 
DEF(than)
58
 
DEF(up)
59
 
DEF(here)
60
 
DEF(so)
61
 
DEF(that)
62
 
DEF(relocations)
63
 
DEF(take)
64
 
DEF(significant)
65
 
DEF(bytes)
66
 
DEF(amounts)
67
 
DEF(which)
68
 
DEF(isnt)
69
 
DEF(exactly)
70
 
DEF(easily)
71
 
DEF(achieved)
72
 
DEF(like)
73
 
DEF(this)
74
 
DEF(Actually)
75
 
DEF(I)
76
 
DEF(must)
77
 
DEF(cheat)
78
 
DEF(by)
79
 
DEF(including)
80
 
DEF(these)
81
 
DEF(phrases)
82
 
DEF(several)
83
 
DEF(times)
84
 
 
85
 
#else
86
 
#pragma GCC visibility push(default)
87
 
#include <stdlib.h>
88
 
#include <stdio.h>
89
 
 
90
 
#define DEF(w) static const char str_ ## w[] = #w;
91
 
#include "test.c"
92
 
#undef DEF
93
 
 
94
 
const char *strings[] = {
95
 
#define DEF(w) str_ ## w,
96
 
#include "test.c"
97
 
#include "test.c"
98
 
#include "test.c"
99
 
};
100
 
 
101
 
/* Create a hole between two zones of relative relocations */
102
 
const int hole[] = {
103
 
    42, 42, 42, 42
104
 
};
105
 
 
106
 
const char *strings2[] = {
107
 
#include "test.c"
108
 
#include "test.c"
109
 
#include "test.c"
110
 
#include "test.c"
111
 
#include "test.c"
112
 
#undef DEF
113
 
};
114
 
 
115
 
static int ret = 1;
116
 
 
117
 
int print_status() {
118
 
    fprintf(stderr, "%s\n", ret ? "FAIL" : "PASS");
119
 
    return ret;
120
 
}
121
 
 
122
 
/* On ARM, this creates a .tbss section before .init_array, which
123
 
 * elfhack could then pick instead of .init_array.
124
 
 * Also, when .tbss is big enough, elfhack may wrongfully consider
125
 
 * following sections as part of the PT_TLS segment. */
126
 
__thread int foo[1024];
127
 
 
128
 
void end_test() {
129
 
    static int count = 0;
130
 
    /* Only exit when both constructors have been called */
131
 
    if (++count == 2)
132
 
        ret = 0;
133
 
}
134
 
 
135
 
void test() {
136
 
    int i = 0, j = 0;
137
 
#define DEF_(a,i,w) \
138
 
    if (a[i++] != str_ ## w) return;
139
 
#define DEF(w) DEF_(strings,i,w)
140
 
#include "test.c"
141
 
#include "test.c"
142
 
#include "test.c"
143
 
#undef DEF
144
 
#define DEF(w) DEF_(strings2,j,w)
145
 
#include "test.c"
146
 
#include "test.c"
147
 
#include "test.c"
148
 
#include "test.c"
149
 
#include "test.c"
150
 
#undef DEF
151
 
    if (i != sizeof(strings)/sizeof(strings[0]) &&
152
 
        j != sizeof(strings2)/sizeof(strings2[0]))
153
 
        fprintf(stderr, "WARNING: Test doesn't cover the whole array\n");
154
 
    end_test();
155
 
}
156
 
 
157
 
#pragma GCC visibility pop
158
 
#endif