aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/i386/sysdep.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-02-05 14:34:14 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-02-05 14:34:14 +0000
commitd8e0ca509a83e832123f6ab508fce620159fb2dc (patch)
treeec8f395a1d980e9fde309174980190102f139121 /sysdeps/i386/sysdep.h
parentb1da7dd99dcffe28d02a6515a9dc8cca3205a497 (diff)
downloadglibc-d8e0ca509a83e832123f6ab508fce620159fb2dc.zip
glibc-d8e0ca509a83e832123f6ab508fce620159fb2dc.tar.gz
glibc-d8e0ca509a83e832123f6ab508fce620159fb2dc.tar.bz2
Use macro for PIC setup in inline asm.
Diffstat (limited to 'sysdeps/i386/sysdep.h')
-rw-r--r--sysdeps/i386/sysdep.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/sysdeps/i386/sysdep.h b/sysdeps/i386/sysdep.h
index a31f5e7..2c0aafa 100644
--- a/sysdeps/i386/sysdep.h
+++ b/sysdeps/i386/sysdep.h
@@ -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__ */