diff options
author | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2012-03-21 20:25:11 +0000 |
---|---|---|
committer | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2012-03-21 20:25:11 +0000 |
commit | 11e8a843c1be2bfbacb427ca25282e6979ebb48f (patch) | |
tree | 3358bff2de223bb79aa10ff35c4273cb94dc04e8 /libc/sysdeps/unix/sysv/linux/x86_64 | |
parent | 21983719922788c86799322b2b4cd68830712137 (diff) |
Merge changes between r17530 and r17700 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@17701 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/sysdeps/unix/sysv/linux/x86_64')
-rw-r--r-- | libc/sysdeps/unix/sysv/linux/x86_64/dl-cache.h | 29 | ||||
-rw-r--r-- | libc/sysdeps/unix/sysv/linux/x86_64/ldconfig.h | 1 | ||||
-rw-r--r-- | libc/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed | 2 | ||||
-rw-r--r-- | libc/sysdeps/unix/sysv/linux/x86_64/makecontext.c | 33 | ||||
-rw-r--r-- | libc/sysdeps/unix/sysv/linux/x86_64/readelflib.c | 63 | ||||
-rw-r--r-- | libc/sysdeps/unix/sysv/linux/x86_64/register-dump.h | 2 |
6 files changed, 50 insertions, 80 deletions
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/dl-cache.h b/libc/sysdeps/unix/sysv/linux/x86_64/dl-cache.h index 8463fea3d..e14151d42 100644 --- a/libc/sysdeps/unix/sysv/linux/x86_64/dl-cache.h +++ b/libc/sysdeps/unix/sysv/linux/x86_64/dl-cache.h @@ -21,4 +21,31 @@ #define _dl_cache_check_flags(flags) \ ((flags) == _DL_CACHE_DEFAULT_ID) -#include <sysdeps/unix/sysv/linux/sparc/dl-cache.h> +#define add_system_dir(dir) \ + do \ + { \ + size_t len = strlen (dir); \ + char path[len + 4]; \ + memcpy (path, dir, len + 1); \ + if (len >= 6 && ! memcmp (path + len - 6, "/lib64", 6)) \ + { \ + len -= 2; \ + path[len] = '\0'; \ + } \ + else if (len >= 7 \ + && ! memcmp (path + len - 7, "/libx32", 7)) \ + { \ + len -= 3; \ + path[len] = '\0'; \ + } \ + add_dir (path); \ + if (len >= 4 && ! memcmp (path + len - 4, "/lib", 4)) \ + { \ + memcpy (path + len, "64", 3); \ + add_dir (path); \ + memcpy (path + len, "x32", 4); \ + add_dir (path); \ + } \ + } while (0) + +#include <sysdeps/generic/dl-cache.h> diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/ldconfig.h b/libc/sysdeps/unix/sysv/linux/x86_64/ldconfig.h index af4d1b5ad..6f5b828f4 100644 --- a/libc/sysdeps/unix/sysv/linux/x86_64/ldconfig.h +++ b/libc/sysdeps/unix/sysv/linux/x86_64/ldconfig.h @@ -19,6 +19,7 @@ #define SYSDEP_KNOWN_INTERPRETER_NAMES \ { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 }, \ + { "/libx32/ld-linux-x32.so.2", FLAG_ELF_LIBC6 }, \ { "/lib64/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 }, #define SYSDEP_KNOWN_LIBRARY_NAMES \ { "libc.so.6", FLAG_ELF_LIBC6 }, \ diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed b/libc/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed index 3f1530d31..44d76e8aa 100644 --- a/libc/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed +++ b/libc/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed @@ -1,3 +1,3 @@ /LD_TRACE_LOADED_OBJECTS=1/a\ add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out" -s_^\(RTLDLIST=\)\(.*lib\)\(\|64\)\(/[^/]*\)\(-x86-64\)\(\.so\.[0-9.]*\)[ ]*$_\1"\2\4\6 \264\4\5\6"_ +s_^\(RTLDLIST=\)\(.*lib\)\(\|64\|x32\)\(/[^/]*\)\(-x86-64\|-x32\)\(\.so\.[0-9.]*\)[ ]*$_\1"\2\4\6 \264\4-x86-64\6 \2x32\4-x32\6"_ diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/makecontext.c b/libc/sysdeps/unix/sysv/linux/x86_64/makecontext.c index 860925f46..54730312a 100644 --- a/libc/sysdeps/unix/sysv/linux/x86_64/makecontext.c +++ b/libc/sysdeps/unix/sysv/linux/x86_64/makecontext.c @@ -52,29 +52,30 @@ void __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...) { extern void __start_context (void); - unsigned long int *sp, idx_uc_link; + greg_t *sp; + unsigned int idx_uc_link; va_list ap; int i; /* Generate room on stack for parameter if needed and uc_link. */ - sp = (unsigned long int *) ((uintptr_t) ucp->uc_stack.ss_sp - + ucp->uc_stack.ss_size); + sp = (greg_t *) ((uintptr_t) ucp->uc_stack.ss_sp + + ucp->uc_stack.ss_size); sp -= (argc > 6 ? argc - 6 : 0) + 1; /* Align stack and make space for trampoline address. */ - sp = (unsigned long int *) ((((uintptr_t) sp) & -16L) - 8); + sp = (greg_t *) ((((uintptr_t) sp) & -16L) - 8); idx_uc_link = (argc > 6 ? argc - 6 : 0) + 1; /* Setup context ucp. */ /* Address to jump to. */ - ucp->uc_mcontext.gregs[REG_RIP] = (long int) func; + ucp->uc_mcontext.gregs[REG_RIP] = (uintptr_t) func; /* Setup rbx.*/ - ucp->uc_mcontext.gregs[REG_RBX] = (long int) &sp[idx_uc_link]; - ucp->uc_mcontext.gregs[REG_RSP] = (long int) sp; + ucp->uc_mcontext.gregs[REG_RBX] = (uintptr_t) &sp[idx_uc_link]; + ucp->uc_mcontext.gregs[REG_RSP] = (uintptr_t) sp; /* Setup stack. */ - sp[0] = (unsigned long int) &__start_context; - sp[idx_uc_link] = (unsigned long int) ucp->uc_link; + sp[0] = (uintptr_t) &__start_context; + sp[idx_uc_link] = (uintptr_t) ucp->uc_link; va_start (ap, argc); /* Handle arguments. @@ -90,26 +91,26 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...) switch (i) { case 0: - ucp->uc_mcontext.gregs[REG_RDI] = va_arg (ap, long int); + ucp->uc_mcontext.gregs[REG_RDI] = va_arg (ap, greg_t); break; case 1: - ucp->uc_mcontext.gregs[REG_RSI] = va_arg (ap, long int); + ucp->uc_mcontext.gregs[REG_RSI] = va_arg (ap, greg_t); break; case 2: - ucp->uc_mcontext.gregs[REG_RDX] = va_arg (ap, long int); + ucp->uc_mcontext.gregs[REG_RDX] = va_arg (ap, greg_t); break; case 3: - ucp->uc_mcontext.gregs[REG_RCX] = va_arg (ap, long int); + ucp->uc_mcontext.gregs[REG_RCX] = va_arg (ap, greg_t); break; case 4: - ucp->uc_mcontext.gregs[REG_R8] = va_arg (ap, long int); + ucp->uc_mcontext.gregs[REG_R8] = va_arg (ap, greg_t); break; case 5: - ucp->uc_mcontext.gregs[REG_R9] = va_arg (ap, long int); + ucp->uc_mcontext.gregs[REG_R9] = va_arg (ap, greg_t); break; default: /* Put value on stack. */ - sp[i - 5] = va_arg (ap, unsigned long int); + sp[i - 5] = va_arg (ap, greg_t); break; } va_end (ap); diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/readelflib.c b/libc/sysdeps/unix/sysv/linux/x86_64/readelflib.c index 7aa68ff7e..4c4e5f9d1 100644 --- a/libc/sysdeps/unix/sysv/linux/x86_64/readelflib.c +++ b/libc/sysdeps/unix/sysv/linux/x86_64/readelflib.c @@ -1,61 +1,2 @@ -/* Copyright (C) 1999, 2001, 2002, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger <aj@suse.de>, 1999 and - Jakub Jelinek <jakub@redhat.com>, 1999. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - - -int process_elf32_file (const char *file_name, const char *lib, int *flag, - unsigned int *osversion, char **soname, - void *file_contents, size_t file_length); -int process_elf64_file (const char *file_name, const char *lib, int *flag, - unsigned int *osversion, char **soname, - void *file_contents, size_t file_length); - -/* Returns 0 if everything is ok, != 0 in case of error. */ -int -process_elf_file (const char *file_name, const char *lib, int *flag, - unsigned int *osversion, char **soname, void *file_contents, - size_t file_length) -{ - ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents; - int ret; - - if (elf_header->e_ident [EI_CLASS] == ELFCLASS32) - return process_elf32_file (file_name, lib, flag, osversion, soname, - file_contents, file_length); - else - { - ret = process_elf64_file (file_name, lib, flag, osversion, soname, - file_contents, file_length); - /* x86-64 64bit libraries are always libc.so.6+. */ - if (!ret) - *flag = FLAG_X8664_LIB64|FLAG_ELF_LIBC6; - return ret; - } -} - -#undef __ELF_NATIVE_CLASS -#undef process_elf_file -#define process_elf_file process_elf32_file -#define __ELF_NATIVE_CLASS 32 -#include "elf/readelflib.c" - -#undef __ELF_NATIVE_CLASS -#undef process_elf_file -#define process_elf_file process_elf64_file -#define __ELF_NATIVE_CLASS 64 -#include "elf/readelflib.c" +#define SKIP_EM_IA_64 +#include <sysdeps/unix/sysv/linux/i386/readelflib.c> diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/register-dump.h b/libc/sysdeps/unix/sysv/linux/x86_64/register-dump.h index 83157916d..3ef8e09b6 100644 --- a/libc/sysdeps/unix/sysv/linux/x86_64/register-dump.h +++ b/libc/sysdeps/unix/sysv/linux/x86_64/register-dump.h @@ -17,7 +17,7 @@ <http://www.gnu.org/licenses/>. */ #include <sys/uio.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* We will print the register dump in this format: |