Using different hash type for GCC will generate different execution result.
Sample Code: Download
Makefile
hello.c
Experimentation:
1. Compile hello.c on Fedora
2. Execute hello on Debian and Gentoo
Output on Debian:
debian:~/hello# ./hello
Floating point exception
debian:~/hello# ./hello.both
Hello!
debian:~/hello# ./hello.gnu
Floating point exception
debian:~/hello# ./hello.sysv
Hello!
Result:
Explanation:
Fedora Core 6: GCC Compiler
Fedora developers have introduced changes in the ELF .hash section that provides symbols for dynamic linking. This new .gnu.hash section, which is produced with the new default --hash-style=gnu option for gcc, serves the same purpose as previous hash sections. It provides, however, an approximately 50% increase in dynamic linking speed. Binaries and libraries produced with the new hashing function are incompatible with older glibc and dynamic linker releases. To use the old-style hashing routines for compatibility with older glibc-based systems, pass the --hash-style=sysv option instead.
References:
http://docs.fedoraproject.org/release-notes/fc6
No comments:
Post a Comment