From 9fb1a21f4d33c4c82719d6130e149eb2c5a51ae8 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 11 May 2012 16:31:34 -0700 Subject: [PATCH] Add x32 support to STACK_CHK_GUARD --- ChangeLog | 5 +++++ elf/stackguard-macros.h | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9d8a7136c3..0c4a814167 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-05-11 H.J. Lu + + * elf/stackguard-macros.h (STACK_CHK_GUARD) [__x86_64__]: Use + "%c1" with "i" (offsetof (tcbhead_t, stack_guard)). + 2012-05-11 H.J. Lu * elf/tls-macros.h (TLS_LE): Use mov instead of movq to load diff --git a/elf/stackguard-macros.h b/elf/stackguard-macros.h index a9889cf7b2..0cad31550c 100644 --- a/elf/stackguard-macros.h +++ b/elf/stackguard-macros.h @@ -5,7 +5,9 @@ ({ 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; }) + ({ uintptr_t x; \ + asm ("mov %%fs:%c1, %0" : "=r" (x) \ + : "i" (offsetof (tcbhead_t, stack_guard))); x; }) #elif defined __powerpc64__ # define STACK_CHK_GUARD \ ({ uintptr_t x; asm ("ld %0,-28688(13)" : "=r" (x)); x; })