1 --- glibc-2.3.2/elf/rtld.c.orig 2003-11-02 16:12:36.000000000 -0500
2 +++ glibc-2.3.2/elf/rtld.c 2003-11-02 16:24:43.000000000 -0500
3 @@ -966,6 +966,55 @@ of this helper program; chances are you
4 GL(dl_rtld_map).l_prev = GL(dl_loaded);
7 +#if defined(__linux__) && defined(__i386__)
8 + /* Debian note: this code imported from Red Hat. */
9 + /* Force non-TLS libraries for glibc 2.0 binaries
10 + or if a buggy binary references non-TLS errno or h_errno. */
11 + if (__builtin_expect (GL(dl_loaded)->l_info[DT_NUM
13 + + DT_VERSIONTAGIDX (DT_VERNEED)]
15 + && GL(dl_loaded)->l_info[DT_DEBUG])
16 + GL(dl_osversion) = 0x20401;
17 + else if ((__builtin_expect (mode, normal) != normal
18 + || GL(dl_loaded)->l_info [ADDRIDX (DT_GNU_LIBLIST)] == NULL)
19 + /* Only binaries have DT_DEBUG dynamic tags... */
20 + && GL(dl_loaded)->l_info[DT_DEBUG])
22 + /* Workaround for buggy binaries. This doesn't handle buggy
25 + const ElfW(Sym) *symtab = (const void *) D_PTR (GL(dl_loaded), l_info[DT_SYMTAB]);
26 + const char *strtab = (const void *) D_PTR (GL(dl_loaded), l_info[DT_STRTAB]);
28 + for (symidx = GL(dl_loaded)->l_buckets[0x6c994f % GL(dl_loaded)->l_nbuckets];
29 + !buggy && symidx != STN_UNDEF;
30 + symidx = GL(dl_loaded)->l_chain[symidx])
32 + if (__builtin_expect (strcmp (strtab + symtab[symidx].st_name,
34 + && ELFW(ST_TYPE) (symtab[symidx].st_info) != STT_TLS)
37 + for (symidx = GL(dl_loaded)->l_buckets[0xe5c992f % GL(dl_loaded)->l_nbuckets];
38 + !buggy && symidx != STN_UNDEF;
39 + symidx = GL(dl_loaded)->l_chain[symidx])
41 + if (__builtin_expect (strcmp (strtab + symtab[symidx].st_name,
43 + && ELFW(ST_TYPE) (symtab[symidx].st_info) != STT_TLS)
46 + if (__builtin_expect (buggy, false))
48 + if (GL(dl_osversion) > 0x20401)
49 + GL(dl_osversion) = 0x20401;
50 + _dl_error_printf ("ld.so: Incorrectly built binary which accesses errno or h_errno directly.\n"
51 + "ld.so: See /usr/share/doc/libc6/FAQ.gz.\n");
56 /* Set up the program header information for the dynamic linker
57 itself. It is needed in the dl_iterate_phdr() callbacks. */
58 ElfW(Ehdr) *rtld_ehdr = (ElfW(Ehdr) *) GL(dl_rtld_map).l_map_start;