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