Date: Sun, 15 Jun 2003 00:45:23 +0200 From: Dag-Erling Smorgrav <des@ofug.org> To: Alexander Leidinger <Alexander@Leidinger.net> Cc: freebsd-arch@freebsd.org Subject: Re: unbreaking alloca Message-ID: <xzpof102s8s.fsf@flood.ping.uio.no> In-Reply-To: <20030614183544.051c7a57.Alexander@Leidinger.net> (Alexander Leidinger's message of "Sat, 14 Jun 2003 18:35:44 %2B0200") References: <xzp1xxw65o7.fsf@flood.ping.uio.no> <20030614183544.051c7a57.Alexander@Leidinger.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Alexander Leidinger <Alexander@Leidinger.net> writes: > Please also add a comment about the actual pitfalls (alloca function not > possible to implement on AMD64, ... in libc and broken on IA32). How's this? @@ -222,7 +222,23 @@ extern void (*_malloc_message)(const char *, const char *, const char *, const char *); -void *alloca(size_t); /* built-in for gcc */ +/* + * The alloca() function can't be implemented in C, and on some + * platforms it can't be implemented at all as a callable function. + * The GNU C compiler provides a built-in alloca() which we can use; + * in all other cases, provide a prototype, mainly to pacify various + * incarnations of lint. On platforms where alloca() is not in libc, + * programs which use it will fail to link when compiled with non-GNU + * compilers. + */ +#ifdef __GNUC__ +#ifndef alloca +#define alloca(sz) __builtin_alloca(sz) +#endif +#else +void *alloca(size_t); +#endif + __uint32_t arc4random(void); void arc4random_addrandom(unsigned char *dat, int datlen); DES -- Dag-Erling Smorgrav - des@ofug.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpof102s8s.fsf>