You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.3 KiB
73 lines
2.3 KiB
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
# |
|
# Filename: package/.../uclibc/uClibc-0.9.31.1-workaround-GCC-PR32219.patch |
|
# Copyright (C) 2011 The OpenSDE Project |
|
# |
|
# More information can be found in the files COPYING and README. |
|
# |
|
# This patch file is dual-licensed. It is available under the license the |
|
# patched project is licensed under, as long as it is an OpenSource license |
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms |
|
# of the GNU General Public License as published by the Free Software |
|
# Foundation; either version 2 of the License, or (at your option) any later |
|
# version. |
|
# --- SDE-COPYRIGHT-NOTE-END --- |
|
|
|
From 2e53dd645d5348f207cec7f8595969dc566c5a55 Mon Sep 17 00:00:00 2001 |
|
From: Denys Vlasenko <vda.linux@googlemail.com> |
|
Date: Mon, 17 May 2010 15:56:19 +0200 |
|
Subject: [PATCH] workaround GCC PR32219 |
|
|
|
we ended up calling 0 |
|
Fixes bug #1033 |
|
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> |
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> |
|
--- |
|
libc/misc/internals/__uClibc_main.c | 15 +++++++++++++-- |
|
1 files changed, 13 insertions(+), 2 deletions(-) |
|
|
|
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c |
|
index f9e1244..4ee4443 100644 |
|
--- a/libc/misc/internals/__uClibc_main.c |
|
+++ b/libc/misc/internals/__uClibc_main.c |
|
@@ -105,6 +105,17 @@ _pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer *__buffer, |
|
|
|
#endif /* !SHARED */ |
|
|
|
+/* Defeat compiler optimization which assumes function addresses are never NULL */ |
|
+static __always_inline int not_null_ptr(const void *p) |
|
+{ |
|
+ const void *q; |
|
+ __asm__ ("" |
|
+ : "=r" (q) /* output */ |
|
+ : "0" (p) /* input */ |
|
+ ); |
|
+ return q != 0; |
|
+} |
|
+ |
|
/* |
|
* Prototypes. |
|
*/ |
|
@@ -254,7 +265,7 @@ void __uClibc_init(void) |
|
|
|
#ifdef __UCLIBC_HAS_LOCALE__ |
|
/* Initialize the global locale structure. */ |
|
- if (likely(_locale_init!=NULL)) |
|
+ if (likely(not_null_ptr(_locale_init))) |
|
_locale_init(); |
|
#endif |
|
|
|
@@ -264,7 +275,7 @@ void __uClibc_init(void) |
|
* Thus we get a nice size savings because the stdio functions |
|
* won't be pulled into the final static binary unless used. |
|
*/ |
|
- if (likely(_stdio_init != NULL)) |
|
+ if (likely(not_null_ptr(_stdio_init))) |
|
_stdio_init(); |
|
|
|
} |
|
-- |
|
1.7.1 |
|
|
|
|