gprolog 1.3.0 porting problems on Solaris 8 sparc (32-bit)

Paul Eggert <[email protected]>
Newsgroups gmane.comp.gnu.prolog.bugs
Message-ID <[email protected]>
Here's a proposed patch to gprolog 1.3.0.

2007-02-02  Paul Eggert  <[email protected]>

	Work around the minor problems I had with building and checking
	gprolog 1.3.0 on Solaris 8 (sparc) with GCC 4.1.1 and the Solaris
	assembler /usr/ccs/bin/as.

	* EnginePl/Makefile.in (test_oc@EXE_SUFFIX@): Rewrite to avoid
	"echo -e", which is not portable according to POSIX and does not
	work with Solaris /bin/sh.

	* Ma2Asm/chkma.c (main): Don't complain about FAST being defined
	unless it actually is defined.

	* Ma2Asm/sparc_any.c (Dico_String_Start, Data_Start):
	Properly quote .section names.

--- EnginePl/Makefile.in~	2007-01-04 02:21:49.000000000 -0800
+++ EnginePl/Makefile.in	2007-02-02 15:15:51.079794000 -0800
@@ -114,7 +114,10 @@ clean-check: clean-test_oc
 TEST_OC_SRC=obj_chain.c test_oc.c
 
 test_oc@EXE_SUFFIX@: obj_chain.c obj_chain.h test_oc.c test_oc_defs.h
-	for i in 1 2 3 4 5; do echo -e "#define OBJ_NO $$i\\n#include \"test_oc_defs.h\"" >/tmp/test_oc_m$$i.c; done
+	for i in 1 2 3 4 5; do \
+	  (echo "#define OBJ_NO $$i" && \
+	   echo "#include \"test_oc_defs.h\"") >/tmp/test_oc_m$$i.c || exit; \
+	done
 	$(CC) $(CFLAGS) @CC_EXE_NAME_OPT@test_oc@EXE_SUFFIX@ test_oc.c obj_chain.c -I. /tmp/test_oc_m[1-5].c
 	rm -f /tmp/test_oc_m[1-5].c
 
--- Ma2Asm/chkma.c~	2007-01-04 02:35:14.000000000 -0800
+++ Ma2Asm/chkma.c	2007-02-02 15:38:52.427285200 -0800
@@ -229,7 +229,9 @@ main(int argc, char *argv[])
 
 #elif !defined(FC_USED_TO_COMPILE_CORE)
 
+#ifdef FAST
 #error FAST defined but cannot compile for FC
+#endif
 
 #else
 
--- Ma2Asm/sparc_any.c~	2007-01-04 02:35:14.000000000 -0800
+++ Ma2Asm/sparc_any.c	2007-02-02 15:10:37.337205000 -0800
@@ -843,7 +843,7 @@ C_Ret(void)
 void
 Dico_String_Start(int nb_consts)
 {
-  Inst_Printf(".section", ".rodata");
+  Inst_Printf(".section", "\".rodata\"");
 }
 
 
@@ -961,7 +961,7 @@ Data_Start(char *initializer_fct)
   if (initializer_fct == NULL)
     return;
 
-  Inst_Printf(".section", ".ctors,#alloc,#write");
+  Inst_Printf(".section", "\".ctors\",#alloc,#write");
   Inst_Printf(".align", "4");
   Inst_Printf(".long", UN "%s", initializer_fct);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.