]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Use macro for PIC setup in inline asm.
authorJoseph Myers <joseph@codesourcery.com>
Sun, 5 Feb 2012 14:34:14 +0000 (14:34 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Sun, 5 Feb 2012 14:34:14 +0000 (14:34 +0000)
ChangeLog
sysdeps/i386/sysdep.h
sysdeps/unix/sysv/linux/i386/sysdep.h

index 22d6682dbdccc423cfcc3ac4d78f739d9c6d1719..1925407e9b7ce5e193f7e0ec6d3085bae0dd3b96 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-02-05  Joseph Myers  <joseph@codesourcery.com>
+
+       * sysdeps/i386/sysdep.h (SETUP_PIC_REG_STR, LOAD_PIC_REG_STR):
+       Define.
+       * sysdeps/unix/sysv/linux/i386/sysdep.h (check_consistency): Use
+       LOAD_PIC_REG_STR.
+
 2012-02-03  Joseph Myers  <joseph@codesourcery.com>
 
        * sysdeps/i386/sysdep.h (GET_PC_THUNK, GET_PC_THUNK_STR): Define.
index a31f5e772669a8cbfeeec2bce06ad3cf940923d5..2c0aafa75bef0329d95d473cbf81b52e13f69be5 100644 (file)
@@ -156,4 +156,24 @@ GET_PC_THUNK(reg):                                                       \
 
 #define atom_text_section .section ".text.atom", "ax"
 
+#else /* __ASSEMBLER__ */
+
+# define SETUP_PIC_REG_STR(reg)                                                \
+  ".ifndef " GET_PC_THUNK_STR (reg) "\n"                               \
+  ".section .gnu.linkonce.t." GET_PC_THUNK_STR (reg) ",\"ax\",@progbits\n" \
+  ".globl " GET_PC_THUNK_STR (reg) "\n"                                        \
+  ".hidden " GET_PC_THUNK_STR (reg) "\n"                               \
+  ".p2align 4\n"                                                       \
+  ".type " GET_PC_THUNK_STR (reg) ",@function\n"                       \
+GET_PC_THUNK_STR (reg) ":"                                             \
+  "movl (%%esp), %%e" #reg "\n"                                                \
+  "ret\n"                                                              \
+  ".size " GET_PC_THUNK_STR (reg) ", . - " GET_PC_THUNK_STR (reg) "\n" \
+  ".previous\n"                                                                \
+  ".endif\n"                                                           \
+  "call " GET_PC_THUNK_STR (reg)
+
+# define LOAD_PIC_REG_STR(reg) \
+  SETUP_PIC_REG_STR (reg) "\naddl $_GLOBAL_OFFSET_TABLE_, %%e" #reg
+
 #endif /* __ASSEMBLER__ */
index 90660fdde74fe50e39e6d34c34575df7c1806b65..1dded7a7eb99836abd4f2dbbe436bca4384c866c 100644 (file)
@@ -514,20 +514,11 @@ asm (".L__X'%ebx = 1\n\t"
 # define check_consistency()                                                 \
   ({ int __res;                                                                      \
      __asm__ __volatile__                                                    \
-       ("call "GET_PC_THUNK_STR(cx)";"                                       \
-       "addl $_GLOBAL_OFFSET_TABLE_, %%ecx;"                                 \
+       (LOAD_PIC_REG_STR (cx) ";"                                            \
        "subl %%ebx, %%ecx;"                                                  \
        "je 1f;"                                                              \
        "ud2;"                                                                \
        "1:\n"                                                                \
-       ".section .gnu.linkonce.t."GET_PC_THUNK_STR(cx)",\"ax\",@progbits;"   \
-       ".globl "GET_PC_THUNK_STR(cx)";"                                      \
-       ".hidden "GET_PC_THUNK_STR(cx)";"                                     \
-       ".type "GET_PC_THUNK_STR(cx)",@function;"                             \
-       GET_PC_THUNK_STR(cx)":"                                               \
-       "movl (%%esp), %%ecx;"                                                \
-       "ret;"                                                                \
-       ".previous"                                                           \
        : "=c" (__res));                                                      \
      __res; })
 #endif