Skip to content
undefineds.c 2.12 KiB
Newer Older
Raymond Toy's avatar
Raymond Toy committed
/*

 This code was written as part of the CMU Common Lisp project at
 Carnegie Mellon University, and has been placed in the public domain.

*/
wlott's avatar
wlott committed
/* Routines that must be linked into the core for lisp to work. */

#ifdef sun
#ifndef MACH
ram's avatar
ram committed
#if !defined(SUNOS) && !defined(SOLARIS)
wlott's avatar
wlott committed
#define SUNOS
#endif
#endif
ram's avatar
ram committed
#endif
wlott's avatar
wlott committed

typedef int func();

extern func
#define F(x) x,
#if !(defined(irix) || defined(SOLARIS))
/* XXXfixme next line probably wrong; was previous behavior */
#define D(x) x,
#else
#define D(x)
#endif
wlott's avatar
wlott committed
#include "undefineds.h"
  exit;				/* just a random function known to exist */

#if defined(SOLARIS) || defined(irix)
wlott's avatar
wlott committed

int errno;			/* hack to be sure works with newer libc without having to redump */

	   /* causes libc to be relocated to match cmucl rather than vice
	      versa */
extern int
#define F(x)
#define D(x) x,
#include "undefineds.h"
#undef F
#undef D
  errno;			/* a random variable known to exist */

int
reference_random_symbols(void)
{
    int a;
#if defined(SOLARIS) && defined(__GNUC__)
    /*
     * For some reason, gcc 3.0 still deletes function calls here, even
     * with -O0.  I don't know why.  So, we don't define the functions
     * here, but define them in the table below.
     */
#define F(x)
#else
#define F(x) x(0);
#endif
#define D(x) a+=x;
#include "undefineds.h"
#undef F
#undef D
}

#if defined(SOLARIS) && defined(__GNUC__)
/*
 * If we reference the functions here, gcc 3.0 will leave them in the
 * object file.  However, don't try to put the data symbols here.  It
 * will cause CMUCL to crash doing a get_timezone.
 */

func *reference_random_symbols_table[] = {
#define F(x) x,
#define D(x)
#include "undefineds.h"
#undef F
#undef D
    exit			/* a random function known to exist */
#if defined(SVR4)
extern char *tzname[];
extern int daylight;
extern long altzone;
extern long timezone;
#endif
func *reference_random_symbols[] = {
    /* XXXfixme next line is probably wrong but was previous behavior */
wlott's avatar
wlott committed
#include "undefineds.h"
    exit			/* a random function known to exist */
wlott's avatar
wlott committed
};