[prev in list] [next in list] [prev in thread] [next in thread] 

List:       uclibc
Subject:    [git commit] Defeat compiler optimization which assumes function addresses are never NULL
From:       vapier () gentoo ! org (Mike Frysinger)
Date:       2011-09-17 8:11:40
Message-ID: 201109170411.41592.vapier () gentoo ! org
[Download RAW message or body]

On Thursday, September 15, 2011 10:59:21 Denys Vlasenko wrote:
> From email:
> A warning for people who can be hit by the same or similar issue:
> gcc 4.1.2 with -march=i486 here with -Os and even with -O2 or -O
> is "optimizing away" the check
>        if (_stdio_term)
> in libc/stdlib/_atexit.c
> which results in a "call 0" and a segfault at exit
> if you do not happen to link in stdio.

there's quite a lot of noise in this changeset because you're mixing style 
with functional.  please refrain from this in the future.

> --- a/libc/stdlib/_atexit.c
> +++ b/libc/stdlib/_atexit.c
> 
> +/* Defeat compiler optimization which assumes function addresses are never
> +static __always_inline int not_null_ptr(const void *p)
> +{
> +	const void *q;
> +	__asm__ (""
> +		: "=r" (q) /* output */
> +		: "0" (p) /* input */
> +	);
> +	return q != 0;
> +}
> 
> --- a/libc/stdlib/abort.c
> +++ b/libc/stdlib/abort.c
> 
> +/* Defeat compiler optimization which assumes function addresses are never
> +static __always_inline int not_null_ptr(const void *p)
> +{
> +	const void *q;
> +	__asm__ (""
> +		: "=r" (q) /* output */
> +		: "0" (p) /* input */
> +	);
> +	return q != 0;
> +}

ugh, you copy & pasted the same thing.  please locate a common header to stick 
this into.  or drop it.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20110917/a044ad14/attachment.asc>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic