parent
d61fdfcf3b
commit
f02067f353
@ -1,36 +1,48 @@
|
||||
From 0998aff9be4f0a25b7a822c4f28e832d367977c6 Mon Sep 17 00:00:00 2001
|
||||
From: Siddhesh Poyarekar <siddhesh@redhat.com>
|
||||
Date: Wed, 13 Aug 2014 23:28:18 +0530
|
||||
Subject: [PATCH] Revert to defining __extern_inline only for gcc-4.3+
|
||||
commit 884ddc5081278f488ef8cd49951f41cfdbb480ce
|
||||
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
|
||||
Date: Tue Sep 16 14:08:48 2014 +0530
|
||||
|
||||
The check for only __GNUC_STDC_INLINE__ and __GNUC_GNU_INLINE__ may
|
||||
not be sufficient since those flags were added during initial support
|
||||
for C99 inlining semantics. There is also a problem with always
|
||||
defining __extern_inline and __extern_always_inline, since it enables
|
||||
inline wrapper functions even when GNU inlining semantics are not
|
||||
guaranteed. This, along with the possibility of such wrappers using
|
||||
redirection (btowc for example) could result in compiler generating an
|
||||
infinitely recusrive call to the function.
|
||||
|
||||
In fact it was such a recursion that led to this code being written
|
||||
the way it was; see:
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=186410
|
||||
|
||||
The initial change was to fix bugs 14530 and 13741, but they can be
|
||||
resolved by checking if __fortify_function and/or
|
||||
__extern_always_inline are defined, as it has been done in this patch.
|
||||
In addition, I have audited uses of __extern_always_inline to make
|
||||
sure that none of the uses result in compilation errors.
|
||||
|
||||
There is however a regression in this patch for llvm, since it reverts
|
||||
the llvm expectation that __GNUC_STDC_INLINE__ or __GNUC_GNU_INLINE__
|
||||
definition imply proper extern inline semantics.
|
||||
---
|
||||
libio/stdio.h | 2 +-
|
||||
math/bits/math-finite.h | 8 +++++---
|
||||
misc/sys/cdefs.h | 18 ++++++++----------
|
||||
3 files changed, 14 insertions(+), 14 deletions(-)
|
||||
Revert to defining __extern_inline only for gcc-4.3+ (BZ #17266)
|
||||
|
||||
The check for only __GNUC_STDC_INLINE__ and __GNUC_GNU_INLINE__ may
|
||||
not be sufficient since those flags were added during initial support
|
||||
for C99 inlining semantics. There is also a problem with always
|
||||
defining __extern_inline and __extern_always_inline, since it enables
|
||||
inline wrapper functions even when GNU inlining semantics are not
|
||||
guaranteed. This, along with the possibility of such wrappers using
|
||||
redirection (btowc for example) could result in compiler generating an
|
||||
infinitely recusrive call to the function.
|
||||
|
||||
In fact it was such a recursion that led to this code being written
|
||||
the way it was; see:
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=186410
|
||||
|
||||
The initial change was to fix bugs 14530 and 13741, but they can be
|
||||
resolved by checking if __fortify_function and/or
|
||||
__extern_always_inline are defined, as it has been done in this patch.
|
||||
In addition, I have audited uses of __extern_always_inline to make
|
||||
sure that none of the uses result in compilation errors.
|
||||
|
||||
There is however a regression in this patch for llvm, since it reverts
|
||||
the llvm expectation that __GNUC_STDC_INLINE__ or __GNUC_GNU_INLINE__
|
||||
definition imply proper extern inline semantics.
|
||||
|
||||
2014-09-16 Siddhesh Poyarekar <siddhesh@redhat.com>
|
||||
Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
[BZ #17266]
|
||||
* libio/stdio.h: Check definition of __fortify_function
|
||||
instead of __extern_always_inline to include bits/stdio2.h.
|
||||
* math/bits/math-finite.h [__USE_XOPEN || __USE_ISOC99]: Also
|
||||
check if __extern_always_inline is defined.
|
||||
[__USE_MISC || __USE_XOPEN]: Likewise.
|
||||
[__USE_ISOC99] Likewise.
|
||||
* misc/sys/cdefs.h (__fortify_function): Define only if
|
||||
__extern_always_inline is defined.
|
||||
[!__cplusplus || __GNUC_PREREQ (4,3)]: Revert to defining
|
||||
__extern_always_inline and __extern_inline only for g++-4.3
|
||||
and newer or a compatible gcc.
|
||||
|
||||
diff --git a/libio/stdio.h b/libio/stdio.h
|
||||
index d8c0bdb..1f4f837 100644
|
||||
@ -79,7 +91,7 @@ index aa755de..0656645 100644
|
||||
extern double __gamma_r_finite (double, int *);
|
||||
__extern_always_inline double __NTH (tgamma (double __d))
|
||||
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
|
||||
index 04db956..d8ee73c 100644
|
||||
index 04db956..01e81ba 100644
|
||||
--- a/misc/sys/cdefs.h
|
||||
+++ b/misc/sys/cdefs.h
|
||||
@@ -131,7 +131,6 @@
|
||||
@ -90,7 +102,7 @@ index 04db956..d8ee73c 100644
|
||||
|
||||
#if __GNUC_PREREQ (4,3)
|
||||
# define __warndecl(name, msg) \
|
||||
@@ -318,12 +317,10 @@
|
||||
@@ -318,12 +317,13 @@
|
||||
# define __attribute_artificial__ /* Ignore */
|
||||
#endif
|
||||
|
||||
@ -101,13 +113,16 @@ index 04db956..d8ee73c 100644
|
||||
- defined, this version of GCC only supports GNU inline semantics. */
|
||||
-# if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
|
||||
+/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
|
||||
+ inline semantics, unless -fgnu89-inline is used. */
|
||||
+ inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__
|
||||
+ or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
|
||||
+ older than 4.3 may define these macros and still not guarantee GNU inlining
|
||||
+ semantics. */
|
||||
+#if !defined __cplusplus || __GNUC_PREREQ (4,3)
|
||||
+# if defined __GNUC_STDC_INLINE__ || defined __cplusplus
|
||||
# define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
|
||||
# define __extern_always_inline \
|
||||
extern __always_inline __attribute__ ((__gnu_inline__))
|
||||
@@ -331,9 +328,10 @@
|
||||
@@ -331,9 +331,10 @@
|
||||
# define __extern_inline extern __inline
|
||||
# define __extern_always_inline extern __always_inline
|
||||
# endif
|
||||
@ -121,6 +136,3 @@ index 04db956..d8ee73c 100644
|
||||
#endif
|
||||
|
||||
/* GCC 4.3 and above allow passing all anonymous arguments of an
|
||||
--
|
||||
1.9.3
|
||||
|
||||
|
69
glibc-rh1133508.patch
Normal file
69
glibc-rh1133508.patch
Normal file
@ -0,0 +1,69 @@
|
||||
commit 602f80ec8b966cfad3b61914cbe14ee606cedf6e
|
||||
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
|
||||
Date: Tue Sep 16 22:16:01 2014 +0530
|
||||
|
||||
Make __extern_always_inline usable on clang++ again
|
||||
|
||||
The fix for BZ #17266 (884ddc5081278f488ef8cd49951f41cfdbb480ce)
|
||||
removed changes that had gone into cdefs.h to make
|
||||
__extern_always_inline usable with clang++. This patch adds back
|
||||
support for clang to detect if GNU inlining semantics are available,
|
||||
this time without breaking the gcc use case. The check put here is
|
||||
based on the earlier patch and assertion[1] that checking if
|
||||
__GNUC_STDC_INLINE__ or __GNUC_GNU_INLINE__ is defined is sufficient
|
||||
to determine that clang++ suports GNU inlining semantics.
|
||||
|
||||
Tested with a simple program that builds with __extern_always_inline
|
||||
with the patch and fails compilation without it.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
extern void foo_alias (void) __asm ("foo");
|
||||
|
||||
__extern_always_inline void
|
||||
foo (void)
|
||||
{
|
||||
puts ("hi oh world!");
|
||||
return foo_alias ();
|
||||
}
|
||||
|
||||
void
|
||||
foo_alias (void)
|
||||
{
|
||||
puts ("hell oh world");
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
foo ();
|
||||
}
|
||||
|
||||
[1] https://sourceware.org/ml/libc-alpha/2012-12/msg00306.html
|
||||
|
||||
[BZ #17266]
|
||||
* misc/sys/cdefs.h: Define __extern_always_inline for clang
|
||||
4.2 and newer.
|
||||
|
||||
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
|
||||
index 01e81ba..711ac1d 100644
|
||||
--- a/misc/sys/cdefs.h
|
||||
+++ b/misc/sys/cdefs.h
|
||||
@@ -321,8 +321,14 @@
|
||||
inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__
|
||||
or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
|
||||
older than 4.3 may define these macros and still not guarantee GNU inlining
|
||||
- semantics. */
|
||||
-#if !defined __cplusplus || __GNUC_PREREQ (4,3)
|
||||
+ semantics.
|
||||
+
|
||||
+ clang++ identifies itself as gcc-4.2, but has support for GNU inlining
|
||||
+ semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and
|
||||
+ __GNUC_GNU_INLINE__ macro definitions. */
|
||||
+#if (!defined __cplusplus || __GNUC_PREREQ (4,3) \
|
||||
+ || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \
|
||||
+ || defined __GNUC_GNU_INLINE__)))
|
||||
# if defined __GNUC_STDC_INLINE__ || defined __cplusplus
|
||||
# define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
|
||||
# define __extern_always_inline \
|
@ -1,6 +1,6 @@
|
||||
%define glibcsrcdir glibc-2.20
|
||||
%define glibcversion 2.20
|
||||
%define glibcrelease 1%{?dist}
|
||||
%define glibcrelease 2%{?dist}
|
||||
# Pre-release tarballs are pulled in from git using a command that is
|
||||
# effectively:
|
||||
#
|
||||
@ -194,6 +194,7 @@ Patch0050: %{name}-rh1124987.patch
|
||||
# Patches from upstream
|
||||
#
|
||||
##############################################################################
|
||||
Patch1001: %{name}-rh1133508.patch
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@ -560,6 +561,7 @@ package or when debugging this package.
|
||||
%patch2034 -p1
|
||||
%patch2035 -p1
|
||||
%patch0050 -p1
|
||||
%patch1001 -p1
|
||||
|
||||
##############################################################################
|
||||
# %%prep - Additional prep required...
|
||||
@ -1667,6 +1669,9 @@ rm -f *.filelist*
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Sep 16 2014 Siddhesh Poyarekar <siddhesh@redhat.com> - 2.20-2
|
||||
- Make __extern_always_inline usable on clang++ again (#1133508).
|
||||
|
||||
* Mon Sep 8 2014 Siddhesh Poyarekar <siddhesh@redhat.com> - 2.20-1
|
||||
- Rebase to upstream release 2.20.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user