This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: patch for x86_64 building


On Feb 22 11:20, Mike Stump wrote:
> So, I was trying to build newlib natively on linux, I know weird, but there it is...  and I noticed I needed the below patch to prevent the build from failing.  Someone decided to build the -m32 variant for a multilib, and compile the x86_64 code with -m32.  That just isn't ever going to work.  This patch avoids building the x86_64 assembly code in non-x86_64 multilib compiles.
> 
> 2012-02-22  Mike Stump  <mikestump@comcast.net>
> 
> 	* libc/machine/x86_64/memcpy.S: Don't build for -m32.
> 	* libc/machine/x86_64/setjmp.S: Likewise.
> 	* libc/machine/x86_64/memset.S: Likewise.
> 
> With this, I can build everything.

If you do this, what happens to the setjmp, memcpy, and memset
implementations in the -m32 multilib?  For memcpy and memset
it will fall back to the generic imlementation, but there is
none for setjmp.  Shouldn't the code rather fall back to the i386
implementation instead?  Like this?

Index: memcpy.S
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/x86_64/memcpy.S,v
retrieving revision 1.2
diff -u -p -r1.2 memcpy.S
--- memcpy.S	5 Feb 2009 20:10:21 -0000	1.2
+++ memcpy.S	23 Feb 2012 09:07:04 -0000
@@ -8,6 +8,10 @@
  * ====================================================
  */
 
+#ifndef __x86_64__
+  /* Fall back to i386 implementation if __x86_64__ is not defined. */
+  #include "../i386/memcpy.S"
+#else /* __x86_64__ */
   #include "x86_64mach.h"
 
   .global SYM (memcpy)
@@ -111,3 +115,4 @@ quadword_copy:
   andq    $7, rcx
   rep     movsb                   /* Copy the remaining bytes */
   ret
+#endif /* __x86_64__ */


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]