* elf/dl-runtime.c (reloc_offset): Define.
(reloc_index): Define. (_dl_fixup): Rename reloc_offset parameter to reloc_arg. (_dl_fixup_profile): Likewise. Use reloc_index instead of computing index from reloc_offset. (_dl_call_pltexit): Likewise. * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_resolve): Just pass the relocation index to _dl_fixup. (_dl_runtime_profile): Likewise for _dl_fixup_profile and _dl_call_pltexit. * sysdeps/x86_64/dl-runtime.c: New file.
This commit is contained in:
parent
1f7c90a722
commit
a42ad61bae
12
ChangeLog
12
ChangeLog
|
@ -1,5 +1,17 @@
|
||||||
2009-03-14 Ulrich Drepper <drepper@redhat.com>
|
2009-03-14 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* elf/dl-runtime.c (reloc_offset): Define.
|
||||||
|
(reloc_index): Define.
|
||||||
|
(_dl_fixup): Rename reloc_offset parameter to reloc_arg.
|
||||||
|
(_dl_fixup_profile): Likewise. Use reloc_index instead of
|
||||||
|
computing index from reloc_offset.
|
||||||
|
(_dl_call_pltexit): Likewise.
|
||||||
|
* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_resolve): Just pass
|
||||||
|
the relocation index to _dl_fixup.
|
||||||
|
(_dl_runtime_profile): Likewise for _dl_fixup_profile and
|
||||||
|
_dl_call_pltexit.
|
||||||
|
* sysdeps/x86_64/dl-runtime.c: New file.
|
||||||
|
|
||||||
[BZ #9893]
|
[BZ #9893]
|
||||||
* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Fix
|
* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Fix
|
||||||
alignement of La_x86_64_regs. Store xmm parameters.
|
alignement of La_x86_64_regs. Store xmm parameters.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* On-demand PLT fixup for shared objects.
|
/* On-demand PLT fixup for shared objects.
|
||||||
Copyright (C) 1995-2006, 2007, 2008 Free Software Foundation, Inc.
|
Copyright (C) 1995-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
@ -46,6 +46,12 @@
|
||||||
# define ARCH_FIXUP_ATTRIBUTE
|
# define ARCH_FIXUP_ATTRIBUTE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef reloc_offset
|
||||||
|
# define reloc_offset reloc_arg
|
||||||
|
# define reloc_index reloc_arg / sizeof (PLTREL)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* This function is called through a special trampoline from the PLT the
|
/* This function is called through a special trampoline from the PLT the
|
||||||
first time each PLT entry is called. We must perform the relocation
|
first time each PLT entry is called. We must perform the relocation
|
||||||
|
@ -63,7 +69,7 @@ _dl_fixup (
|
||||||
# endif
|
# endif
|
||||||
/* GKM FIXME: Fix trampoline to pass bounds so we can do
|
/* GKM FIXME: Fix trampoline to pass bounds so we can do
|
||||||
without the `__unbounded' qualifier. */
|
without the `__unbounded' qualifier. */
|
||||||
struct link_map *__unbounded l, ElfW(Word) reloc_offset)
|
struct link_map *__unbounded l, ElfW(Word) reloc_arg)
|
||||||
{
|
{
|
||||||
const ElfW(Sym) *const symtab
|
const ElfW(Sym) *const symtab
|
||||||
= (const void *) D_PTR (l, l_info[DT_SYMTAB]);
|
= (const void *) D_PTR (l, l_info[DT_SYMTAB]);
|
||||||
|
@ -142,22 +148,20 @@ _dl_fixup (
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined PROF && !defined ELF_MACHINE_NO_PLT && !__BOUNDED_POINTERS__
|
#if !defined PROF && !defined ELF_MACHINE_NO_PLT && !__BOUNDED_POINTERS__
|
||||||
|
|
||||||
DL_FIXUP_VALUE_TYPE
|
DL_FIXUP_VALUE_TYPE
|
||||||
__attribute ((noinline)) ARCH_FIXUP_ATTRIBUTE
|
__attribute ((noinline)) ARCH_FIXUP_ATTRIBUTE
|
||||||
_dl_profile_fixup (
|
_dl_profile_fixup (
|
||||||
#ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
|
#ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
|
||||||
ELF_MACHINE_RUNTIME_FIXUP_ARGS,
|
ELF_MACHINE_RUNTIME_FIXUP_ARGS,
|
||||||
#endif
|
#endif
|
||||||
struct link_map *l, ElfW(Word) reloc_offset,
|
struct link_map *l, ElfW(Word) reloc_arg,
|
||||||
ElfW(Addr) retaddr, void *regs, long int *framesizep)
|
ElfW(Addr) retaddr, void *regs, long int *framesizep)
|
||||||
{
|
{
|
||||||
void (*mcount_fct) (ElfW(Addr), ElfW(Addr)) = INTUSE(_dl_mcount);
|
void (*mcount_fct) (ElfW(Addr), ElfW(Addr)) = INTUSE(_dl_mcount);
|
||||||
|
|
||||||
/* This is the address in the array where we store the result of previous
|
/* This is the address in the array where we store the result of previous
|
||||||
relocations. */
|
relocations. */
|
||||||
struct reloc_result *reloc_result
|
struct reloc_result *reloc_result = &l->l_reloc_result[reloc_index];
|
||||||
= &l->l_reloc_result[reloc_offset / sizeof (PLTREL)];
|
|
||||||
DL_FIXUP_VALUE_TYPE *resultp = &reloc_result->addr;
|
DL_FIXUP_VALUE_TYPE *resultp = &reloc_result->addr;
|
||||||
|
|
||||||
DL_FIXUP_VALUE_TYPE value = *resultp;
|
DL_FIXUP_VALUE_TYPE value = *resultp;
|
||||||
|
@ -415,7 +419,7 @@ _dl_profile_fixup (
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
void
|
void
|
||||||
ARCH_FIXUP_ATTRIBUTE
|
ARCH_FIXUP_ATTRIBUTE
|
||||||
_dl_call_pltexit (struct link_map *l, ElfW(Word) reloc_offset,
|
_dl_call_pltexit (struct link_map *l, ElfW(Word) reloc_arg,
|
||||||
const void *inregs, void *outregs)
|
const void *inregs, void *outregs)
|
||||||
{
|
{
|
||||||
#ifdef SHARED
|
#ifdef SHARED
|
||||||
|
@ -423,8 +427,7 @@ _dl_call_pltexit (struct link_map *l, ElfW(Word) reloc_offset,
|
||||||
relocations. */
|
relocations. */
|
||||||
// XXX Maybe the bound information must be stored on the stack since
|
// XXX Maybe the bound information must be stored on the stack since
|
||||||
// XXX with bind_not a new value could have been stored in the meantime.
|
// XXX with bind_not a new value could have been stored in the meantime.
|
||||||
struct reloc_result *reloc_result
|
struct reloc_result *reloc_result = &l->l_reloc_result[reloc_index];
|
||||||
= &l->l_reloc_result[reloc_offset / sizeof (PLTREL)];
|
|
||||||
ElfW(Sym) *defsym = ((ElfW(Sym) *) D_PTR (reloc_result->bound,
|
ElfW(Sym) *defsym = ((ElfW(Sym) *) D_PTR (reloc_result->bound,
|
||||||
l_info[DT_SYMTAB])
|
l_info[DT_SYMTAB])
|
||||||
+ reloc_result->boundndx);
|
+ reloc_result->boundndx);
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
/* The ABI calls for the PLT stubs to pass the index of the relocation
|
||||||
|
and not its offset. In _dl_profile_fixup and _dl_call_pltexit we
|
||||||
|
also use the index. Therefore it is wasteful to compute the offset
|
||||||
|
in the trampoline just to reverse the operation immediately
|
||||||
|
afterwards. */
|
||||||
|
#define reloc_offset reloc_arg * sizeof (PLTREL)
|
||||||
|
#define reloc_index reloc_arg
|
||||||
|
|
||||||
|
#include <elf/dl-runtime.c>
|
|
@ -35,10 +35,6 @@ _dl_runtime_resolve:
|
||||||
movq %r8, 40(%rsp)
|
movq %r8, 40(%rsp)
|
||||||
movq %r9, 48(%rsp)
|
movq %r9, 48(%rsp)
|
||||||
movq 64(%rsp), %rsi # Copy args pushed by PLT in register.
|
movq 64(%rsp), %rsi # Copy args pushed by PLT in register.
|
||||||
movq %rsi, %r11 # Multiply by 24
|
|
||||||
addq %r11, %rsi
|
|
||||||
addq %r11, %rsi
|
|
||||||
shlq $3, %rsi
|
|
||||||
movq 56(%rsp), %rdi # %rdi: link_map, %rsi: reloc_offset
|
movq 56(%rsp), %rdi # %rdi: link_map, %rsi: reloc_offset
|
||||||
call _dl_fixup # Call resolver.
|
call _dl_fixup # Call resolver.
|
||||||
movq %rax, %r11 # Save return value
|
movq %rax, %r11 # Save return value
|
||||||
|
@ -116,10 +112,6 @@ _dl_runtime_profile:
|
||||||
movq %rsp, %rcx # La_x86_64_regs pointer to %rcx.
|
movq %rsp, %rcx # La_x86_64_regs pointer to %rcx.
|
||||||
movq 48(%rbx), %rdx # Load return address if needed.
|
movq 48(%rbx), %rdx # Load return address if needed.
|
||||||
movq 40(%rbx), %rsi # Copy args pushed by PLT in register.
|
movq 40(%rbx), %rsi # Copy args pushed by PLT in register.
|
||||||
movq %rsi,%r11 # Multiply by 24.
|
|
||||||
addq %r11,%rsi
|
|
||||||
addq %r11,%rsi
|
|
||||||
shlq $3, %rsi
|
|
||||||
movq 32(%rbx), %rdi # %rdi: link_map, %rsi: reloc_offset
|
movq 32(%rbx), %rdi # %rdi: link_map, %rsi: reloc_offset
|
||||||
leaq 16(%rbx), %r8
|
leaq 16(%rbx), %r8
|
||||||
call _dl_profile_fixup # Call resolver.
|
call _dl_profile_fixup # Call resolver.
|
||||||
|
@ -204,10 +196,6 @@ _dl_runtime_profile:
|
||||||
|
|
||||||
movq 24(%rbx), %rdx # La_x86_64_regs argument to %rdx.
|
movq 24(%rbx), %rdx # La_x86_64_regs argument to %rdx.
|
||||||
movq 40(%rbx), %rsi # Copy args pushed by PLT in register.
|
movq 40(%rbx), %rsi # Copy args pushed by PLT in register.
|
||||||
movq %rsi,%r11 # Multiply by 24.
|
|
||||||
addq %r11,%rsi
|
|
||||||
addq %r11,%rsi
|
|
||||||
shlq $3, %rsi
|
|
||||||
movq 32(%rbx), %rdi # %rdi: link_map, %rsi: reloc_offset
|
movq 32(%rbx), %rdi # %rdi: link_map, %rsi: reloc_offset
|
||||||
call _dl_call_pltexit
|
call _dl_call_pltexit
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue