diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/i386/__longjmp.S | 12 | ||||
-rw-r--r-- | sysdeps/i386/dl-machine.h | 2 | ||||
-rw-r--r-- | sysdeps/i386/setjmp.S | 29 |
3 files changed, 28 insertions, 15 deletions
diff --git a/sysdeps/i386/__longjmp.S b/sysdeps/i386/__longjmp.S index f546622828..77916cdc38 100644 --- a/sysdeps/i386/__longjmp.S +++ b/sysdeps/i386/__longjmp.S @@ -25,11 +25,11 @@ ENTRY (__longjmp) movl 4(%esp), %ecx /* User's jmp_buf in %ecx. */ movl 8(%esp), %eax /* Second argument is return value. */ /* Restore registers. */ - movl JB_BX(%ecx), %ebx - movl JB_SI(%ecx), %esi - movl JB_DI(%ecx), %edi - movl JB_BP(%ecx), %ebp - movl JB_SP(%ecx), %esp + movl (JB_BX*4)(%ecx), %ebx + movl (JB_SI*4)(%ecx), %esi + movl (JB_DI*4)(%ecx), %edi + movl (JB_BP*4)(%ecx), %ebp + movl (JB_SP*4)(%ecx), %esp /* Jump to saved PC. */ - movl JB_PC(%ecx), %ecx + movl (JB_PC*4)(%ecx), %ecx jmp *%ecx diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index d509e08b6f..800c2d7b68 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -65,7 +65,7 @@ elf_machine_load_address (void) This will be the first relocation in the text of the dynamic linker; we skip it to avoid trying to modify read-only text in this early stage. */ #define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \ - ++(const Elf32_Rel *) (dynamic_info)[DT_REL]->d_un.d_ptr; + ++(const Elf32_Rel *) (dynamic_info)[DT_REL]->d_un.d_ptr; \ (dynamic_info)[DT_RELSZ]->d_un.d_val -= sizeof (Elf32_Rel); /* Perform the relocation specified by RELOC and SYM (which is fully resolved). diff --git a/sysdeps/i386/setjmp.S b/sysdeps/i386/setjmp.S index a07d6f1137..ccb7147606 100644 --- a/sysdeps/i386/setjmp.S +++ b/sysdeps/i386/setjmp.S @@ -24,13 +24,26 @@ Cambridge, MA 02139, USA. */ ENTRY (__sigsetjmp) movl 4(%esp), %eax /* User's jmp_buf in %eax. */ /* Save registers. */ - movl %ebx, JB_BX(%eax) - movl %esi, JB_SI(%eax) - movl %edi, JB_DI(%eax) - movl %ebp, JB_BP(%eax) + movl %ebx, (JB_BX*4)(%eax) + movl %esi, (JB_SI*4)(%eax) + movl %edi, (JB_DI*4)(%eax) + movl %ebp, (JB_BP*4)(%eax) leal 4(%esp), %ecx /* Save SP as it will be after we return. */ - movl %ecx, JB_SP(%eax) + movl %ecx, (JB_SP*4)(%eax) movl 0(%esp), %ecx /* Save PC we are returning to now. */ - movl %ecx, JB_PC(%eax) - xorl %eax, %eax /* Return zero. */ - ret + movl %ecx, (JB_PC*4)(%eax) + + /* Make a tail call to __sigjmp_save; it takes the same args. */ +#ifdef PIC + /* We cannot use the PLT, because it requires that %ebx be set, but + we can't save and restore our caller's value. Instead, we do an + indirect jump through the GOT, using for the temporary register + %ecx, which is call-clobbered. */ + call here +here: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-here], %ecx + movl C_SYMBOL_NAME(__sigjmp_save@GOT)(%ecx), %ecx + jmp *%ecx +#else + jmp __sigjmp_save +#endif |