summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-06-27 13:24:44 +0000
committerJakub Jelinek <jakub@redhat.com>2005-06-27 13:24:44 +0000
commit03d65262fdcc287ef8b691c7dff2f1a63cdd13c2 (patch)
treea8ac7c86519f55a4aadf31b0c9e075eaf96ea0e3 /elf
parent5570fbd25a574d54ab135e1d3cdac0bc74029689 (diff)
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-load.c30
-rw-r--r--elf/dl-support.c5
-rw-r--r--elf/rtld.c104
-rw-r--r--elf/tst-tls10.h4
4 files changed, 3 insertions, 140 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 791c0dcba5..d8b3a56d0d 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -644,7 +644,7 @@ _dl_init_paths (const char *llp)
/* First set up the rest of the default search directory entries. */
aelem = rtld_search_dirs.dirs = (struct r_search_path_elem **)
- malloc ((nsystem_dirs_len + 2) * sizeof (struct r_search_path_elem *));
+ malloc ((nsystem_dirs_len + 1) * sizeof (struct r_search_path_elem *));
if (rtld_search_dirs.dirs == NULL)
{
errstring = N_("cannot create search path array");
@@ -780,34 +780,6 @@ _dl_init_paths (const char *llp)
}
-void
-internal_function
-_dl_init_linuxthreads_paths (void)
-{
- size_t cnt;
- struct r_search_path_elem *elem, **aelem;
-
- elem = malloc (sizeof (struct r_search_path_elem)
- + ncapstr * sizeof (enum r_dir_status));
- if (elem == NULL)
- return;
-
- for (aelem = rtld_search_dirs.dirs; *aelem; aelem++);
- aelem[0] = elem;
- aelem[1] = NULL;
- elem->what = "linuxthreads search path";
- elem->where = NULL;
- elem->dirname = "/" DL_DST_LIB "/obsolete/linuxthreads/";
- elem->dirnamelen = sizeof ("/" DL_DST_LIB "/obsolete/linuxthreads/") - 1;
- if (elem->dirnamelen > max_dirnamelen)
- max_dirnamelen = elem->dirnamelen;
- for (cnt = 0; cnt < ncapstr; ++cnt)
- elem->status[cnt] = unknown;
- elem->next = NULL;
- aelem[-1]->next = elem;
-}
-
-
static void
__attribute__ ((noreturn, noinline))
lose (int code, int fd, const char *name, char *realname, struct link_map *l,
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 483b132b43..c3b6350ed3 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -281,11 +281,6 @@ _dl_non_dynamic_init (void)
if (_dl_platform != NULL)
_dl_platformlen = strlen (_dl_platform);
-#if defined (__i386__) && !defined (USE_TLS)
- /* Load libs not using TLS. */
- _dl_osversion = 0x20205;
-#endif
-
/* Scan for a program header telling us the stack is nonexecutable. */
if (_dl_phdr != NULL)
for (uint_fast16_t i = 0; i < _dl_phnum; ++i)
diff --git a/elf/rtld.c b/elf/rtld.c
index cf0e415ce1..21365af2ba 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1356,59 +1356,6 @@ ld.so does not support TLS, but program uses it!\n");
++GL(dl_ns)[LM_ID_BASE]._ns_nloaded;
++GL(dl_load_adds);
-#if defined(__i386__)
- /* Force non-TLS libraries for glibc 2.0 binaries
- or if a buggy binary references non-TLS errno or h_errno. */
- if (__builtin_expect (main_map->l_info[DT_NUM + DT_THISPROCNUM
- + DT_VERSIONTAGIDX (DT_VERNEED)]
- == NULL, 0)
- && main_map->l_info[DT_DEBUG])
- GLRO(dl_osversion) = 0x20205;
- else if ((__builtin_expect (mode, normal) != normal
- || main_map->l_info[ADDRIDX (DT_GNU_LIBLIST)] == NULL)
- /* Only binaries have DT_DEBUG dynamic tags... */
- && main_map->l_info[DT_DEBUG])
- {
- /* Workaround for buggy binaries. This doesn't handle buggy
- libraries. */
- bool buggy = false;
- const ElfW(Sym) *symtab = (const void *) D_PTR (main_map,
- l_info[DT_SYMTAB]);
- const char *strtab = (const void *) D_PTR (main_map,
- l_info[DT_STRTAB]);
- Elf_Symndx symidx;
- for (symidx = main_map->l_buckets[0x6c994f % main_map->l_nbuckets];
- symidx != STN_UNDEF;
- symidx = main_map->l_chain[symidx])
- {
- if (__builtin_expect (strcmp (strtab + symtab[symidx].st_name,
- "errno") == 0, 0)
- && ELFW(ST_TYPE) (symtab[symidx].st_info) != STT_TLS)
- buggy = true;
- }
- for (symidx = main_map->l_buckets[0xe5c992f % main_map->l_nbuckets];
- symidx != STN_UNDEF;
- symidx = main_map->l_chain[symidx])
- {
- if (__builtin_expect (strcmp (strtab + symtab[symidx].st_name,
- "h_errno") == 0, 0)
- && ELFW(ST_TYPE) (symtab[symidx].st_info) != STT_TLS)
- buggy = true;
- }
- if (__builtin_expect (buggy, false) && GLRO(dl_osversion) > 0x20401)
- {
- GLRO(dl_osversion) = 0x20401;
- _dl_error_printf ("Incorrectly built binary which accesses errno or h_errno directly. Needs to be fixed.\n");
- }
- }
-#endif
-
- if (GLRO(dl_osversion) <= 0x20413)
- {
- extern void internal_function _dl_init_linuxthreads_paths (void);
- _dl_init_linuxthreads_paths ();
- }
-
/* If LD_USE_LOAD_BIAS env variable has not been seen, default
to not using bias for non-prelinked PIEs and libraries
and using it for executables or prelinked PIEs or libraries. */
@@ -1764,57 +1711,6 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
}
}
-#if defined(__i386__) || defined(__alpha__) || (defined(__sparc__) && !defined(__arch64__))
- /*
- * Modifications by Red Hat Software
- *
- * Deal with the broken binaries from the non-versioned ages of glibc.
- * If a binary does not have version information enabled, we assume that
- * it is a glibc 2.0 binary and we load a compatibility library to try to
- * overcome binary incompatibilities.
- * Blame: gafton@redhat.com
- */
-#define LIB_NOVERSION "/lib/libNoVersion.so.1"
-
- if (__builtin_expect (main_map->l_info[DT_NUM + DT_THISPROCNUM
- + DT_VERSIONTAGIDX (DT_VERNEED)]
- == NULL, 0)
- && (main_map->l_info[DT_DEBUG]
- || !(GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)))
- {
- struct stat test_st;
- int test_fd;
- int can_load;
-
- HP_TIMING_NOW (start);
-
-/* _dl_sysdep_message("Loading compatibility library... ", NULL); */
-
- can_load = 1;
- test_fd = __open (LIB_NOVERSION, O_RDONLY);
- if (test_fd < 0) {
- can_load = 0;
-/* _dl_sysdep_message(" Can't find " LIB_NOVERSION "\n", NULL); */
- } else {
- if (__fxstat (_STAT_VER, test_fd, &test_st) < 0 || test_st.st_size == 0) {
- can_load = 0;
-/* _dl_sysdep_message(" Can't stat " LIB_NOVERSION "\n", NULL); */
- }
- }
-
- if (test_fd >= 0) /* open did no fail.. */
- __close(test_fd); /* avoid fd leaks */
-
- if (can_load != 0)
- npreloads += do_preload (LIB_NOVERSION, main_map,
- "nonversioned binary");
-
- HP_TIMING_NOW (stop);
- HP_TIMING_DIFF (diff, start, stop);
- HP_TIMING_ACCUM_NT (load_time, diff);
- }
-#endif
-
if (__builtin_expect (*first_preload != NULL, 0))
{
/* Set up PRELOADS with a vector of the preloaded libraries. */
diff --git a/elf/tst-tls10.h b/elf/tst-tls10.h
index 6133209aba..1be6adc293 100644
--- a/elf/tst-tls10.h
+++ b/elf/tst-tls10.h
@@ -1,8 +1,8 @@
#include <tls.h>
#include <stdlib.h>
-#if defined USE_TLS \
- && (0 || (defined HAVE___THREAD && defined HAVE_TLS_MODEL_ATTRIBUTE))
+#if defined USE_TLS && defined HAVE___THREAD \
+ && defined HAVE_TLS_MODEL_ATTRIBUTE
# define USE_TLS__THREAD
struct A