Gentoo Archives: gentoo-mips

From: Jens Seidel <jensseidel@××××××××.net>
To: gentoo-mips@l.g.o
Subject: [gentoo-mips] hash-style trouble with gcc, binutils and glibc
Date: Thu, 03 Jan 2008 20:14:44
Message-Id: 20080103201653.GA29001@imkf-pc073.imkf.tu-freiberg.de
1 Hi,
2
3 since the last system upgrade I always get floating point exceptions when I
4 start self compiled programs or during configure steps (once the gcc compiler
5 is tested). After some searching I found that ld --hash-style= option is the
6 reason. Some time ago a new "gnu" method was introduced to speed loading of
7 dynamic libraries up.
8
9 The problem I have is that glibc uses still the old sysv hash whereas
10 gcc (or/and ld) defaults to gnu. Using -Wl,--hash-style=sysv in CFLAGS,
11 CXXFLAGS and LDFLAGS improves the situation as I can now continue
12 compiling C (but no C++) programs. I rebuild gcc (4.1.2), glibc (2.3.6-r5)
13 and binutils (2.18-r1) but it did not helped.
14
15 I assumed that --hash_style=both is the new toolchain default and would put
16 both old hash and new gnu_hash into binaries and would allow me linking against
17 my glibc (which still uses old hash). But I was wrong:
18
19 $ mips-unknown-linux-gnu-gcc -Wl,--hash-style=sysv main.c
20 $ ./a.out
21 Hello world
22 $ mips-unknown-linux-gnu-gcc -Wl,--hash-style=both main.c
23 $ ./a.out
24 Floating point exception
25 $ mips-unknown-linux-gnu-gcc -Wl,--hash-style=gnu main.c
26 $ ./a.out
27 Floating point exception
28
29 With sysv I get:
30 $ readelf -a a.out | grep -i hash
31 [ 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
32 0x00000004 (HASH) 0x4002ac
33
34 and with gnu and both I get the same output:
35 $ cat /tmp/readelf.both
36 [ 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
37 0x6ffffef5 (GNU_HASH) 0x4002ac
38 1: 00000000 0 FUNC WEAK DEFAULT [GNUHASH] UND __gmon_start__
39 2: 00000000 0 NOTYPE WEAK DEFAULT [GNUHASH] UND _Jv_RegisterClasses
40 3: 00400860 476 FUNC GLOBAL DEFAULT [GNUHASH] UND puts@GLIBC_2.0 (2) 5: 0040075c 128 FUNC GLOBAL DEFAULT [GNUHASH] 11 __libc_csu_init
41 7: 00400680 88 FUNC GLOBAL DEFAULT [GNUHASH] 11 main
42 8: 0040049c 0 FUNC GLOBAL DEFAULT [GNUHASH] 10 _init
43 9: 004006e0 124 FUNC GLOBAL DEFAULT [GNUHASH] 11 __libc_csu_fini
44 11: 00400880 0 FUNC GLOBAL DEFAULT [GNUHASH] 13 _fini
45 12: 00400850 308 FUNC GLOBAL DEFAULT [GNUHASH] UND __libc_start_main@GLIBC_2.0 (2)
46 34: 004006e0 124 FUNC GLOBAL DEFAULT [GNUHASH] 11 __libc_csu_fini
47 37: 00000000 0 FUNC WEAK DEFAULT [GNUHASH] UND __gmon_start__
48 38: 00000000 0 NOTYPE WEAK DEFAULT [GNUHASH] UND _Jv_RegisterClasses
49 39: 00400880 0 FUNC GLOBAL DEFAULT [GNUHASH] 13 _fini
50 41: 00400850 308 FUNC GLOBAL DEFAULT [GNUHASH] UND __libc_start_main@@GLIBC_
51 47: 0040075c 128 FUNC GLOBAL DEFAULT [GNUHASH] 11 __libc_csu_init
52 52: 00400860 476 FUNC GLOBAL DEFAULT [GNUHASH] UND puts@@GLIBC_2.0
53 55: 00400680 88 FUNC GLOBAL DEFAULT [GNUHASH] 11 main
54 56: 0040049c 0 FUNC GLOBAL DEFAULT [GNUHASH] 10 _init
55 Histogram for `.gnu.hash' bucket list length (total of 3 buckets):
56
57 This shows that --hash-style=both is identical to --hash-style=gnu and not
58 properly working on my system. Why?
59
60 I found also an article about hash style in the Gentoo Wiki and tried
61 rebuilding my toolchain with USE=hashstyle but this did not helped.
62
63 Any ideas? Is this a known error on Mips (o32 ABI)?
64
65 Jens
66 --
67 gentoo-mips@g.o mailing list