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: musl - and menchmarking libc


On Thu, Sep 06, 2012 at 10:42:15AM +0000, Joseph S. Myers wrote:
> On Wed, 5 Sep 2012, Rich Felker wrote:
> 
> > I'm talking about -D_FILE_OFFSET_BITS=64, not -D_LARGEFILE64_SOURCE.
> > The former is advertised by glibc as one of the POSIX compilation
> > environments, one that provides _POSIX_V6_ILP32_OFFBIG, and it's the
> > only compilation environment provided that any modern application
> > should be using on a 32-bit machine. However, it's not actually a
> > POSIX conforming environment since you can't reliably use these
> > interfaces without including the headers that do the redirection
> > (you'll instead call the 32-bit versions with the wrong prototypes,
> > thus invoking UB), and since even when you do include the headers, you
> > will pull in external symbol name pollution in the namespace reserved
> > for the application.
> 
> So this static library would be for listing in the output of "getconf 
> POSIX_V6_ILP32_OFFBIG_LIBS"?  I suppose that makes sense, though I'd limit 
> it strictly to the functions for which it's needed for POSIX conformance 
> (that is, the affected functions that are defined by POSIX and whose 
> POSIX-defined prototypes only include standard C types and not typedefs 
> from system headers) since I think it's an undesirable burden to support 
> declaring library functions yourself beyond the cases where the standards 
> require it.
> 
> I think this should have a separate bug from 14106 (depending on 14106).
> 
> With GCC 4.5 or later, another approach is for the compiler options from 
> "getconf POSIX_V6_ILP32_OFFBIG_CFLAGS" to include "-include 
> /usr/include/file-offset-bits-64.h" where the header file-offset-bits-64.h 
> contains a sequence of "#pragma redefine_extname" calls to rename the 
> functions in question without declaring them.  That way you don't need the 
> static library and the calls go straight to the __*64 functions.  (GCC 4.5 
> was the version that made #pragma redefine_extname available for all 
> targets.)

This solution is simpler and fine by me. It won't work on older GCC,
but older GCC has a lot of problems anyway (floating point behavior on
i386 is bogus, for example).

Rich


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