This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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]

ERROR: Undefined symbol: .__nearbyintl128 with gcc-4.4.6 on AIX 6.1


I've built gcc-4.4.6 on AIX 6.1 and am having a problem building
R-2.13.1 with it. Consider the sample code:
  % cat ld.c
#include <math.h>

int
main (void) {
  long double x = 0.0, y;

  y = nearbyintl (x);
}

  % xlc ld.c -lm
  % nm -BCpg a.out | grep nearby
   268436640 T .nearbyint

  % /opt/TWWfsw/gcc44/bin/gcc ld.c -lm
  ld: 0711-317 ERROR: Undefined symbol: .__nearbyintl128
  ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
  collect2: ld returned 8 exit status

The problem is that gcc's include-fixed/math.h has:
  #define nearbyintl(__x)         __nearbyintl128((long double) (__x))
but this is only used if _ISOC99_SOURCE and __LONGDOUBLE128 are
defined. <complex.h> has:
  /*
   * There are two forms of long double on AIX.  The default
   * form of long double is the same as a double - 64 bits.  There
   * is a 128-bit form available with some compilers.  If that compiler
   * defines __LONGDOUBLE128, then long doubles are 128-bit instead of
   * 64-bit.  Since the same library routine cannot be used for 128-bit
   * and 64-bit values, the 128-bit routines are renamed and macros are
   * used to manage the name spaces.  It is not necessarily the case that
   * all of the 128-bit versions are available, but the macros are defined
   * intentionally since the 64-bit versions can provide incorrect results
   * when long double values were expected.  If 64-bit versions are required
   * in 128-bit mode, then the code needs to invoke the double routines a
   * rather than the long double routines.
   */

xlc doesn't define __LONGDOUBLE128 but it seems gcc does because
gcc/config/rs6000/aix61.h has:
  /* Default to 128 bit long double.  */

  #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128

So, how exactly do you get the sample code above to compile using GCC
on AIX?

-- 
albert chin (china@thewrittenword.com)


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