Bug 482848
Summary: | Application compiled with gcc 4.3.2 fails with Floating point exception on old systems | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Mario Torre <neugens> |
Component: | gcc | Assignee: | Jakub Jelinek <jakub> |
Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | medium | Docs Contact: | |
Priority: | low | ||
Version: | 10 | CC: | duncan.loveday, jakub, jhammond |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2009-01-28 15:24:35 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Mario Torre
2009-01-28 15:14:38 UTC
That's user error. You generally cannot expect to compile stuff on a new distro and run the binary on much older one, symbols are being added to glibc and many other stuff. This particular crash is because very old glibcs didn't support DT_GNU_HASH. You can link with -Wl,--hash-style=sysv to avoid this, but generally you can't avoid added symbols. Hi Jakub, thanks for the quick reply. I was sure it was something like this, but the reason why I submitted the bug report is because it works with SuSe machines. As noted, -Wl,--hash-style=sysv does the job. Thanks, Mario This is a bug. This is not user error. gcc (through 4.4.1) is doing the wrong thing by passing --hash-style=gnu to the linker. According to readelf or (ldd -v) the executables currently produced by gcc depend on GLIBC_2.2.5. So if I take one of those to a system where /lib64/ld-linux-x86-64.so.2 is ld-2.3.4.so then I expect it to run. I hope you agree that this is a reasonable expectation. Please make the default hash-style either "sysv" (as man ld says it is) or "both." Is there a problem with "both?" If not then you could save a lot of headaches, as getting killed by SIGFPE is sort of obscure as an indication of glibc mismatch. I too believe this to be a bug. Using gcc 4.1.2 followed by "objdump -p" there is nothing to suggest the executable requires symbols in glibc > 2.0 but in fact the program will not run on a system with glibc 2.3.4 unless the "-Wl,--hash-style=sysv" workaround is used. The error message is not a great help either. If the executable requires a later glibc then that should be recorded in the objdump -p output. [root@rothvoel036 dl]# uname -a Linux rothvoel036 2.6.18-128.el5 #1 SMP Wed Jan 21 07:58:05 EST 2009 i686 i686 i386 GNU/Linux [root@rothvoel036 dl]# cat a.c #include "stdio.h" int main() { printf("Hello world\n"); } [root@rothvoel036 dl]# gcc412 a.c [root@rothvoel036 dl]# objdump -p a.out | tail RELSZ 0x8 RELENT 0x8 VERNEED 0x804820c VERNEEDNUM 0x1 VERSYM 0x8048202 Version References: required from libc.so.6: 0x0d696910 0x00 02 GLIBC_2.0 [root@rothvoel036 dl]# ./a.out Hello world [root@rothvoel036 dl]# ssh lovedada@wobble Last login: Sun Apr 15 22:09:37 2012 from 10.228.199.36 [lovedada@wobble ~]$ ./a.out Floating point exception [lovedada@wobble ~]$ ls -l /lib/libc.so.6 lrwxrwxrwx 1 root root 13 Feb 12 2009 /lib/libc.so.6 -> libc-2.3.4.so [lovedada@wobble ~]$ |