This is the mail archive of the
mailing list for the glibc project.
[tile] support -Os build by fixing faccessat() to use __fxstatat64()
- From: Chris Metcalf <cmetcalf at tilera dot com>
- To: libc-alpha at sourceware dot org
- Date: Wed, 25 Jan 2012 16:27:47 -0500
- Subject: [tile] support -Os build by fixing faccessat() to use __fxstatat64()
- References: <201111100054.pAA0sf6u025585@farm-0002.internal.tilera.com>
On 11/15/2011 12:13 PM, Joseph S. Myers wrote:
> On Mon, 14 Nov 2011, Chris Metcalf wrote:
>>> Yes, FSF glibc doesn't support building glibc with -Os.
>> In practice, though, it works fine for us, once I fixed that one lone
>> callsite in faccessat() to directly call __fxstatat64(). My patch seems to
>> obsolete the patch you passed along from Sandra Loosemore; perhaps other
>> call sites have already been fixed up since then?
> Quite possibly. Or the set of call sites may depend on the target
> architecture (especially with the "generic" syscall interface you could be
> using a significantly different set of call sites to other architectures).
I wanted to follow up on this; in particular, if my change to faccessat
allows glibc to build with -Os for all the "linux-generic" architectures, I
suspect it may be worth it. It also seems to follow the convention of
using the "x" versions of the stat functions internally, and passing
_STAT_VER, to avoid the overhead of checking the version as soon as you
enter the called function.
2012-01-25 Chris Metcalf <firstname.lastname@example.org>
* sysdeps/unix/sysv/linux/faccessat.c (faccessat): Use the hidden
version of fxstatat64() to avoid requiring libc_nonshared.a.
diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c
index c154deb..94d9dd0 100644
@@ -1,5 +1,5 @@
/* Test for access to file, relative to open directory. Linux version.
- Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -114,7 +114,7 @@ faccessat (fd, file, mode, flag)
struct stat64 stats;
- if (fstatat64 (fd, file, &stats, flag & AT_SYMLINK_NOFOLLOW))
+ if (__fxstatat64 (_STAT_VER, fd, file, &stats, flag & AT_SYMLINK_NOFOLLOW))
mode &= (X_OK | W_OK | R_OK); /* Clear any bogus bits. */