Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What make g++ include GLIBCXX_3.4.9?

I compiled 2 different binaries on the same GNU/Linux server using g++ version 4.2.3.

The first one uses:

GLIBC_2.0
GLIBC_2.2
GLIBC_2.1
GLIBCXX_3.4
GLIBC_2.1.3

The second one uses:

GLIBC_2.0
GLIBC_2.2
GLIBC_2.1
GLIBCXX_3.4.9
GLIBCXX_3.4
GLIBC_2.1.3

Why the second binary uses GLIBCXX_3.4.9 that is only available on libstdc++.so.6.0.9 and not in libstdc++.so.6.0.8

What is the new feature generated by g++ that require an ABI break and force the system to have GLIBCXX_3.4.9?

Is there a way to disable this new feature to not require GLIBCXX_3.4.9?

like image 510
acemtp Avatar asked Dec 22 '22 13:12

acemtp


1 Answers

To find out which of the listed GLIBCXX_3.4.9 symbol(s) your binary actually depends on, do this:

readelf -s ./a.out | grep 'GLIBCXX_3\.4\.9' | c++filt

Once you know which symbols to look for, you can trace back to the object which needs them:

nm -A *.o | grep _ZN<whatever>

Finally, to tie this back to source, you can do:

objdump -dS foo.o

and see which code is referencing the 3.4.9 symbol(s).

like image 83
Employed Russian Avatar answered Dec 26 '22 07:12

Employed Russian