Make x86-32 assembly compatible with LLVM's integrated assembler
The NaCl-specific assembly code was originally written/modified for x86-nacl
binutils. This CL makes it also compatible with LLVM's assembler.
* Don't rely on the special symbol NACLENTRYALIGN; instead use a #define
* Disambiguate a couple of instructions using operand size suffixes.
It's not actually necessary to build x86-32 target libraries using LLVM's
assembler, but it's nice to have, and LLVM's assembler generates better code
in a few cases.
R=jvoung@chromium.org
BUG=None
Review URL: https://codereview.chromium.org/961083002
diff --git a/newlib/libc/machine/i386/i386mach.h b/newlib/libc/machine/i386/i386mach.h
index 23c3219..4de35bb 100644
--- a/newlib/libc/machine/i386/i386mach.h
+++ b/newlib/libc/machine/i386/i386mach.h
@@ -12,6 +12,11 @@
#define __USER_LABEL_PREFIX__ _
#endif
+/* x86 nacl-gas has a builtin symbol NACLENTRYALIGN (which the .S files were
+ * written to use), but llvm's assembler does not. So use a define for
+ * compatibility with both. */
+#define NACLENTRYALIGN 5
+
#define __REG_PREFIX__ %
/* ANSI concatenation macros. */
diff --git a/newlib/libm/machine/i386/f_ldexp.S b/newlib/libm/machine/i386/f_ldexp.S
index d5b8952..748c97d 100644
--- a/newlib/libm/machine/i386/f_ldexp.S
+++ b/newlib/libm/machine/i386/f_ldexp.S
@@ -28,7 +28,7 @@
SYM (_f_ldexp):
pushl ebp
movl esp,ebp
- fild 16(ebp)
+ fildl 16(ebp)
fldl 8(ebp)
fscale
fstp st1
diff --git a/newlib/libm/machine/i386/f_ldexpf.S b/newlib/libm/machine/i386/f_ldexpf.S
index c1d2de6..2b26994 100644
--- a/newlib/libm/machine/i386/f_ldexpf.S
+++ b/newlib/libm/machine/i386/f_ldexpf.S
@@ -28,7 +28,7 @@
SYM (_f_ldexpf):
pushl ebp
movl esp,ebp
- fild 12(ebp)
+ fildl 12(ebp)
flds 8(ebp)
fscale
fstp st1
diff --git a/newlib/libm/machine/i386/i386mach.h b/newlib/libm/machine/i386/i386mach.h
index 23c3219..0a475c8 100644
--- a/newlib/libm/machine/i386/i386mach.h
+++ b/newlib/libm/machine/i386/i386mach.h
@@ -14,6 +14,10 @@
#define __REG_PREFIX__ %
+ /* x86 nacl-gas has a builtin symbol NACLENTRYALIGN (which the .S files were
+ * written to use), but llvm's assembler does not. So use a define for
+ * compatibility with both. */
+#define NACLENTRYALIGN 5
/* ANSI concatenation macros. */
#define CONCAT1(a, b) CONCAT2(a, b)