sun2 vs. gcc48

Chuck Silvers <[email protected]>
Newsgroups gmane.os.netbsd.ports.sun2,gmane.os.netbsd.ports.m68k
Message-ID <[email protected]>
hi folks,

the attached patch fixes the build problems for sun2 with gcc48.
could someone do some testing in tme?

-Chuck
diff.sun2-gcc48.1 (text/plain, 2.1 KB)
Index: src/external/gpl3/gcc/dist/gcc/config/m68k/m68k.md
===================================================================
RCS file: /home/chs/netbsd/cvs/src/external/gpl3/gcc/dist/gcc/config/m68k/m68k.md,v
retrieving revision 1.3
diff -u -p -r1.3 m68k.md
--- src/external/gpl3/gcc/dist/gcc/config/m68k/m68k.md	1 Mar 2014 08:58:31 -0000	1.3
+++ src/external/gpl3/gcc/dist/gcc/config/m68k/m68k.md	20 Nov 2014 20:01:05 -0000
@@ -7112,7 +7112,7 @@
     }
   else if (MOTOROLA)
     {
-      if (TARGET_COLDFIRE)
+      if (TARGET_COLDFIRE || TARGET_68010)
 	/* Load the full 32-bit PC-relative offset of
 	   _GLOBAL_OFFSET_TABLE_ into the PIC register, then use it to
 	   calculate the absolute value.  The offset and "lea"
Index: src/external/gpl3/gcc/dist/libgcc/config/m68k/lb1sf68.S
===================================================================
RCS file: /home/chs/netbsd/cvs/src/external/gpl3/gcc/dist/libgcc/config/m68k/lb1sf68.S,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 lb1sf68.S
--- src/external/gpl3/gcc/dist/libgcc/config/m68k/lb1sf68.S	1 Mar 2014 08:41:47 -0000	1.1.1.1
+++ src/external/gpl3/gcc/dist/libgcc/config/m68k/lb1sf68.S	20 Nov 2014 19:11:58 -0000
@@ -189,7 +189,20 @@ see the files COPYING3 and COPYING.RUNTI
 	.macro PICLEA sym, reg
 	movel	#_GLOBAL_OFFSET_TABLE_@GOTPC, \reg
 	lea	(-6, pc, \reg), \reg
+#ifdef __mc68010__
+	/*
+	 * The GOT offset can be bigger than 16 bits
+	 * but mc68010 only has a 16-bit displacement addressing mode,
+	 * so use a temp register to load the offset.
+	 */
+	movel	a2, sp@-
+	movel	#\sym@GOT, a2
+	addal	a2, \reg
+	movel	sp@+, a2
+	movel	(\reg), \reg
+#else
 	movel	\sym@GOT(\reg), \reg
+#endif
 	.endm
 
 	.macro PICPEA sym, areg
@@ -211,7 +224,7 @@ see the files COPYING3 and COPYING.RUNTI
 	/* ISA C has no bra.l instruction, and since this assembly file
 	   gets assembled into multiple object files, we avoid the
 	   bra instruction entirely.  */
-#if defined (__mcoldfire__) && !defined (__mcfisab__)
+#if (defined (__mcoldfire__) && !defined (__mcfisab__)) || defined (__mc68010__)
 	lea	\addr-.-8,a0
 	jmp	pc@(a0)
 #else
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.