Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
glibc/elf/stackguard-macros.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
30 lines (29 sloc)
1.06 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#ifdef __i386__ | |
# define STACK_CHK_GUARD \ | |
({ uintptr_t x; asm ("movl %%gs:0x14, %0" : "=r" (x)); x; }) | |
#elif defined __x86_64__ | |
# define STACK_CHK_GUARD \ | |
({ uintptr_t x; asm ("movq %%fs:0x28, %0" : "=r" (x)); x; }) | |
#elif defined __powerpc64__ | |
# define STACK_CHK_GUARD \ | |
({ uintptr_t x; asm ("ld %0,-28688(13)" : "=r" (x)); x; }) | |
#elif defined __powerpc__ | |
# define STACK_CHK_GUARD \ | |
({ uintptr_t x; asm ("lwz %0,-28680(2)" : "=r" (x)); x; }) | |
#elif defined __sparc__ && defined __arch64__ | |
# define STACK_CHK_GUARD \ | |
({ uintptr_t x; asm ("ldx [%%g7+0x28], %0" : "=r" (x)); x; }) | |
#elif defined __sparc__ | |
# define STACK_CHK_GUARD \ | |
({ uintptr_t x; asm ("ld [%%g7+0x14], %0" : "=r" (x)); x; }) | |
#elif defined __s390x__ | |
# define STACK_CHK_GUARD \ | |
({ uintptr_t x; asm ("ear %0,%a0; sllg %0,%0,32; ear %0,%a1; lg %0,0x28(%0)" : "=r" (x)); x; }) | |
#elif defined __s390__ | |
# define STACK_CHK_GUARD \ | |
({ uintptr_t x; asm ("ear %0,%%a0; l %0,0x14(%0)" : "=r" (x)); x; }) | |
#else | |
extern uintptr_t __stack_chk_guard; | |
# define STACK_CHK_GUARD __stack_chk_guard | |
#endif |