This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 6/10] Tilera (and Linux asm-generic) support for glibc


On Fri, 11 Nov 2011, Chris Metcalf wrote:

> On 11/11/2011 1:00 PM, Roland McGrath wrote:
> > > 2011-11-03  Chris Metcalf<cmetcalf@tilera.com>
> > > 
> > >    * sysdeps/unix/sysv/linux/faccessat.c (faccessat): Use the hidden
> > >    version of fxstatat64() to avoid requiring libc_nonshared.a.
> > You haven't explained why you think this is worthwhile.
> The rationale for this one is that if you build glibc with "gcc -Os",
> then the normal extern inline wrappers for fxstatat() and friends
> don't get used in io/sys/stat.h (__USE_EXTERN_INLINES is not set), so
> rather than becoming a direct call to __fxstatat(), it tries to
> actually call fstatat64() directly.  But for shared libc this isn't
> available, since that symbol is defined in libc_nonshared.a, so
> linking fails.

Yes, FSF glibc doesn't support building glibc with -Os.  The following 
patch may help.

2007-11-29  Sandra Loosemore  <sandra@codesourcery.com>

	* include/features.h (__USE_EXTERN_INLINES_IN_LIBC):  New.
	* io/sys/stat.h: Use it instead of __USE_EXTERN_INLINES.

diff --git a/include/features.h b/include/features.h
index 8f88857..50dcb0a 100644
--- a/include/features.h
+++ b/include/features.h
@@ -374,6 +374,14 @@
 # define __USE_EXTERN_INLINES	1
 #endif
 
+/* There are some functions that must be declared 'extern inline' even with
+   -Os when building LIBC, or they'll end up undefined.  */
+#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
+    && (defined _LIBC || !defined __OPTIMIZE_SIZE__) && !defined __NO_INLINE__ \
+    && defined __extern_inline
+# define __USE_EXTERN_INLINES_IN_LIBC	1
+#endif
+
 
 /* This is here only because every header file already includes this one.
    Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
diff --git a/io/sys/stat.h b/io/sys/stat.h
index ac740ca..5c389ee 100644
--- a/io/sys/stat.h
+++ b/io/sys/stat.h
@@ -448,7 +448,7 @@ extern int __xmknodat (int __ver, int __fd, __const char *__path,
 		       __mode_t __mode, __dev_t *__dev)
      __THROW __nonnull ((3, 5));
 
-#if defined __GNUC__ && __GNUC__ >= 2 && defined __USE_EXTERN_INLINES
+#if defined __GNUC__ && __GNUC__ >= 2 && defined __USE_EXTERN_INLINES_IN_LIBC
 /* Inlined versions of the real stat and mknod functions.  */
 
 __extern_inline int

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]