yann@1
|
1 |
See http://sources.redhat.com/ml/libc-hacker/2005-03/msg00008.html
|
yann@1
|
2 |
|
yann@1
|
3 |
From libc-hacker-return-8343-listarch-libc-hacker=sources dot redhat dot com at sources dot redhat dot com Sat Mar 05 09:21:18 2005
|
yann@1
|
4 |
Return-Path: <libc-hacker-return-8343-listarch-libc-hacker=sources dot redhat dot com at sources dot redhat dot com>
|
yann@1
|
5 |
Delivered-To: listarch-libc-hacker at sources dot redhat dot com
|
yann@1
|
6 |
Received: (qmail 23370 invoked by alias); 5 Mar 2005 09:21:15 -0000
|
yann@1
|
7 |
Mailing-List: contact libc-hacker-help at sources dot redhat dot com; run by ezmlm
|
yann@1
|
8 |
Precedence: bulk
|
yann@1
|
9 |
List-Subscribe: <mailto:libc-hacker-subscribe at sources dot redhat dot com>
|
yann@1
|
10 |
List-Archive: <http://sources.redhat.com/ml/libc-hacker/>
|
yann@1
|
11 |
List-Post: <mailto:libc-hacker at sources dot redhat dot com>
|
yann@1
|
12 |
List-Help: <mailto:libc-hacker-help at sources dot redhat dot com>, <http://sources dot redhat dot com/ml/#faqs>
|
yann@1
|
13 |
Sender: libc-hacker-owner at sources dot redhat dot com
|
yann@1
|
14 |
Delivered-To: mailing list libc-hacker at sources dot redhat dot com
|
yann@1
|
15 |
Received: (qmail 22971 invoked from network); 5 Mar 2005 09:20:51 -0000
|
yann@1
|
16 |
Received: from unknown (HELO sunsite.mff.cuni.cz) (195.113.15.26)
|
yann@1
|
17 |
by sourceware dot org with SMTP; 5 Mar 2005 09:20:51 -0000
|
yann@1
|
18 |
Received: from sunsite.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1])
|
yann@1
|
19 |
by sunsite dot mff dot cuni dot cz (8 dot 13 dot 1/8 dot 13 dot 1) with ESMTP id j259KoB5020894;
|
yann@1
|
20 |
Sat, 5 Mar 2005 10:20:50 +0100
|
yann@1
|
21 |
Received: (from jj@localhost)
|
yann@1
|
22 |
by sunsite dot mff dot cuni dot cz (8 dot 13 dot 1/8 dot 13 dot 1/Submit) id j259KnO1020889;
|
yann@1
|
23 |
Sat, 5 Mar 2005 10:20:49 +0100
|
yann@1
|
24 |
Date: Sat, 5 Mar 2005 10:20:49 +0100
|
yann@1
|
25 |
From: Jakub Jelinek <jakub at redhat dot com>
|
yann@1
|
26 |
To: Ulrich Drepper <drepper at redhat dot com>, Roland McGrath <roland at redhat dot com>
|
yann@1
|
27 |
Cc: Glibc hackers <libc-hacker at sources dot redhat dot com>
|
yann@1
|
28 |
Subject: [PATCH] Fix build with GCC 4
|
yann@1
|
29 |
Message-ID: <20050305092049.GJ4777@sunsite.mff.cuni.cz>
|
yann@1
|
30 |
Reply-To: Jakub Jelinek <jakub at redhat dot com>
|
yann@1
|
31 |
Mime-Version: 1.0
|
yann@1
|
32 |
Content-Type: text/plain; charset=us-ascii
|
yann@1
|
33 |
Content-Disposition: inline
|
yann@1
|
34 |
User-Agent: Mutt/1.4.1i
|
yann@1
|
35 |
|
yann@1
|
36 |
Hi!
|
yann@1
|
37 |
|
yann@1
|
38 |
The thread_offsetof change just mirrors what Alan Modra did to NPTL
|
yann@1
|
39 |
tcb-offsets.sym. Apparently for GCC 4 an offsetof like expression,
|
yann@1
|
40 |
but not really offsetof, is no longer constant folded and therefore
|
yann@1
|
41 |
not suitable for "i" constraint.
|
yann@1
|
42 |
|
yann@1
|
43 |
The ELF_MACHINE_NO_RELA change is needed to avoid
|
yann@1
|
44 |
rtld.c: In function '_dl_start':
|
yann@1
|
45 |
dynamic-link.h:50: error: nested function 'elf_machine_rela_relative' declared but never defined
|
yann@1
|
46 |
dynamic-link.h:47: error: nested function 'elf_machine_rela' declared but never defined
|
yann@1
|
47 |
This is what happens.
|
yann@1
|
48 |
rtld.c first includes dl-machine.h without RESOLVE_MAP
|
yann@1
|
49 |
and without RTLD_BOOTSTRAP defined. This means that ELF_MACHINE_NO_RELA
|
yann@1
|
50 |
is not defined on i386/arm. Later on it defines RESOLVE_MAP
|
yann@1
|
51 |
and RTLD_BOOTSTRAP and includes dynamic-link.h which has:
|
yann@1
|
52 |
# if ! ELF_MACHINE_NO_RELA
|
yann@1
|
53 |
auto void __attribute__((always_inline))
|
yann@1
|
54 |
elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
|
yann@1
|
55 |
const ElfW(Sym) *sym, const struct r_found_version *version,
|
yann@1
|
56 |
void *const reloc_addr);
|
yann@1
|
57 |
auto void __attribute__((always_inline))
|
yann@1
|
58 |
elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
|
yann@1
|
59 |
void *const reloc_addr);
|
yann@1
|
60 |
# endif
|
yann@1
|
61 |
and later on includes dl-machine.h which sees RTLD_BOOTSTRAP is
|
yann@1
|
62 |
defined and defines ELF_MACHINE_NO_RELA and doesn't define
|
yann@1
|
63 |
elf_machine_rela* nested functions.
|
yann@1
|
64 |
But the prototypes were already defined and GCC 4 doesn't like this.
|
yann@1
|
65 |
ELF_MACHINE_NO_RELA is only ever used in preprocessing conditionals
|
yann@1
|
66 |
and never in defined ELF_MACHINE_NO_RELA, so the trick below
|
yann@1
|
67 |
already defines ELF_MACHINE_NO_RELA to 1/0 depending on whether
|
yann@1
|
68 |
RTLD_BOOTSTRAP is defined and thus the prototypes in dynamic-link.h
|
yann@1
|
69 |
that are not desirable are gone.
|
yann@1
|
70 |
|
yann@1
|
71 |
2005-03-05 Jakub Jelinek <jakub@redhat.com>
|
yann@1
|
72 |
|
yann@1
|
73 |
* sysdeps/i386/dl-machine.h (ELF_MACHINE_NO_RELA): Define
|
yann@1
|
74 |
unconditionally to (defined RTLD_BOOTSTRAP).
|
yann@1
|
75 |
* sysdeps/arm/dl-machine.h (ELF_MACHINE_NO_RELA): Likewise.
|
yann@1
|
76 |
linuxthreads/
|
yann@1
|
77 |
* sysdeps/powerpc/tcb-offsets.sym (thread_offsetof): Rework for GCC 4.
|
yann@1
|
78 |
|
yann@1
|
79 |
--- libc/linuxthreads/sysdeps/powerpc/tcb-offsets.sym.jj 2005-03-04 14:21:29.000000000 -0500
|
yann@1
|
80 |
+++ libc/linuxthreads/sysdeps/powerpc/tcb-offsets.sym 2005-03-04 14:26:29.000000000 -0500
|
yann@1
|
81 |
@@ -8,7 +8,7 @@
|
yann@1
|
82 |
-- Abuse tls.h macros to derive offsets relative to the thread register.
|
yann@1
|
83 |
# undef __thread_register
|
yann@1
|
84 |
# define __thread_register ((void *) 0)
|
yann@1
|
85 |
-# define thread_offsetof(mem) ((void *) &THREAD_SELF->p_##mem - (void *) 0)
|
yann@1
|
86 |
+# define thread_offsetof(mem) ((ptrdiff_t) THREAD_SELF + offsetof (struct _pthread_descr_struct, p_##mem))
|
yann@1
|
87 |
|
yann@1
|
88 |
# else
|
yann@1
|
89 |
|