about summary refs log tree commit diff
path: root/elf/stackguard-macros.h
diff options
context:
space:
mode:
Diffstat (limited to 'elf/stackguard-macros.h')
-rw-r--r--elf/stackguard-macros.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/elf/stackguard-macros.h b/elf/stackguard-macros.h
index 97db8bc22a..8b85425e6a 100644
--- a/elf/stackguard-macros.h
+++ b/elf/stackguard-macros.h
@@ -4,8 +4,13 @@
 # define STACK_CHK_GUARD \
   ({ uintptr_t x; asm ("movl %%gs:0x14, %0" : "=r" (x)); x; })
 #elif defined __x86_64__
-# define STACK_CHK_GUARD \
+# ifdef __LP64__
+#  define STACK_CHK_GUARD \
   ({ uintptr_t x; asm ("movq %%fs:0x28, %0" : "=r" (x)); x; })
+# else
+#  define STACK_CHK_GUARD \
+  ({ uintptr_t x; asm ("movl %%fs:0x18, %0" : "=r" (x)); x; })
+# endif
 #elif defined __powerpc64__
 # define STACK_CHK_GUARD \
   ({ uintptr_t x; asm ("ld %0,-28688(13)" : "=r" (x)); x; })