bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnulib: __builtin_expect()


From: Daniel Richard G.
Subject: Re: gnulib: __builtin_expect()
Date: Fri, 16 Dec 2016 21:02:46 -0500

On Fri, 2016 Dec 16 16:55-0800, Paul Eggert wrote:
> I hadn't thought about the possibility that the standard includes
> define __builtin_expect as a macro. I installed the attached; please
> give it a try.

In git master d1469b79, the configure-time detection now works, but the
build fails later at

DEPDIR=.deps depmode=aix /bin/sh /u/darkstar/testdir/build-aux/depcomp \
xlc-wrap -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I/u/darkstar/testdir/gltests -I..  
-DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. 
-I/u/darkstar/testdir/gltests -I.. -I/u/darkstar/testdir/gltests/.. -I../gllib 
-I/u/darkstar/testdir/gltests/../gllib -D_XOPEN_SOURCE=600 -DNSIG=39 
-qhaltonmsg=CCN3296  -g -qfloat=ieee -qlanglvl=extc99  -c -o 
test-canonicalize-lgpl.o /u/darkstar/testdir/gltests/test-canonicalize-lgpl.c
xlc-wrap  -g -qfloat=ieee -qlanglvl=extc99    -o test-canonicalize-lgpl 
test-canonicalize-lgpl.o libtests.a ../gllib/libgnu.a libtests.a  
 IEW2456E 9207 SYMBOL __builtin_expect UNRESOLVED.  MEMBER COULD NOT BE INCLUDED
          FROM THE DESIGNATED CALL LIBRARY.                                     
FSUM3065 The LINKEDIT step ended with return code 8.
make[4]: *** [test-canonicalize-lgpl] Error 3

This appears to be due to lib/strstr.c, which uses __builtin_expect()
without #including stdlib.h. Adding the #include to that file allows the
test program to link.

lib/fnmatch_loop.c is also in the same situation, but that one is not
causing any build failures for me.

As an aside: It's not that the headers #define __builtin_expect as a
macro on this platform, but rather (from builtins.h):

  /*__builtin_expect GCC Compatability */
  #ifdef __cplusplus
    extern "builtin" {
  #else
    #pragma linkage(__builtin_expect, builtin)
  #endif /* cplusplus */
  #ifdef _NO_PROTO
    long __builtin_expect();
  #else
    long __builtin_expect(long,long);
  #endif
  #ifdef __cplusplus
    }
  #endif

That is, builtins on this platform are handled as functions with a
special sort of linkage.


--Daniel


-- 
Daniel Richard G. || address@hidden
My ASCII-art .sig got a bad case of Times New Roman.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]