This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix build with compiler defining __i686 (bug 411)
On Fri, 3 Feb 2012, Roland McGrath wrote:
> > + ".ifndef "GET_PC_THUNK_STR(reg)";" \
>
> I think it's still our norm to put a space between a macro and its paren,
> even for this sort of case. I also tend towards spaces around the "s.
>
> It's also mostly our norm to use \n in the strings rather than ;,
> though that was not done here before. I think that's much preferable,
> as will anyone who ever tries to read a .s file produced from this.
I think I looked at the rest of sysdeps/i386/sysdep.h to try to identify a
norm for these macros, and found for example that ENTRY and END call a
series of other macros without spaces. But the file isn't consistent even
there, and this one is of course a macro for C code rather than assembly
source. I'm testing this patch using newlines and spaces in the new
macro (but still ; in the rest of the asm in check_consistency).
2012-02-04 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.
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__ */
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index 90660fd..efca634 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -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
--
Joseph S. Myers
joseph@codesourcery.com