Somewhere down the line the ARM people made some subtle changes to
their assembly syntax.  The new syntax is called Unified Assembler
Language (UAL), and tis is what clang supports.  But gas defaults to
the old pre-UAL dialect.  The easiest way to make code compile with
both clang and gcc is to tell gas to switch into UAL mode.  The
following diff does this for the one file in libc where it matters.
The resulting binary code is identical.

ok?


Index: lib/libc/arch/arm/string/ffs.S
===================================================================
RCS file: /cvs/src/lib/libc/arch/arm/string/ffs.S,v
retrieving revision 1.5
diff -u -p -r1.5 ffs.S
--- lib/libc/arch/arm/string/ffs.S      6 Aug 2016 19:16:09 -0000       1.5
+++ lib/libc/arch/arm/string/ffs.S      18 Sep 2016 09:53:30 -0000
@@ -44,6 +44,8 @@
  * 16 Feb 1994.
  */
 
+       .syntax unified
+
 ENTRY(ffs)
        /* Standard trick to isolate bottom bit in r0 or 0 if r0 = 0 on entry */
        rsb     r1, r0, #0
@@ -58,7 +60,7 @@ ENTRY(ffs)
        rsbne   r0, r0, r0, lsl #16 /* r0 = X * 0x0450fbaf */
               
        /* now lookup in table indexed on top 6 bits of r0 */
-       ldrneb  r0, [ r2, r0, lsr #26 ]
+       ldrbne  r0, [ r2, r0, lsr #26 ]
 
         mov   pc, lr
 END_WEAK(ffs)

Reply via email to