linux-ia64 / glibc-ia64

Glibc fork with IA-64 support re-added. The *-epic branches contain a partial fix for math FPU test errors.
GNU General Public License v2.0
2 stars 0 forks source link

Build broken in glibc-2.39.9000-359-g5aa2f79691.tar.xz #2

Open johnny-mnemonic opened 1 week ago

johnny-mnemonic commented 1 week ago

@matoro, @lenticularis39, @rxrbln :

Trying to (cross-)build https://snapshots.sourceware.org/glibc/trunk/2024-06-21_14-20_1718979601/src/glibc-2.39.9000-359-g5aa2f79691.tar.xz in T2 with https://github.com/linux-ia64/glibc-ia64/compare/master...master-epic on top fails and yields:

/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/bin/../lib/gcc/ia64-t2-linux-gnu/13.3.0/../../../../ia64-t2-linux-gnu/bin/ld: warning: -z relro ignored
/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/bin/../lib/gcc/ia64-t2-linux-gnu/13.3.0/../../../../ia64-t2-linux-gnu/bin/ld: /usr/src/t2-src/src.glibc.ia64-toolchain.240623.185542.1301006/glibc-2.39.9000-359-g5aa2f79691/objs/math/libm_pic.a(s_exp10m1l.os): in function `__exp10m1l':
s_exp10m1l.c:(.text+0x232): undefined reference to `__GI___expm1l'
/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/bin/../lib/gcc/ia64-t2-linux-gnu/13.3.0/../../../../ia64-t2-linux-gnu/bin/ld: /usr/src/t2-src/src.glibc.ia64-toolchain.240623.185542.1301006/glibc-2.39.9000-359-g5aa2f79691/objs/math/libm_pic.a(s_exp2m1l.os): in function `__exp2m1l':
s_exp2m1l.c:(.text+0x1d2): undefined reference to `__ieee754_exp2l'
/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/bin/../lib/gcc/ia64-t2-linux-gnu/13.3.0/../../../../ia64-t2-linux-gnu/bin/ld: s_exp2m1l.c:(.text+0x2b2): undefined reference to `__GI___expm1l'
/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/bin/../lib/gcc/ia64-t2-linux-gnu/13.3.0/../../../../ia64-t2-linux-gnu/bin/ld: s_exp2m1l.c:(.text+0x3d2): undefined reference to `__ieee754_exp2l'
/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/bin/../lib/gcc/ia64-t2-linux-gnu/13.3.0/../../../../ia64-t2-linux-gnu/bin/ld: s_exp2m1l.c:(.text+0x572): undefined reference to `__ieee754_exp2l'
/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/bin/../lib/gcc/ia64-t2-linux-gnu/13.3.0/../../../../ia64-t2-linux-gnu/bin/ld: /usr/src/t2-src/src.glibc.ia64-toolchain.240623.185542.1301006/glibc-2.39.9000-359-g5aa2f79691/objs/math/libm_pic.a(s_exp2m1.os): in function `__exp2m1':
s_exp2m1.c:(.text+0x1d2): undefined reference to `__ieee754_exp2'
/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/bin/../lib/gcc/ia64-t2-linux-gnu/13.3.0/../../../../ia64-t2-linux-gnu/bin/ld: s_exp2m1.c:(.text+0x3d2): undefined reference to `__ieee754_exp2'
/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/bin/../lib/gcc/ia64-t2-linux-gnu/13.3.0/../../../../ia64-t2-linux-gnu/bin/ld: s_exp2m1.c:(.text+0x562): undefined reference to `__ieee754_exp2'
/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/bin/../lib/gcc/ia64-t2-linux-gnu/13.3.0/../../../../ia64-t2-linux-gnu/bin/ld: /usr/src/t2-src/src.glibc.ia64-toolchain.240623.185542.1301006/glibc-2.39.9000-359-g5aa2f79691/objs/math/libm_pic.a(s_exp2m1f.os): in function `__exp2m1f':
s_exp2m1f.c:(.text+0x1d2): undefined reference to `__ieee754_exp2f'
/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/bin/../lib/gcc/ia64-t2-linux-gnu/13.3.0/../../../../ia64-t2-linux-gnu/bin/ld: s_exp2m1f.c:(.text+0x3d2): undefined reference to `__ieee754_exp2f'
/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/bin/../lib/gcc/ia64-t2-linux-gnu/13.3.0/../../../../ia64-t2-linux-gnu/bin/ld: s_exp2m1f.c:(.text+0x562): undefined reference to `__ieee754_exp2f'
collect2: error: ld returned 1 exit status
make[2]: *** [../Makerules:535: /usr/src/t2-src/src.glibc.ia64-toolchain.240623.185542.1301006/glibc-2.39.9000-359-g5aa2f79691/objs/math/libm.so] Error 1
make[2]: Leaving directory '/usr/src/t2-src/src.glibc.ia64-toolchain.240623.185542.1301006/glibc-2.39.9000-359-g5aa2f79691/math'
make[1]: *** [Makefile:484: math/others] Error 2
make[1]: Leaving directory '/usr/src/t2-src/src.glibc.ia64-toolchain.240623.185542.1301006/glibc-2.39.9000-359-g5aa2f79691'
make: *** [Makefile:9: all] Error 2
johnny-mnemonic commented 1 week ago

This is related to the recent addition of C23 functionality with:

...specifically the last one I believe.

Replaying the changes to sysdeps/unix/sysv/linux/<ARCH>/libm.abilist for ia64 alone didn't make a difference for the build, it still fails the same way.

Trying to drop the architecture specific implementations by deleting them like Adhemerval did in for example:

...didn't help either. But I also haven't understood the systematic yet. E.g. sometimes it's enough to just drop the architecture specific implementation, but sometimes it also requires additional changes to generic code, like for the second fabs change. But maybe the latter is needed because there was no generic fabs implementation beforehand, but then the earlier fabs removal for ia64 would have lead to what? :-/

johnny-mnemonic commented 1 week ago

math/s_exp2m1_template.c refers to __ieee754_exp2f, which seems to make no problem for other architectures, or we maybe would have already seen other people complaining on the libc-alpha mailing list after that change. Looking into the exp2* implementations for ia64 in:

...they're all missing an __ieee754_ symbol. Though other files in sysdeps/ia64/fpu have that:

sysdeps/ia64/fpu$ grep -nri __ieee754_
libm-symbols.h:54:  .global __ieee754_##name;       \
libm-symbols.h:55:  .hidden __ieee754_##name;       \
libm-symbols.h:56: __ieee754_##name:
libm-symbols.h:59: ASM_SIZE_DIRECTIVE(__ieee754_##name);            \
libm-symbols.h:60: .type __ieee754_##name, @function
w_lgammaf_main.c:70:versioned_symbol (libm, __ieee754_lgammaf, lgammaf, LGAMMA_NEW_VER);
w_lgammaf_main.c:71:libm_alias_float_other (__ieee754_lgamma, lgamma)
w_lgammaf_main.c:74:strong_alias (LGFUNC (lgammaf), __ieee754_gammaf)
w_lgammaf_main.c:75:weak_alias (__ieee754_gammaf, gammaf)
w_lgammal_main.c:69:versioned_symbol (libm, __ieee754_lgammal, lgammal, LGAMMA_NEW_VER);
w_lgammal_main.c:70:libm_alias_ldouble_other (__ieee754_lgamma, lgamma)
w_lgammal_main.c:73:strong_alias (LGFUNC (lgammal), __ieee754_gammal)
w_lgammal_main.c:74:weak_alias (__ieee754_gammal, gammal)
lgamma-compat.h:28:# define LGFUNC(FUNC) __ieee754_ ## FUNC
e_ilogbl.S:105:GLOBAL_LIBM_ENTRY(__ieee754_ilogbl)
e_ilogbl.S:206:GLOBAL_LIBM_END(__ieee754_ilogbl)
e_lgammaf_r.c:58:float __ieee754_lgammaf_r(float x, int* signgam)
e_lgammaf_r.c:62:libm_alias_float_r (__ieee754_lgamma, lgamma, _r)
e_lgammaf_r.c:65:float __ieee754_gammaf_r(float x, int* signgam)
e_lgammaf_r.c:69:weak_alias (__ieee754_gammaf_r, gammaf_r)
w_lgamma_main.c:70:versioned_symbol (libm, __ieee754_lgamma, lgamma, LGAMMA_NEW_VER);
w_lgamma_main.c:71:libm_alias_double_other (__ieee754_lgamma, lgamma)
w_lgamma_main.c:74:strong_alias (LGFUNC (lgamma), __ieee754_gamma)
w_lgamma_main.c:75:weak_alias (__ieee754_gamma, gamma)
e_exp2.S:496:libm_alias_double_other (__ieee754_exp2, exp2)
e_lgammal_r.c:57:long double __ieee754_lgammal_r(long double x, int* signgam)
e_lgammal_r.c:61:libm_alias_ldouble_r (__ieee754_lgamma, lgamma, _r)
e_lgammal_r.c:64:long double __ieee754_gammal_r(long double x, int* signgam)
e_lgammal_r.c:68:weak_alias (__ieee754_gammal_r, gammal_r)
e_lgamma_r.c:58:double __ieee754_lgamma_r(double x, int* signgam)
e_lgamma_r.c:62:libm_alias_double_r (__ieee754_lgamma, lgamma, _r)
e_lgamma_r.c:65:double __ieee754_gamma_r(double x, int* signgam)
e_lgamma_r.c:69:weak_alias (__ieee754_gamma_r, gamma_r)

I'm unsure what to do here. Just changing https://github.com/linux-ia64/glibc-ia64/blob/master-epic/sysdeps/ia64/fpu/e_exp2.S#L496 to libm_alias_double_other (__ieee754_exp2, exp2) didn't make a difference. And when looking into the results for sysdeps/ia64/fpu/libm-symbols.h above, it looks like this symbol might get already set for each function.

johnny-mnemonic commented 1 week ago

Another point is, that the commit message of Implement C23 exp2m1, exp10m1 actually shows that powerpc64le has a similar issue like ia64 with those undefined reference to __GI___expm1l messages. Which required changes to the arch specific sysdeps/ieee754/ldbl-128ibm-compat/Versions and some arch specific files below sysdeps/powerpc/powerpc64/le/fpu/multiarch.

Not sure how to replicate something like that for ia64.

johnny-mnemonic commented 1 week ago

As a first measure I have now reverted:

...in the master-epic and master-w-ia64 branches. This cross-builds for me with the snapshot mentioned in https://github.com/linux-ia64/glibc-ia64/issues/2#issue-2371053138. It will also allow to continue the toolchain autobuilds and gives more time to fix the problem.

johnny-mnemonic commented 9 hours ago

So got this down to:

[...]
/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/bin/../lib/gcc/ia64-t2-linux-gnu/15.0.0/../../../../ia64-t2-linux-gnu/bin/ld: warning: -z relro ignored
/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/bin/../lib/gcc/ia64-t2-linux-gnu/15.0.0/../../../../ia64-t2-linux-gnu/bin/ld: /usr/src/t2-src/src.glibc.ia64-toolchain.240705.170823.1132/glibc-2.39.9000-359-g5aa2f79691/objs/math/libm_pic.a(s_exp10m1l.os): in function `__exp10m1l':
s_exp10m1l.c:(.text+0x232): undefined reference to `__GI___expm1l'
/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/bin/../lib/gcc/ia64-t2-linux-gnu/15.0.0/../../../../ia64-t2-linux-gnu/bin/ld: /usr/src/t2-src/src.glibc.ia64-toolchain.240705.170823.1132/glibc-2.39.9000-359-g5aa2f79691/objs/math/libm_pic.a(s_exp2m1l.os): in function `__exp2m1l':
s_exp2m1l.c:(.text+0x2b2): undefined reference to `__GI___expm1l'
collect2: error: ld returned 1 exit status
make[2]: *** [../Makerules:535: /usr/src/t2-src/src.glibc.ia64-toolchain.240705.170823.1132/glibc-2.39.9000-359-g5aa2f79691/objs/math/libm.so] Error 1
make[2]: Leaving directory '/usr/src/t2-src/src.glibc.ia64-toolchain.240705.170823.1132/glibc-2.39.9000-359-g5aa2f79691/math'
make[1]: *** [Makefile:484: math/others] Error 2
make[1]: Leaving directory '/usr/src/t2-src/src.glibc.ia64-toolchain.240705.170823.1132/glibc-2.39.9000-359-g5aa2f79691'
make: *** [Makefile:9: all] Error 2

...with the following patch:

diff --git a/sysdeps/ia64/fpu/e_exp2.S b/sysdeps/ia64/fpu/e_exp2.S
index 76e26f298c..d09cd8e279 100644
--- a/sysdeps/ia64/fpu/e_exp2.S
+++ b/sysdeps/ia64/fpu/e_exp2.S
@@ -226,7 +225,7 @@ LOCAL_OBJECT_END(T_table)

 .section .text
-WEAK_LIBM_ENTRY(exp2)
+GLOBAL_IEEE754_ENTRY(exp2)

 {.mfi
@@ -492,7 +491,7 @@ OUT_RANGE_exp2:
 }
 ;;

-WEAK_LIBM_END(exp2)
+GLOBAL_IEEE754_END(exp2)
 libm_alias_double_other (__exp2, exp2)
 #ifdef SHARED
 .symver exp2,exp2@@GLIBC_2.29
diff --git a/sysdeps/ia64/fpu/e_exp2f.S b/sysdeps/ia64/fpu/e_exp2f.S
index b304885cc6..f7e0acfbf6 100644
--- a/sysdeps/ia64/fpu/e_exp2f.S
+++ b/sysdeps/ia64/fpu/e_exp2f.S
@@ -220,7 +220,7 @@ LOCAL_OBJECT_END(T_table)

 .section .text
-WEAK_LIBM_ENTRY(exp2f)
+GLOBAL_IEEE754_ENTRY(exp2f)

 {.mfi
@@ -467,8 +467,8 @@ OUT_RANGE_exp2:
 }
 ;;

-WEAK_LIBM_END(exp2f)
-libm_alias_float_other (__exp2, exp2)
+GLOBAL_IEEE754_END(exp2f)
+libm_alias_float_other (__exp2f, exp2f)
 #ifdef SHARED
 .symver exp2f,exp2f@@GLIBC_2.27
 .weak __exp2f_compat
diff --git a/sysdeps/ia64/fpu/e_exp2l.S b/sysdeps/ia64/fpu/e_exp2l.S
index 70cbcf06da..81bc10a1d4 100644
--- a/sysdeps/ia64/fpu/e_exp2l.S
+++ b/sysdeps/ia64/fpu/e_exp2l.S
@@ -375,7 +373,7 @@ LOCAL_OBJECT_END(D_table)

 .section .text
-GLOBAL_LIBM_ENTRY(exp2l)
+GLOBAL_IEEE754_ENTRY(exp2l)

 {.mii
        // get exponent
@@ -744,8 +742,8 @@ OUT_RANGE_exp2l:
 }

-GLOBAL_LIBM_END(exp2l)
-libm_alias_ldouble_other (exp2, exp2)
+GLOBAL_IEEE754_END(exp2l)
+libm_alias_ldouble_other (__exp2l, exp2l)

 LOCAL_LIBM_ENTRY(__libm_error_region)
diff --git a/sysdeps/ia64/fpu/s_expm1l.S b/sysdeps/ia64/fpu/s_expm1l.S
index e772c44871..b36945cf07 100644
--- a/sysdeps/ia64/fpu/s_expm1l.S
+++ b/sysdeps/ia64/fpu/s_expm1l.S
@@ -676,7 +676,8 @@ GLOBAL_IEEE754_ENTRY(expm1l)
 ;;

 GLOBAL_IEEE754_END(expm1l)
-libm_alias_ldouble_other (__expm1, expm1)
+libm_alias_ldouble_other (__expm1l, expm1l)
+libm_alias_ldouble_other (__expm1, expm1l)

 GLOBAL_IEEE754_ENTRY(expl)

See https://github.com/linux-ia64/glibc-ia64/blob/master-epic/sysdeps/ia64/fpu/libm-symbols.h for details about those defines.

Not sure if this is fully correct, because when looking into https://github.com/linux-ia64/glibc-ia64/blob/master-epic/sysdeps/ia64/fpu/import_file.awk#L83, exp2() functions are not listed in ieee754_funcs, so maybe they are not compliant or they weren't part of IEEE754 in 2005 (the latest revision of Intel's libm is from 2005).