diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/i386/dl-machine.h | 28 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/dl-machine.h | 20 |
2 files changed, 46 insertions, 2 deletions
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 07c880a160..00b99957f3 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -168,35 +168,51 @@ static ElfW(Addr) profile_fixup (struct link_map *l, ElfW(Word) reloc_offset, .text\n\ .globl _dl_runtime_resolve\n\ .type _dl_runtime_resolve, @function\n\ + " CFI_STARTPROC "\n\ .align 16\n\ _dl_runtime_resolve:\n\ + " CFI_ADJUST_CFA_OFFSET (8) "\n\ pushl %eax # Preserve registers otherwise clobbered.\n\ + " CFI_ADJUST_CFA_OFFSET (4) "\n\ pushl %ecx\n\ + " CFI_ADJUST_CFA_OFFSET (4) "\n\ pushl %edx\n\ + " CFI_ADJUST_CFA_OFFSET (4) "\n\ movl 16(%esp), %edx # Copy args pushed by PLT in register. Note\n\ movl 12(%esp), %eax # that `fixup' takes its parameters in regs.\n\ call fixup # Call resolver.\n\ popl %edx # Get register content back.\n\ + " CFI_ADJUST_CFA_OFFSET (-4) "\n\ popl %ecx\n\ + " CFI_ADJUST_CFA_OFFSET (-4) "\n\ xchgl %eax, (%esp) # Get %eax contents end store function address.\n\ ret $8 # Jump to function address.\n\ + " CFI_ENDPROC "\n\ .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\ \n\ .globl _dl_runtime_profile\n\ .type _dl_runtime_profile, @function\n\ + " CFI_STARTPROC "\n\ .align 16\n\ _dl_runtime_profile:\n\ + " CFI_ADJUST_CFA_OFFSET (8) "\n\ pushl %eax # Preserve registers otherwise clobbered.\n\ + " CFI_ADJUST_CFA_OFFSET (4) "\n\ pushl %ecx\n\ + " CFI_ADJUST_CFA_OFFSET (4) "\n\ pushl %edx\n\ + " CFI_ADJUST_CFA_OFFSET (4) "\n\ movl 20(%esp), %ecx # Load return address\n\ movl 16(%esp), %edx # Copy args pushed by PLT in register. Note\n\ movl 12(%esp), %eax # that `fixup' takes its parameters in regs.\n\ call profile_fixup # Call resolver.\n\ popl %edx # Get register content back.\n\ + " CFI_ADJUST_CFA_OFFSET (-4) "\n\ popl %ecx\n\ + " CFI_ADJUST_CFA_OFFSET (-4) "\n\ xchgl %eax, (%esp) # Get %eax contents end store function address.\n\ ret $8 # Jump to function address.\n\ + " CFI_ENDPROC "\n\ .size _dl_runtime_profile, .-_dl_runtime_profile\n\ .previous\n\ "); @@ -207,23 +223,35 @@ _dl_runtime_profile:\n\ .globl _dl_runtime_profile\n\ .type _dl_runtime_resolve, @function\n\ .type _dl_runtime_profile, @function\n\ + " CFI_STARTPROC "\n\ .align 16\n\ _dl_runtime_resolve:\n\ _dl_runtime_profile:\n\ + " CFI_ADJUST_CFA_OFFSET (8) "\n\ pushl %eax # Preserve registers otherwise clobbered.\n\ + " CFI_ADJUST_CFA_OFFSET (4) "\n\ pushl %ecx\n\ + " CFI_ADJUST_CFA_OFFSET (4) "\n\ pushl %edx\n\ + " CFI_ADJUST_CFA_OFFSET (4) "\n\ movl 16(%esp), %edx # Push the arguments for `fixup'\n\ movl 12(%esp), %eax\n\ pushl %edx\n\ + " CFI_ADJUST_CFA_OFFSET (4) "\n\ pushl %eax\n\ + " CFI_ADJUST_CFA_OFFSET (4) "\n\ call fixup # Call resolver.\n\ popl %edx # Pop the parameters\n\ + " CFI_ADJUST_CFA_OFFSET (-4) "\n\ popl %ecx\n\ + " CFI_ADJUST_CFA_OFFSET (-4) "\n\ popl %edx # Get register content back.\n\ + " CFI_ADJUST_CFA_OFFSET (-4) "\n\ popl %ecx\n\ + " CFI_ADJUST_CFA_OFFSET (-4) "\n\ xchgl %eax, (%esp) # Get %eax contents end store function address.\n\ ret $8 # Jump to function address.\n\ + " CFI_ENDPROC "\n\ .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\ .size _dl_runtime_profile, .-_dl_runtime_profile\n\ .previous\n\ diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h index 1922d2a01a..d13649c22f 100644 --- a/sysdeps/powerpc/powerpc64/dl-machine.h +++ b/sysdeps/powerpc/powerpc64/dl-machine.h @@ -506,6 +506,21 @@ elf_machine_fixup_plt (struct link_map *map, lookup_t sym_map, return finaladdr; } +static inline void +elf_machine_plt_conflict (Elf64_Addr *reloc_addr, Elf64_Addr finaladdr) +{ + Elf64_FuncDesc *plt = (Elf64_FuncDesc *) reloc_addr; + Elf64_FuncDesc *rel = (Elf64_FuncDesc *) finaladdr; + + plt->fd_func = rel->fd_func; + plt->fd_aux = rel->fd_aux; + plt->fd_toc = rel->fd_toc; + PPC_DCBST (&plt->fd_func); + PPC_DCBST (&plt->fd_aux); + PPC_DCBST (&plt->fd_toc); + PPC_SYNC; +} + /* Return the final value of a plt relocation. */ static inline Elf64_Addr elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc, @@ -603,9 +618,10 @@ elf_machine_rela (struct link_map *map, case R_PPC64_JMP_SLOT: #ifdef RESOLVE_CONFLICT_FIND_MAP - RESOLVE_CONFLICT_FIND_MAP (map, reloc_addr); -#endif + elf_machine_plt_conflict (reloc_addr, value); +#else elf_machine_fixup_plt (map, sym_map, reloc, reloc_addr, value); +#endif return; #if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) |