Kurt Lidl
2012-06-25 17:31:43 UTC
Here's a couple of diffs that allow the current CVS
version of pcc to configure and compile on sparc64/freebsd.
It almost generates working code. There's some grot at
the head of the assembly prolog:
.section .rodata
.type Hello World!\012,#object
.size Hello World!\012,14
L220:
If I comment out the emitted ".type" and ".size" lines in
the .s file, I can then link the resulting .s file into
a working binary. (Only tried on a 'hello world' type
program.)
I haven't tried digger further yet, but here's the first patch.
-Kurt
diff -r fc2815c71e10 configure.ac
--- a/configure.ac Fri Jun 22 07:03:58 2012 +0000
+++ b/configure.ac Fri Jun 22 16:04:33 2012 -0400
@@ -80,6 +80,7 @@
esac
case "$target_cpu" in
i386) targmach=i386 ;;
+ sparc64) targmach=sparc64 endian=big ;;
x86_64) targmach=amd64 ;;
esac
;;
diff -r fc2815c71e10 os/freebsd/ccconfig.h
--- a/os/freebsd/ccconfig.h Fri Jun 22 07:03:58 2012 +0000
+++ b/os/freebsd/ccconfig.h Fri Jun 22 16:04:33 2012 -0400
@@ -41,7 +41,7 @@
#define ENDFILES { LIBDIR "crtend.o", LIBDIR "crtn.o", NULL }
#define STARTFILES_S { LIBDIR "crti.o", LIBDIR "crtbeginS.o", NULL }
#define ENDFILES_S { LIBDIR "crtendS.o", LIBDIR "crtn.o", NULL }
-#define LIBCLIBS { "-lc", "-lpcc", NULL }
+#define LIBCLIBS { "-lc", /* "-lpcc", */ NULL }
#define STARTLABEL "_start"
/* host-independent */
@@ -53,6 +53,10 @@
#define CPPMDADD \
{ "-D__x86_64__", "-D__x86_64", "-D__amd64__", "-D__amd64", \
"-D__LP64__=1", "-D_LP64=1", NULL, }
+#elif defined(mach_sparc64)
+#define CPPMDADD \
+ { "-D__sparc64__", "-D__sparc_v9__", "-D__sparc__", "-D__sparc",\
+ "-D__LP64__=1", "-D_LP64=1", NULL, }
#else
#error defines for arch missing
#endif
version of pcc to configure and compile on sparc64/freebsd.
It almost generates working code. There's some grot at
the head of the assembly prolog:
.section .rodata
.type Hello World!\012,#object
.size Hello World!\012,14
L220:
If I comment out the emitted ".type" and ".size" lines in
the .s file, I can then link the resulting .s file into
a working binary. (Only tried on a 'hello world' type
program.)
I haven't tried digger further yet, but here's the first patch.
-Kurt
diff -r fc2815c71e10 configure.ac
--- a/configure.ac Fri Jun 22 07:03:58 2012 +0000
+++ b/configure.ac Fri Jun 22 16:04:33 2012 -0400
@@ -80,6 +80,7 @@
esac
case "$target_cpu" in
i386) targmach=i386 ;;
+ sparc64) targmach=sparc64 endian=big ;;
x86_64) targmach=amd64 ;;
esac
;;
diff -r fc2815c71e10 os/freebsd/ccconfig.h
--- a/os/freebsd/ccconfig.h Fri Jun 22 07:03:58 2012 +0000
+++ b/os/freebsd/ccconfig.h Fri Jun 22 16:04:33 2012 -0400
@@ -41,7 +41,7 @@
#define ENDFILES { LIBDIR "crtend.o", LIBDIR "crtn.o", NULL }
#define STARTFILES_S { LIBDIR "crti.o", LIBDIR "crtbeginS.o", NULL }
#define ENDFILES_S { LIBDIR "crtendS.o", LIBDIR "crtn.o", NULL }
-#define LIBCLIBS { "-lc", "-lpcc", NULL }
+#define LIBCLIBS { "-lc", /* "-lpcc", */ NULL }
#define STARTLABEL "_start"
/* host-independent */
@@ -53,6 +53,10 @@
#define CPPMDADD \
{ "-D__x86_64__", "-D__x86_64", "-D__amd64__", "-D__amd64", \
"-D__LP64__=1", "-D_LP64=1", NULL, }
+#elif defined(mach_sparc64)
+#define CPPMDADD \
+ { "-D__sparc64__", "-D__sparc_v9__", "-D__sparc__", "-D__sparc",\
+ "-D__LP64__=1", "-D_LP64=1", NULL, }
#else
#error defines for arch missing
#endif