| Commit | Line | Data |
|---|---|---|
| eeab7066 RT |
1 | /* |
| 2 | ||
| 3 | This code was written as part of the CMU Common Lisp project at | |
| 4 | Carnegie Mellon University, and has been placed in the public domain. | |
| 5 | ||
| 6 | */ | |
| 36232b68 | 7 | /* Routines that must be linked into the core for lisp to work. */ |
| 36232b68 | 8 | |
| 9 | #ifdef sun | |
| 10 | #ifndef MACH | |
| 571df509 | 11 | #if !defined(SUNOS) && !defined(SOLARIS) |
| 36232b68 | 12 | #define SUNOS |
| 13 | #endif | |
| 14 | #endif | |
| 571df509 | 15 | #endif |
| 36232b68 | 16 | |
| 17 | typedef int func(); | |
| 18 | ||
| 19 | extern func | |
| efd9aa3b | 20 | #define F(x) x, |
| 21 | #if !(defined(irix) || defined(SOLARIS)) | |
| 22 | /* XXXfixme next line probably wrong; was previous behavior */ | |
| 23 | #define D(x) x, | |
| 24 | #else | |
| 25 | #define D(x) | |
| 26 | #endif | |
| 36232b68 | 27 | #include "undefineds.h" |
| efd9aa3b | 28 | #undef F |
| 29 | #undef D | |
| 9a8c1c2f | 30 | exit; /* just a random function known to exist */ |
| 31 | ||
| efd9aa3b | 32 | #if defined(SOLARIS) || defined(irix) |
| 36232b68 | 33 | |
| efd9aa3b | 34 | #ifdef irix |
| 9a8c1c2f | 35 | int errno; /* hack to be sure works with newer libc without having to redump */ |
| 36 | ||
| 37 | /* causes libc to be relocated to match cmucl rather than vice | |
| 38 | versa */ | |
| b6d85c30 | 39 | #endif |
| 40 | ||
| efd9aa3b | 41 | extern int |
| 42 | #define F(x) | |
| 43 | #define D(x) x, | |
| 44 | #include "undefineds.h" | |
| 45 | #undef F | |
| 46 | #undef D | |
| 9a8c1c2f | 47 | errno; /* a random variable known to exist */ |
| 48 | ||
| 49 | int | |
| 50 | reference_random_symbols(void) | |
| 51 | { | |
| 52 | int a; | |
| efd9aa3b | 53 | |
| 3380347b | 54 | #if defined(SOLARIS) && defined(__GNUC__) |
| 9a8c1c2f | 55 | /* |
| 56 | * For some reason, gcc 3.0 still deletes function calls here, even | |
| 57 | * with -O0. I don't know why. So, we don't define the functions | |
| 58 | * here, but define them in the table below. | |
| 59 | */ | |
| 3380347b | 60 | #define F(x) |
| 61 | #else | |
| 62 | #define F(x) x(0); | |
| 63 | #endif | |
| efd9aa3b | 64 | #define D(x) a+=x; |
| 65 | #include "undefineds.h" | |
| 66 | #undef F | |
| 67 | #undef D | |
| 9a8c1c2f | 68 | return a; |
| 3380347b | 69 | } |
| 70 | ||
| 71 | #if defined(SOLARIS) && defined(__GNUC__) | |
| 72 | /* | |
| 73 | * If we reference the functions here, gcc 3.0 will leave them in the | |
| 74 | * object file. However, don't try to put the data symbols here. It | |
| 75 | * will cause CMUCL to crash doing a get_timezone. | |
| 76 | */ | |
| 77 | ||
| 78 | func *reference_random_symbols_table[] = { | |
| 79 | #define F(x) x, | |
| 80 | #define D(x) | |
| 81 | #include "undefineds.h" | |
| 82 | #undef F | |
| 83 | #undef D | |
| 9a8c1c2f | 84 | exit /* a random function known to exist */ |
| 3380347b | 85 | }; |
| 86 | #endif | |
| efd9aa3b | 87 | |
| 88 | #else | |
| 89 | ||
| 3380347b | 90 | #if defined(SVR4) |
| 91 | extern char *tzname[]; | |
| 92 | extern int daylight; | |
| 93 | extern long altzone; | |
| 94 | extern long timezone; | |
| 95 | #endif | |
| 3c272d5b | 96 | func *reference_random_symbols[] = { |
| efd9aa3b | 97 | #define F(x) x, |
| 9a8c1c2f | 98 | /* XXXfixme next line is probably wrong but was previous behavior */ |
| 3380347b | 99 | #define D(x) &x, |
| 36232b68 | 100 | #include "undefineds.h" |
| efd9aa3b | 101 | #undef F |
| 102 | #undef D | |
| 9a8c1c2f | 103 | exit /* a random function known to exist */ |
| 36232b68 | 104 | }; |
| b6d85c30 | 105 | |
| b6d85c30 | 106 | #endif |