|
|
1.1 root 1: /* This small function uses all the arithmetic operators that
2: libgcc1.c can handle. If you can link it, then
3: you have provided replacements for all the libgcc1.c functions that
4: your target machine needs. */
5:
6: int foo ();
7: double dfoo ();
8:
9: /* We don't want __main here because that can drag in atexit (among other
10: things) which won't necessarily exist yet. */
11:
12: main_without__main ()
13: {
14: int a = foo (), b = foo ();
15: unsigned int au = foo (), bu = foo ();
16: float af = dfoo (), bf = dfoo ();
17: double ad = dfoo (), bd = dfoo ();
18:
19: discard (a * b);
20: discard (a / b);
21: discard (a % b);
22:
23: discard (au / bu);
24: discard (au % bu);
25:
26: discard (a >> b);
27: discard (a << b);
28:
29: discard (au >> bu);
30: discard (au << bu);
31:
32: ddiscard (ad + bd);
33: ddiscard (ad - bd);
34: ddiscard (ad * bd);
35: ddiscard (ad / bd);
36: ddiscard (-ad);
37:
38: ddiscard (af + bf);
39: ddiscard (af - bf);
40: ddiscard (af * bf);
41: ddiscard (af / bf);
42: ddiscard (-af);
43:
44: discard ((int) ad);
45: discard ((int) af);
46:
47: ddiscard ((double) a);
48: ddiscard ((float) a);
49: ddiscard ((float) ad);
50:
51: discard (ad == bd);
52: discard (ad < bd);
53: discard (ad > bd);
54: discard (ad != bd);
55: discard (ad <= bd);
56: discard (ad >= bd);
57:
58: discard (af == bf);
59: discard (af < bf);
60: discard (af > bf);
61: discard (af != bf);
62: discard (af <= bf);
63: discard (af >= bf);
64:
65: return 0;
66: }
67:
68: discard (x)
69: int x;
70: {}
71:
72: ddiscard (x)
73: double x;
74: {}
75:
76: foo ()
77: {
78: static int table[] = {20, 69, 4, 12};
79: static int idx;
80:
81: return table[idx++];
82: }
83:
84: double
85: dfoo ()
86: {
87: static double table[] = {20.4, 69.96, 4.4, 202.202};
88: static int idx;
89:
90: return table[idx++];
91: }
92:
93: /* Provide functions that some versions of the linker use to default
94: the start address if -e symbol is not used, to avoid the warning
95: message saying the start address is defaulted. */
96: extern void start() __asm__("start");
97: extern void _start() __asm__("_start");
98:
99: void start() {}
100: void _start() {}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.