This is the mail archive of the 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: bzero/bcopy/bcmp/mempcpy (was: Improve strncpy performance further)

On Wed, 4 Feb 2015, Wilco Dijkstra wrote:

> Indeed it's unfortunate that these as well as the generic __bzero are
> inefficient. Would it be possible for GCC to detect a modern GLIBC from the
> headers and only emit calls to __bzero (or say a new __memclr symbol) if a
> target provides an optimized version? Not sure whether there is already a way
> to do this, or whether such trickery is discouraged...

There's existing support for checking the glibc version at GCC configure 
time and acting in GCC based on that (of course, that's just the minimum 
glibc version that GCC knows will be used at runtime - it doesn't take 
account of glibc upgrades).  That's sufficient if using new glibc features 
would require a GCC upgrade anyway.  If an older GCC could meaningfully 
use a newer glibc feature when glibc is upgraded - if, for example, GCC 
knows about using efficient __bzero but the set of relevant architectures 
varies with glibc version, so you want glibc headers to tell GCC whether 
__bzero is efficient for that glibc version and architecture - then you 
get into stdc-predef.h (or an architecture-specific bits/ file included 
therefrom) doing "#pragma GCC library_feature efficient___bzero" or 
similar - a new pragma to inform GCC of library features it can presume on 
the target.  (There might be other possible approaches to implementing 

Joseph S. Myers

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