Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
johnny-mnemonic opened this issue Jun 24, 2024 · 6 comments
Closed

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

johnny-mnemonic opened this issue Jun 24, 2024 · 6 comments
Assignees
Labels
bug Something isn't working workaround available

Comments

@johnny-mnemonic
Copy link
Member

@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 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
Copy link
Member Author

johnny-mnemonic commented Jun 24, 2024

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
Copy link
Member Author

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
Copy link
Member Author

johnny-mnemonic commented Jun 24, 2024

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 johnny-mnemonic changed the title Build broken with glibc-2.39.9000-359-g5aa2f79691.tar.xz Build broken in glibc-2.39.9000-359-g5aa2f79691.tar.xz Jun 25, 2024
@johnny-mnemonic
Copy link
Member Author

johnny-mnemonic commented Jun 27, 2024

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 #2 (comment). It will also allow to continue the toolchain autobuilds and gives more time to fix the problem.

johnny-mnemonic added a commit to johnny-mnemonic/toolchain-autobuilds that referenced this issue Jun 27, 2024
@johnny-mnemonic
Copy link
Member Author

johnny-mnemonic commented Jul 5, 2024

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 (EDIT: corrected on 2024-07-09!) on top of master-epic w/o cf2ff34 and e0d8fba:

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 (__exp2, exp2)
 #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 (__exp2, exp2)
 
 
 LOCAL_LIBM_ENTRY(__libm_error_region)

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).

@johnny-mnemonic
Copy link
Member Author

Ok, another patch fixes/works around the remaining issue:

diff --git a/sysdeps/ia64/fpu/s_expm1l.S b/sysdeps/ia64/fpu/s_expm1l.S
index e772c44871..769d0ff15e 100644
--- a/sysdeps/ia64/fpu/s_expm1l.S
+++ b/sysdeps/ia64/fpu/s_expm1l.S
@@ -676,6 +676,7 @@ GLOBAL_IEEE754_ENTRY(expm1l)
 ;;
 
 GLOBAL_IEEE754_END(expm1l)
+libm_hidden_def (__expm1l)
 libm_alias_ldouble_other (__expm1, expm1)
 
 

...and makes the cross-build complete successfully again (on top of master-epic and the patch from #2 (comment) but still w/o cf2ff34 and e0d8fba):

root@esprimo-e420:/usr/src/t2-src# date; time scripts/Build-Target -cfg ia64-toolchain -job 1-glibc; echo $?; date
Tue Jul  9 16:30:40 UTC 2024
Paranoia Check: No active swap partition found!
That can cause the build scripts to stall your system!. Better
activate swap using the 'swapon' command and try again.


16:30:41 Building 1-base/glibc (2.39.9000) ~2m:50s
  Stack-Smashing Protector disabled for this package
  Building in src.glibc.ia64-toolchain.240709.163041.44654, with 4 threads
  Writing output to $root/var/adm/logs/1-glibc.out
  +00:03:30 Finished building base/glibc
  Creating build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/pkgs/glibc-2.39.9000.tar.zst
  Unmounting loop mounts ...

real	3m30.722s
user	8m59.456s
sys	2m42.800s
0
Tue Jul  9 16:34:11 UTC 2024

Got the idea from grepping the glibc source code for the __expm1l symbol:

$ grep -nri __expm1l
[...]
sysdeps/i386/fpu/e_expl.S:220:libm_hidden_def (__expm1l)
[...]

...and looking into its use for i386. As the ia64 version misses a __expm1l symbol - it only has __ieee754_expm1l IIUC - I added that for the expm1l implementation.

I'll adapt the master branches accordingly.

@johnny-mnemonic johnny-mnemonic self-assigned this Jul 9, 2024
@johnny-mnemonic johnny-mnemonic added bug Something isn't working workaround available labels Jul 9, 2024
johnny-mnemonic added a commit to johnny-mnemonic/toolchain-autobuilds that referenced this issue Jul 9, 2024
johnny-mnemonic added a commit that referenced this issue Jul 19, 2024
johnny-mnemonic added a commit that referenced this issue Jul 21, 2024
johnny-mnemonic added a commit that referenced this issue Jul 21, 2024
johnny-mnemonic added a commit that referenced this issue Jul 29, 2024
johnny-mnemonic added a commit that referenced this issue Sep 2, 2024
johnny-mnemonic added a commit that referenced this issue Sep 2, 2024
johnny-mnemonic added a commit that referenced this issue Sep 21, 2024
johnny-mnemonic added a commit that referenced this issue Sep 21, 2024
johnny-mnemonic added a commit that referenced this issue Oct 3, 2024
johnny-mnemonic added a commit that referenced this issue Oct 3, 2024
johnny-mnemonic added a commit that referenced this issue Oct 14, 2024
johnny-mnemonic added a commit that referenced this issue Oct 23, 2024
johnny-mnemonic added a commit that referenced this issue Oct 24, 2024
johnny-mnemonic added a commit that referenced this issue Nov 4, 2024
johnny-mnemonic added a commit that referenced this issue Nov 4, 2024
johnny-mnemonic added a commit that referenced this issue Nov 13, 2024
johnny-mnemonic added a commit that referenced this issue Nov 13, 2024
johnny-mnemonic added a commit that referenced this issue Nov 20, 2024
johnny-mnemonic added a commit that referenced this issue Nov 20, 2024
johnny-mnemonic added a commit that referenced this issue Nov 28, 2024
johnny-mnemonic added a commit that referenced this issue Dec 5, 2024
johnny-mnemonic added a commit that referenced this issue Dec 5, 2024
johnny-mnemonic added a commit that referenced this issue Dec 12, 2024
johnny-mnemonic added a commit that referenced this issue Dec 13, 2024
johnny-mnemonic added a commit that referenced this issue Dec 21, 2024
johnny-mnemonic added a commit that referenced this issue Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working workaround available
Projects
None yet
Development

No branches or pull requests

1 participant