[PATCH, moxie] Was: Moxie BSP Build Failure

Anthony Green green at moxielogic.com
Sat Jan 10 14:19:31 UTC 2015


Joel Sherrill <joel.sherrill at oarcorp.com> writes:

> Hi
>
> This is with the binutils and gcc heads.
>
> moxie-rtems4.11-gcc --pipe -B../../../../../.././lib/
> -B../../../../../.././moxiesim/lib/ -specs bsp_specs -qrtems
> -DHAVE_CONFIG_H   -isystem ../../../../../.././moxiesim/lib/include 
> -DASM -Os -g -ffunction-sections -fdata-sections -Wall
> -Wmissing-prototypes -Wimplicit-function-declaration -Wstrict-prototypes
> -Wnested-externs -MT start.o -MD -MP -MF .deps/start.Tpo -c -o start.o
> `test -f 'start/start.S' || echo
> '../../../../../../../../rtems/c/src/lib/libbsp/moxie/moxiesim/'`start/start.S
> ../../../../../../../../rtems/c/src/lib/libbsp/moxie/moxiesim/start/start.S:
> Assembler messages:
> ../../../../../../../../rtems/c/src/lib/libbsp/moxie/moxiesim/start/start.S:15:
> Error: unknown opcode sub.l $r2,$r0



Here's my patch to correct.  It tests for old gas syntax at configure
time and adjusts the use of sub/sub.l accordingly.

Thanks,

AG


diff --git a/c/src/lib/libbsp/moxie/moxiesim/configure.ac b/c/src/lib/libbsp/moxie/moxiesim/configure.ac
index e073b4b..ff87add 100644
--- a/c/src/lib/libbsp/moxie/moxiesim/configure.ac
+++ b/c/src/lib/libbsp/moxie/moxiesim/configure.ac
@@ -17,6 +17,19 @@ RTEMS_PROG_CCAS
 
 RTEMS_BSP_CLEANUP_OPTIONS(0, 0)
 
+AC_MSG_CHECKING([for old moxie assembly syntax])
+AC_COMPILE_IFELSE(
+  [AC_LANG_PROGRAM(
+    [],
+    [asm("sub.l $r0, $r0");])],
+  [HAVE_OLD_MOXIE_ASM=yes],
+  [HAVE_OLD_MOXIE_ASM=no])
+AC_MSG_RESULT([$HAVE_OLD_MOXIE_ASM])
+if test "x$HAVE_OLD_MOXIE_ASM" = xyes; then
+  AC_DEFINE(HAVE_OLD_MOXIE_ASM, 
+            1, [Define if you are using old moxie asm syntax (sub.l)])
+fi
+
 # Explicitly list all Makefiles here
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
diff --git a/c/src/lib/libbsp/moxie/moxiesim/start/start.S b/c/src/lib/libbsp/moxie/moxiesim/start/start.S
index 6b44a24..ae712cb 100644
--- a/c/src/lib/libbsp/moxie/moxiesim/start/start.S
+++ b/c/src/lib/libbsp/moxie/moxiesim/start/start.S
@@ -1,7 +1,13 @@
-/* Copyright (C) 2011, 2013  Anthony Green */
+/* Copyright (C) 2011, 2013, 2014  Anthony Green */
 
 /* moxie start up file. */
 
+#include "bspopts.h"
+
+#if defined(HAVE_OLD_MOXIE_ASM)
+#define sub sub.l
+#endif
+	
         .text
         .global _start
 _start:
@@ -12,7 +18,7 @@ _start:
         ldi.l   $r0, __bss_start__
         xor     $r1, $r1
         ldi.l   $r2, __bss_end__
-        sub.l   $r2, $r0
+        sub     $r2, $r0
         jsra    memset
 
         ldi.l   $r0, 0x0        # pass in NULL


More information about the devel mailing list