how to link with old versions of glibc?

Paul Zimmermann Paul.Zimmermann@inria.fr
Wed May 20 13:09:00 GMT 2020


       Hi,

I have a program that I want to test with old glibc releases.
I use the testrun.sh script. It works nice with 2.31, 2.30 and 2.29:

zimmerma@tomate:/tmp/src-FixCRlibm$ gcc -Wall -Wextra -O0 main.c dummy.o -DUSE_LIBM -lm
zimmerma@tomate:/tmp/src-FixCRlibm$ /localdisk/zimmerma/glibc-2.29/build/testrun.sh ./a.out 
GNU libc version: 2.29
GNU libc release: stable
Validity tests on worst cases: 3536/3861
Speed test on empty loop: 9.087209  cycles
Speed test on empty loop: 9.088348  cycles
Speed test on empty loop: 9.086935  cycles
Speed test on random numbers:
  cycles/log: 24.031615
  checksum: c17000e32762ee25
  snd step: 0.00%
Speed test on random numbers:
  cycles/log: 24.034019
  checksum: c17000e32762ee25
  snd step: 0.00%
Speed test on random numbers:
  cycles/log: 24.025939
  checksum: c17000e32762ee25
  snd step: 0.00%
Now we have a total of 32 hard-to-round cases, building a large array out of them
Speed test on the worst cases found
  worst cases: 16777216
  cycles/log: 16.999261
  checksum: 41dff8ecd47ed62b

but with 2.28 I get an error:

zimmerma@tomate:/tmp/src-FixCRlibm$ /localdisk/zimmerma/glibc-2.28/build/testrun.sh ./a.out 
./a.out: /localdisk/zimmerma/glibc-2.28/build/math/libm.so.6: version `GLIBC_2.29' not found (required by ./a.out)

If I try to link directly to glibc-2.28 I get:

zimmerma@tomate:/tmp/src-FixCRlibm$ gcc -Wall -Wextra -O0 main.c dummy.o -DUSE_LIBM /localdisk/zimmerma/glibc-2.28/build/math/libm.a
/usr/bin/ld: /localdisk/zimmerma/glibc-2.28/build/math/libm.a(e_log.o): in function `__ieee754_log_ifunc':
e_log.c:(.text+0x3ee): undefined reference to `_dl_x86_cpu_features'
collect2: error: ld returned 1 exit status

which looks like https://bugzilla.redhat.com/show_bug.cgi?id=1433347.

What is the proper way to link with older versions of the glibc?

Best regards,
Paul Zimmermann


More information about the Libc-help mailing list