
jensseidel at users
Jan 3, 2008, 1:16 PM
Post #1 of 1
(4840 views)
Permalink
|
|
hash-style trouble with gcc, binutils and glibc
|
|
Hi, since the last system upgrade I always get floating point exceptions when I start self compiled programs or during configure steps (once the gcc compiler is tested). After some searching I found that ld --hash-style= option is the reason. Some time ago a new "gnu" method was introduced to speed loading of dynamic libraries up. The problem I have is that glibc uses still the old sysv hash whereas gcc (or/and ld) defaults to gnu. Using -Wl,--hash-style=sysv in CFLAGS, CXXFLAGS and LDFLAGS improves the situation as I can now continue compiling C (but no C++) programs. I rebuild gcc (4.1.2), glibc (2.3.6-r5) and binutils (2.18-r1) but it did not helped. I assumed that --hash_style=both is the new toolchain default and would put both old hash and new gnu_hash into binaries and would allow me linking against my glibc (which still uses old hash). But I was wrong: $ mips-unknown-linux-gnu-gcc -Wl,--hash-style=sysv main.c $ ./a.out Hello world $ mips-unknown-linux-gnu-gcc -Wl,--hash-style=both main.c $ ./a.out Floating point exception $ mips-unknown-linux-gnu-gcc -Wl,--hash-style=gnu main.c $ ./a.out Floating point exception With sysv I get: $ readelf -a a.out | grep -i hash [ 5] .hash HASH 004002ac 0002ac 000048 04 A 6 0 4 03 .interp .note.ABI-tag .reginfo .dynamic .hash .dynsym .dynstr .gnu.version .gnu.version_r .init .text .MIPS.stubs .fini .rodata .eh_frame 0x00000004 (HASH) 0x4002ac and with gnu and both I get the same output: $ cat /tmp/readelf.both [ 5] .gnu.hash GNU_HASH 004002ac 0002ac 00004c 04 A 6 0 4 03 .interp .note.ABI-tag .reginfo .dynamic .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .init .text .MIPS.stubs .fini .rodata .eh_frame 0x6ffffef5 (GNU_HASH) 0x4002ac 1: 00000000 0 FUNC WEAK DEFAULT [GNUHASH] UND __gmon_start__ 2: 00000000 0 NOTYPE WEAK DEFAULT [GNUHASH] UND _Jv_RegisterClasses 3: 00400860 476 FUNC GLOBAL DEFAULT [GNUHASH] UND puts [at] GLIBC_2 (2) 5: 0040075c 128 FUNC GLOBAL DEFAULT [GNUHASH] 11 __libc_csu_init 7: 00400680 88 FUNC GLOBAL DEFAULT [GNUHASH] 11 main 8: 0040049c 0 FUNC GLOBAL DEFAULT [GNUHASH] 10 _init 9: 004006e0 124 FUNC GLOBAL DEFAULT [GNUHASH] 11 __libc_csu_fini 11: 00400880 0 FUNC GLOBAL DEFAULT [GNUHASH] 13 _fini 12: 00400850 308 FUNC GLOBAL DEFAULT [GNUHASH] UND __libc_start_main [at] GLIBC_2 (2) 34: 004006e0 124 FUNC GLOBAL DEFAULT [GNUHASH] 11 __libc_csu_fini 37: 00000000 0 FUNC WEAK DEFAULT [GNUHASH] UND __gmon_start__ 38: 00000000 0 NOTYPE WEAK DEFAULT [GNUHASH] UND _Jv_RegisterClasses 39: 00400880 0 FUNC GLOBAL DEFAULT [GNUHASH] 13 _fini 41: 00400850 308 FUNC GLOBAL DEFAULT [GNUHASH] UND __libc_start_main@@GLIBC_ 47: 0040075c 128 FUNC GLOBAL DEFAULT [GNUHASH] 11 __libc_csu_init 52: 00400860 476 FUNC GLOBAL DEFAULT [GNUHASH] UND puts@@GLIBC_2.0 55: 00400680 88 FUNC GLOBAL DEFAULT [GNUHASH] 11 main 56: 0040049c 0 FUNC GLOBAL DEFAULT [GNUHASH] 10 _init Histogram for `.gnu.hash' bucket list length (total of 3 buckets): This shows that --hash-style=both is identical to --hash-style=gnu and not properly working on my system. Why? I found also an article about hash style in the Gentoo Wiki and tried rebuilding my toolchain with USE=hashstyle but this did not helped. Any ideas? Is this a known error on Mips (o32 ABI)? Jens -- gentoo-mips [at] gentoo mailing list
|