https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81199

            Bug ID: 81199
           Summary: fallback definition of count_leading_zeros references
                    hidden symbol
           Product: gcc
           Version: 5.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: coypu at sdf dot org
  Target Milestone: ---

Bug report from building cmake on netbsd/vax with GCC 5.4.0
http://gnats.netbsd.org/52326

[ 88%] Building CXX object
Source/CMakeFiles/ccmake.dir/CursesDialog/ccmake.cxx.o
[ 88%] Linking CXX executable ../bin/ccmake
ld: ../bin/ccmake: hidden symbol `__clz_tab' in /usr/lib/libgcc.a(_clz.o) is
referenced by DSO
ld: final link failed: Bad value

my analysis may be wrong, but this appears to be because vax does not provide a
definition of count_leading_zeros in include/longlong.h, and then we have:

extern const UQItype __clz_tab[256] attribute_hidden;

...

#if !defined (count_leading_zeros)
#define count_leading_zeros(count, x) \
  do {                                                                  \
    UWtype __xr = (x);                                                  \
    UWtype __a;                                                         \
                                                                        \
    if (W_TYPE_SIZE <= 32)                                              \
      {                                                                 \
        __a = __xr < ((UWtype)1<<2*__BITS4)                             \
          ? (__xr < ((UWtype)1<<__BITS4) ? 0 : __BITS4)                 \
          : (__xr < ((UWtype)1<<3*__BITS4) ?  2*__BITS4 : 3*__BITS4);   \
      }                                                                 \
    else                                                                \
      {                                                                 \
        for (__a = W_TYPE_SIZE - 8; __a > 0; __a -= 8)                  \
          if (((__xr >> __a) & 0xff) != 0)                              \
            break;                                                      \
      }                                                                 \
                                                                        \
    (count) = W_TYPE_SIZE - (__clz_tab[__xr >> __a] + __a);             \
  } while (0)
#define COUNT_LEADING_ZEROS_0 W_TYPE_SIZE
#endif


this appears to be true for the definition for alpha as well.

Reply via email to