[arch-general] gcc version package is compiled with
Is there any way to tell which version of gcc an executable is compiled with?
Baho Utot wrote:
Is there any way to tell which version of gcc an executable is compiled with?
Hello :) Maybe can be a better way :) But this just works. strings -a /the/file | grep -m1 GCC Good Luck! -- Gerardo Exequiel Pozzi ( djgera ) http://www.djgera.com.ar KeyID: 0x1B8C330D Key fingerprint = 0CAA D5D4 CD85 4434 A219 76ED 39AB 221B 1B8C 330D
On Tue, 2009-06-16 at 20:09 -0300, Gerardo Exequiel Pozzi wrote:
Baho Utot wrote:
Is there any way to tell which version of gcc an executable is compiled with?
Hello :)
Maybe can be a better way :) But this just works.
strings -a /the/file | grep -m1 GCC
Good Luck!
Seems to work, but only on binaries and libraries that have been compiled against glibc. Libraries compiled against uclibc won't show this information.
Jan de Groot wrote:
On Tue, 2009-06-16 at 20:09 -0300, Gerardo Exequiel Pozzi wrote:
Baho Utot wrote:
Is there any way to tell which version of gcc an executable is compiled with?
Hello :)
Maybe can be a better way :) But this just works.
strings -a /the/file | grep -m1 GCC
Good Luck!
Seems to work, but only on binaries and libraries that have been compiled against glibc. Libraries compiled against uclibc won't show this information.
Rare, this is not related to what "libc" used, is just an assembler label (.ident) that GCC put in the output .s file. What are the commands that you use to build the library? Compiling an executable/library with toolchain-ulibc works fine here. $ x86_64-unknown-linux-uclibc-gcc -fPIC -c hola.c $ x86_64-unknown-linux-uclibc-gcc -shared -o hola.so hola.o $ strings -a hola.so | grep -m1 GCC: GCC: (GNU) 4.4.0 20090526 (prerelease) $ readelf -d hola.so | grep NEEDED 0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1] 0x0000000000000001 (NEEDED) Shared library: [libc.so.0] -- Gerardo Exequiel Pozzi ( djgera ) http://www.djgera.com.ar KeyID: 0x1B8C330D Key fingerprint = 0CAA D5D4 CD85 4434 A219 76ED 39AB 221B 1B8C 330D
On Tue, 2009-06-16 at 21:07 -0300, Gerardo Exequiel Pozzi wrote:
Rare, this is not related to what "libc" used, is just an assembler label (.ident) that GCC put in the output .s file.
What are the commands that you use to build the library? Compiling an executable/library with toolchain-ulibc works fine here.
$ x86_64-unknown-linux-uclibc-gcc -fPIC -c hola.c $ x86_64-unknown-linux-uclibc-gcc -shared -o hola.so hola.o $ strings -a hola.so | grep -m1 GCC: GCC: (GNU) 4.4.0 20090526 (prerelease) $ readelf -d hola.so | grep NEEDED 0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1] 0x0000000000000001 (NEEDED) Shared library: [libc.so.0]
This is with uclibc, binutils-uclibc and binutils-gcc, with the use of cross-compiling using --target= from configure. This label is added via /usr/lib/*.o (crt1.o and friends), but the uclibc toolchain uses /usr/x86_64-unknown-linux-uclibc/lib/*.o, which doesn't contain that label. So that clarifies the difference.
Jan de Groot wrote:
On Tue, 2009-06-16 at 21:07 -0300, Gerardo Exequiel Pozzi wrote:
Rare, this is not related to what "libc" used, is just an assembler label (.ident) that GCC put in the output .s file.
What are the commands that you use to build the library? Compiling an executable/library with toolchain-ulibc works fine here.
$ x86_64-unknown-linux-uclibc-gcc -fPIC -c hola.c $ x86_64-unknown-linux-uclibc-gcc -shared -o hola.so hola.o $ strings -a hola.so | grep -m1 GCC: GCC: (GNU) 4.4.0 20090526 (prerelease) $ readelf -d hola.so | grep NEEDED 0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1] 0x0000000000000001 (NEEDED) Shared library: [libc.so.0]
This is with uclibc, binutils-uclibc and binutils-gcc, with the use of cross-compiling using --target= from configure. This label is added via /usr/lib/*.o (crt1.o and friends), but the uclibc toolchain uses /usr/x86_64-unknown-linux-uclibc/lib/*.o, which doesn't contain that label. So that clarifies the difference.
OK, yes these c runtime startup files, not have the .ident label like from glibc. But the .ident from object file generated by source file is independent from these c runtime startup files. These files are used at linker time. :s Maybe in some part of the Makefile "-fno-ident" gcc flags is used ? $ x86_64-unknown-linux-uclibc-gcc -c hola.c $ strings -a hola.o | grep GCC GCC: (GNU) 4.4.0 20090526 (prerelease) -- Gerardo Exequiel Pozzi ( djgera ) http://www.djgera.com.ar KeyID: 0x1B8C330D Key fingerprint = 0CAA D5D4 CD85 4434 A219 76ED 39AB 221B 1B8C 330D
On Tue, 2009-06-16 at 20:09 -0300, Gerardo Exequiel Pozzi wrote:
Baho Utot wrote:
Is there any way to tell which version of gcc an executable is compiled with?
Hello :)
Maybe can be a better way :) But this just works.
strings -a /the/file | grep -m1 GCC
Good Luck!
OK I will try
participants (3)
-
Baho Utot
-
Gerardo Exequiel Pozzi
-
Jan de Groot