Skip to content

Commit

Permalink
* sysdeps/unix/sysv/linux/i386/sysdep.h: Define PTR_MANGLE and
Browse files Browse the repository at this point in the history
	PTR_DEMANGLE for C code in libc.
	* sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise.
  • Loading branch information
Ulrich Drepper committed Dec 18, 2005
1 parent 827b708 commit 3467f5c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2005-12-18 Ulrich Drepper <drepper@redhat.com>

* sysdeps/unix/sysv/linux/i386/sysdep.h: Define PTR_MANGLE and
PTR_DEMANGLE for C code in libc.
* sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise.

2005-12-17 Ulrich Drepper <drepper@redhat.com>

* elf/Versions [GLIBC_PRIVATE]: Export __pointer_chk_guard if defined.
Expand Down
13 changes: 11 additions & 2 deletions sysdeps/unix/sysv/linux/i386/sysdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,17 @@ asm (".L__X'%ebx = 1\n\t"
earlier than the descriptor is initialized. Using a global variable
is too complicated here since we have no PC-relative addressing mode. */
#else
# define PTR_MANGLE(reg) xorl %gs:POINTER_GUARD, reg
# define PTR_DEMANGLE(reg) PTR_MANGLE (reg)
# ifdef __ASSEMBLER__
# define PTR_MANGLE(reg) xorl %gs:POINTER_GUARD, reg
# define PTR_DEMANGLE(reg) PTR_MANGLE (reg)
# else
# define PTR_MANGLE(var) asm ("xorl %%gs:%c2, %0" \
: "=r" (var) \
: "0" (var), \
"i" (offsetof (tcbhead_t, \
pointer_guard)))
# define PTR_DEMANGLE(var) PTR_MANGLE (var)
# endif
#endif

#endif /* linux/i386/sysdep.h */
21 changes: 17 additions & 4 deletions sysdeps/unix/sysv/linux/x86_64/sysdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,24 @@
#if defined NOT_IN_libc && defined IS_IN_rtld
/* We cannot use the thread descriptor because in ld.so we use setjmp
earlier than the descriptor is initialized. */
# define PTR_MANGLE(reg) xorq __pointer_chk_guard_local(%rip), reg
# define PTR_DEMANGLE(reg) PTR_MANGLE (reg)
# ifdef __ASSEMBLER__
# define PTR_MANGLE(reg) xorq __pointer_chk_guard_local(%rip), reg
# define PTR_DEMANGLE(reg) PTR_MANGLE (reg)
# else
# error "Define these if necessary"
# endif
#else
# define PTR_MANGLE(reg) xorq %fs:POINTER_GUARD, reg
# define PTR_DEMANGLE(reg) PTR_MANGLE (reg)
# ifdef __ASSEMBLER__
# define PTR_MANGLE(reg) xorq %fs:POINTER_GUARD, reg
# define PTR_DEMANGLE(reg) PTR_MANGLE (reg)
# else
# define PTR_MANGLE(var) asm ("xorq %%fs:%c2, %0" \
: "=r" (var) \
: "0" (var), \
"i" (offsetof (tcbhead_t, \
pointer_guard)))
# define PTR_DEMANGLE(var) PTR_MANGLE (var)
# endif
#endif

#endif /* linux/x86_64/sysdep.h */

0 comments on commit 3467f5c

Please sign in to comment.