Why GCC uses minimum glibc version in OpenSuse?

I’m using opensuse as my main workstation.

When i build my projects and deploy them on opensuse usually there isn’t any problem for some dependencies like glibc.
I can easily create appimage without including glibc and it runs on other distros even old versions.

It is very interesting for me, when i check my built files with some tools like “objdump” , i sea that the compiler used the lowest level of glibc.

For example for now my glibc version is 2.31 and in the binany only these sumbols are exist:


DYNAMIC SYMBOL TABLE: 
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 printf 
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 __libc_start_main 
0000000000000000  w   D  *UND*  0000000000000000  Base        __gmon_start__

It uses “GLIBC_2.2.5” for printf
**
That’s great :cool:

**
But when i build on other distros the result is not like this.

For example same code on fedora (with glibc 2.35 or 2.34) uses “GLIBC_2.34” for printf.

I tested in some other distros and versions, and other version of gcc.
Even i downloaded gcc from opensuse repos and ran on other distros.
**
My question is why does this happen?****
Does he use a special config?****
Or did I get something wrong?
**

The version comes from glibc itself.

bor@tw:/tmp> objdump -T /usr/lib64/libc.so.6 | grep -w printf
000000000007347e g    DF .text    00000000000000ce  GLIBC_2.2.5 printf
bor@tw:/tmp> rpm -q glibc
glibc-2.35-5.1.x86_64
bor@tw:/tmp> 

This is also the version in glibc upstream sources. I do not know how Fedora builds their glibc, try asking there.