AS, patch to add RISC OS filename support

Timothy Baldwin T.E.Baldwin99 at members.leeds.ac.uk
Fri Aug 16 17:07:49 PDT 2002


Here is a patch to add RISC OS filename support to AS under unix, as required 
by some RISC OS source code, including anything which uses OSLib. I have 
added support the the extensions "Hdr", which is used by OSLib and "asm", 
which I have seen used for assembler source code.

After applying this patch copy gccsdk/gcc/gcc/config/arm/rname.c to 
gccsdk/riscos-aof/as/rname.c

diff -burN gccsdk-old/gcc/gcc/config/arm/rname.c 
gccsdk2/gcc/gcc/config/arm/rname.c
--- gccsdk-old/gcc/gcc/config/arm/rname.c	Wed Jul 31 19:52:36 2002
+++ gccsdk2/gcc/gcc/config/arm/rname.c	Fri Aug 16 16:23:49 2002
@@ -9,7 +9,7 @@
    from the function.  The user must have previously declared
    a suitably sized buffer for the Unix format filename.

-   Last modified: 02 April 2002 <nick at dsvr.net>  */
+   Last modified: 16 August 2002 <T.E.Baldwin99 at memebers.leeds.ac.uk>  */

 /* The master file resides at gccsdk/gcc/gcc/config/arm/rname.c */

@@ -25,8 +25,8 @@

 static const char *prefixes[] =
 {
-  "f", "for", "fpp", "p", "pas", "ph", "gpi",
-  "cc", "cxx", "cpp", "c++", "c", "m", "rpo",
+  "f", "for", "fpp", "p", "pas", "ph", "gpi", "asm",
+  "cc", "cxx", "cpp", "c++", "c", "m", "rpo", "Hdr",
   "i", "ii", "icc", "h", "hh", "s", "l", "o", "y",
   "ads", "adb", "ada", "ali", "adc", "xrb", "xrs", 0
 };
@@ -96,6 +96,7 @@
 	  break;
 	case '%':
 	  /* The library directory.  In Unix this is '/lib'.  */
+	  /* Oh no it isn't, <something>/bin is! - TEB */
 	  *o++ = '/';
 	  *o++ = 'l';
 	  *o++ = 'i';
diff -burN gccsdk-old/riscos-aof/as/Makefile gccsdk2/riscos-aof/as/Makefile
--- gccsdk-old/riscos-aof/as/Makefile	Sat Aug 10 18:01:37 2002
+++ gccsdk2/riscos-aof/as/Makefile	Fri Aug 16 13:50:35 2002
@@ -66,6 +66,9 @@
 	$(asobjdir)/strdup.o \
 	$(asobjdir)/targetcpu.o

+ifeq (${STAGE},stage1)
+	OBJS +=	$(asobjdir)/rname.o $(asobjdir)/rname2.o
+endif
 ifeq (${STAGE},stage2)
 	OBJS += $(asobjdir)/os.o
 	DEPS += $(gcc_bin_dir)/$(TRG)/o/unixlib
@@ -115,6 +118,8 @@
 $(asobjdir)/lexAcorn.o: lexAcorn.c
 $(asobjdir)/lit.o: lit.c
 $(asobjdir)/uname.o: uname.c
+$(asobjdir)/rname2.o: rname.c
+$(asobjdir)/rname.o: rname.c
 $(asobjdir)/os.o: os.s
 $(asobjdir)/macros.o: macros.c
 $(asobjdir)/variables.o: variables.c
@@ -253,6 +258,10 @@
  targetcpu.c targetcpu.h global.h error.h
 $(asobjdir)/uname.o:  \
  uname.c
+$(asobjdir)/rname.o:  \
+ rname.c
+$(asobjdir)/rname2.o:  \
+ rname2.c rname.h
 $(asobjdir)/value.o:  \
  value.c ../../sdk-config.h value.h global.h code.h lex.h symbol.h \
   reloc.h error.h
diff -burN gccsdk-old/riscos-aof/as/include.c gccsdk2/riscos-aof/as/include.c
--- gccsdk-old/riscos-aof/as/include.c	Sat Aug 10 18:01:44 2002
+++ gccsdk2/riscos-aof/as/include.c	Fri Aug  9 23:53:37 2002
@@ -15,6 +15,7 @@

 #include "include.h"
 #include "uname.h"
+#include "rname.h"

 extern int dde;
 
@@ -80,8 +81,10 @@
   FILE *fp;
 #endif
   char incpath[MAXPATHLEN];
-#if defined (UNIXLIB) || defined (CROSS_COMPILE)
+#if defined (UNIXLIB)
   char *file = (char *) filename;
+#elif defined (CROSS_COMPILE)
+  char *file = rname (filename);
 #else
   char *file = uname (filename, dde);
 #endif
diff -burN gccsdk-old/riscos-aof/as/rname.h gccsdk2/riscos-aof/as/rname.h
--- gccsdk-old/riscos-aof/as/rname.h	Thu Jan  1 01:00:00 1970
+++ gccsdk2/riscos-aof/as/rname.h	Fri Aug 16 13:55:09 2002
@@ -0,0 +1,4 @@
+/* rname.h by Timothy Baldwin 2002 */
+
+extern char *rname(const char *name);
+extern char *riscos_to_unix (const char *, char *);
diff -burN gccsdk-old/riscos-aof/as/rname2.c gccsdk2/riscos-aof/as/rname2.c
--- gccsdk-old/riscos-aof/as/rname2.c	Thu Jan  1 01:00:00 1970
+++ gccsdk2/riscos-aof/as/rname2.c	Fri Aug 16 14:02:09 2002
@@ -0,0 +1,7 @@
+#include "rname.h"
+
+static char rname_buffer[1024];
+
+char *rname(const char *name) {
+  return riscos_to_unix(name, rname_buffer);
+}

-- 
Timothy Baldwin
Member WYLUG, SWP, ANL, Leeds SA, Leeds Anti-war coalition
Stop the EU Copyright Directive!



More information about the gcc mailing list