[llvm-dev] Targeting old glibc

Alexandre Bique via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 28 06:54:17 PDT 2020


Hi,

I wonder what is the right way to target an old glibc?

I have a machine which is up to date (glibc 2.32 and clang+lld 10.0.1).

So far I've been able to target older glibc by having a C file containing:

__asm__(".symver powf,powf at GLIBC_2.2.5");
__asm__(".symver expf,expf at GLIBC_2.2.5");
__asm__(".symver exp2f,exp2f at GLIBC_2.2.5");
__asm__(".symver log2f,log2f at GLIBC_2.2.5");
__asm__(".symver logf,logf at GLIBC_2.2.5");

__asm__(".symver log,log at GLIBC_2.2.5");
__asm__(".symver log2,log2 at GLIBC_2.2.5");
__asm__(".symver exp,exp at GLIBC_2.2.5");
__asm__(".symver exp2,exp2 at GLIBC_2.2.5");
__asm__(".symver pow,pow at GLIBC_2.2.5");

But after updating clang and re-creating the cmake build directory it
does not work anymore and I have dependencies toward glibc 2.29:

nm -D /home/abique/.u-he/Zebra2/Zebra2.64.so  | grep GLIBC.*29
                 U exp@@GLIBC_2.29
                 U exp2@@GLIBC_2.29
                 U log@@GLIBC_2.29
                 U pow@@GLIBC_2.29

At first I thought that it was due to LTO, but even after disabling
LTO the problem still occurs.

How to solve it?
Is there a better approach to this problem?

Maybe lld never supported it, and now it is using lld to link instead
of the GNU linker?

Anyway, I'd like to solve this with the LLVM tools while full LTO is
enabled, which requires lld right?

Many thanks.

Regards,
Alexandre Bique


More information about the llvm-dev mailing list