]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/glibc/glibc-2.3.2/glibc23-errno-hack.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / glibc / glibc-2.3.2 / glibc23-errno-hack.patch
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);
5    ++GL(dl_nloaded);
6  
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
12 +                                            + DT_THISPROCNUM
13 +                                            + DT_VERSIONTAGIDX (DT_VERNEED)]
14 +                       == NULL, 0)
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])
21 +    {
22 +      /* Workaround for buggy binaries.  This doesn't handle buggy
23 +        libraries.  */
24 +      bool buggy = false;
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]);
27 +      Elf_Symndx symidx;
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])
31 +       {
32 +         if (__builtin_expect (strcmp (strtab + symtab[symidx].st_name,
33 +                                       "errno") == 0, 0)
34 +             && ELFW(ST_TYPE) (symtab[symidx].st_info) != STT_TLS)
35 +           buggy = true;
36 +       }
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])
40 +       {
41 +         if (__builtin_expect (strcmp (strtab + symtab[symidx].st_name,
42 +                                       "h_errno") == 0, 0)
43 +             && ELFW(ST_TYPE) (symtab[symidx].st_info) != STT_TLS)
44 +           buggy = true;
45 +       }
46 +      if (__builtin_expect (buggy, false))
47 +       {
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");
52 +       }
53 +    }
54 +#endif
55 +
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;