ports/117279: [patch] Make palm/prc-tools compileable by GCC 4.2

Alexandre Sunny Kovalenko alex.kovalenko at verizon.net
Wed Oct 17 18:20:05 UTC 2007


>Number:         117279
>Category:       ports
>Synopsis:       [patch] Make palm/prc-tools compileable by GCC 4.2
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 17 18:20:05 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator:     Alexandre "Sunny" Kovalenko
>Release:        7.0-PRERELEASE
>Organization:
Home
>Environment:
FreeBSD RabbitsDen.RabbitsLawn.verizon.net 7.0-PRERELEASE FreeBSD 7.0-PRERELEASE #0: Tue Oct 16 23:18:09 EDT 2007     root at RabbitsDen.RabbitsLawn.verizon.net:/usr/obj/usr/src/sys/TPX60  i386

>Description:
With attached patch in the files/prc-tools+gcc-42.patch and patch for the Makefile (in the fix section below) palm/prc-tools will build with gcc 4.2. I was able to build simple Palm executable with it and run said executable on my Tungsten E2.
*Missing from the patch*: ability to override CFLAGS from /etc/make.conf which are not known to gcc 2.95. I do not have enough understanding of the ports build infrastructure to provide this, so I have commented out CFLAGS+=-fno-tree-vrp in mine before building this port.


>How-To-Repeat:

>Fix:
--- Makefile.ORIG       2007-10-17 13:43:43.000000000 -0400
+++ Makefile    2007-10-17 13:49:08.000000000 -0400
@@ -68,10 +68,6 @@
 
 .include <bsd.port.pre.mk>
 
-.if ${OSVERSION} >= 700042
-BROKEN=                Does not compile with GCC 4.2
-.endif
-
 post-extract:
        @(cd ${WRKDIR} && ${GZIP_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/${DISTNAME}.tar.gz ${EXTRACT_AFTER_ARGS})
 
@@ -126,6 +122,9 @@
 post-configure:
        ${RM} ${WRKDIR}/gdb-5.3/bfd/doc/bfd.info*
        ${RM} ${WRKDIR}/binutils-2.14/bfd/doc/bfd.info*
+.if ${OSVERSION} >= 700042
+       ${PATCH} -p0 --forward --quiet -E < ${FILESDIR}/prc-tools+gcc-42.patch
+.endif
 
 post-install:
        ${RM} ${PREFIX}/pilot/bin/m68k-palmos-c++filt


Patch attached with submission follows:

--- ./work/binutils-2.14/gas/as.h.ORIG	2007-10-17 11:36:16.000000000 -0400
+++ ./work/binutils-2.14/gas/as.h	2007-10-17 11:44:10.000000000 -0400
@@ -595,7 +595,19 @@
 struct expressionS;
 struct fix;
 typedef struct symbol symbolS;
-struct relax_type;
+struct relax_type
+{
+  /* Forward reach. Signed number. > 0.  */
+  long rlx_forward;
+  /* Backward reach. Signed number. < 0.  */
+  long rlx_backward;
+ 
+  /* Bytes length of this address.  */
+  unsigned char rlx_length;
+ 
+  /* Next longer relax-state.  0 means there is no 'next' relax-state.  */
+  relax_substateT rlx_more;
+};
 typedef struct frag fragS;
 
 #ifdef BFD_ASSEMBLER
--- ./work/binutils-2.14/gas/tc.h.ORIG	2007-10-17 11:36:37.000000000 -0400
+++ ./work/binutils-2.14/gas/tc.h	2007-10-17 11:37:19.000000000 -0400
@@ -24,23 +24,6 @@
 
 extern const pseudo_typeS md_pseudo_table[];
 
-/* JF moved this here from as.h under the theory that nobody except MACHINE.c
-   and write.c care about it anyway.  */
-
-struct relax_type
-{
-  /* Forward reach. Signed number. > 0.  */
-  long rlx_forward;
-  /* Backward reach. Signed number. < 0.  */
-  long rlx_backward;
-
-  /* Bytes length of this address.  */
-  unsigned char rlx_length;
-
-  /* Next longer relax-state.  0 means there is no 'next' relax-state.  */
-  relax_substateT rlx_more;
-};
-
 typedef struct relax_type relax_typeS;
 
 extern const int md_reloc_size;	/* Size of a relocation record */
--- ./work/gdb-5.3/gdb/remote-palmos.c.ORIG	2007-10-17 11:46:12.000000000 -0400
+++ ./work/gdb-5.3/gdb/remote-palmos.c	2007-10-17 11:46:44.000000000 -0400
@@ -128,13 +128,6 @@
 
 extern struct target_ops palmos_ops, pilot_ops;	/* Forward decl */
 
-/* This was 5 seconds, which is a long time to sit and wait.
-   Unless this is going though some terminal server or multiplexer or
-   other form of hairy serial connection, I would think 2 seconds would
-   be plenty.  */
-
-static int remote_timeout = 2;
-
 static CORE_ADDR text_addr=0, data_addr=0, bss_addr=0;
 static CORE_ADDR save_ssp, save_usp;
 static enum target_signal wbreakpoint_signo;
--- ./work/gdb-5.3/include/obstack.h.ORIG	2007-10-17 11:39:24.000000000 -0400
+++ ./work/gdb-5.3/include/obstack.h	2007-10-17 11:30:02.000000000 -0400
@@ -349,7 +349,7 @@
 
 #define obstack_memory_used(h) _obstack_memory_used (h)
 
-#if defined __GNUC__ && defined __STDC__ && __STDC__
+#if defined USE_OBSTACK_MACROS && defined __GNUC__ && defined __STDC__ && __STDC__
 /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
    does not implement __extension__.  But that compiler doesn't define
    __GNUC_MINOR__.  */
--- ./work/gcc-3.3.1/gcc/cp/decl.c.ORIG	2007-10-17 11:39:05.000000000 -0400
+++ ./work/gcc-3.3.1/gcc/cp/decl.c	2007-10-17 11:26:47.000000000 -0400
@@ -677,6 +677,13 @@
    ? cp_function_chain->bindings		\
    : scope_chain->bindings)
 
+#define set_current_binding_level(x)            \
+{                                               \
+  if(cfun && cp_function_chain->bindings)       \
+     cp_function_chain->bindings = (x);         \
+     else scope_chain->bindings = (x);          \
+}
+
 /* The binding level of the current class, if any.  */
 
 #define class_binding_level scope_chain->class_bindings
@@ -724,7 +731,7 @@
      are active.  */
   memset ((char*) newlevel, 0, sizeof (struct cp_binding_level));
   newlevel->level_chain = current_binding_level;
-  current_binding_level = newlevel;
+  set_current_binding_level(newlevel);
   newlevel->tag_transparent = tag_transparent;
   newlevel->more_cleanups_ok = 1;
 
@@ -780,7 +787,7 @@
     }
   {
     register struct cp_binding_level *level = current_binding_level;
-    current_binding_level = current_binding_level->level_chain;
+    set_current_binding_level(current_binding_level->level_chain);
     level->level_chain = free_binding_level;
     if (level->parm_flag != 2)
       binding_table_free (level->type_decls);
@@ -797,7 +804,7 @@
 suspend_binding_level ()
 {
   if (class_binding_level)
-    current_binding_level = class_binding_level;
+    set_current_binding_level(class_binding_level);
 
   if (NAMESPACE_LEVEL (global_namespace))
     my_friendly_assert (!global_scope_p (current_binding_level), 20030527);
@@ -816,7 +823,7 @@
         }
       is_class_level = 0;
     }
-  current_binding_level = current_binding_level->level_chain;
+  set_current_binding_level(current_binding_level->level_chain);
   find_class_binding_level ();
 }
 
@@ -829,7 +836,7 @@
   my_friendly_assert(!class_binding_level, 386);
   /* Also, resuming a non-directly nested namespace is a no-no.  */
   my_friendly_assert(b->level_chain == current_binding_level, 386);
-  current_binding_level = b;
+  set_current_binding_level(b);
   if (ENABLE_SCOPE_CHECKING)
     {
       b->binding_depth = binding_depth;
@@ -4529,9 +4536,9 @@
   else
     {
       b = current_binding_level;
-      current_binding_level = level;
+      set_current_binding_level(level);
       x = pushdecl (x);
-      current_binding_level = b;
+      set_current_binding_level(b);
     }
   current_function_decl = function_decl;
   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
@@ -6933,7 +6940,7 @@
   current_lang_name = lang_name_c;
 
   current_function_decl = NULL_TREE;
-  current_binding_level = NULL_BINDING_LEVEL;
+  set_current_binding_level(NULL_BINDING_LEVEL);
   free_binding_level = NULL_BINDING_LEVEL;
 
   build_common_tree_nodes (flag_signed_char);
@@ -10766,10 +10773,10 @@
   if (decl_context == NORMAL && !toplevel_bindings_p ())
     {
       struct cp_binding_level *b = current_binding_level;
-      current_binding_level = b->level_chain;
+      set_current_binding_level(b->level_chain);
       if (current_binding_level != 0 && toplevel_bindings_p ())
 	decl_context = PARM;
-      current_binding_level = b;
+      set_current_binding_level(b);
     }
 
   if (name == NULL)
@@ -14406,7 +14413,7 @@
      FIXME factor out the non-RTL stuff.  */
   bl = current_binding_level;
   init_function_start (decl1, input_filename, lineno);
-  current_binding_level = bl;
+  set_current_binding_level(bl);
 
   /* Even though we're inside a function body, we still don't want to
      call expand_expr to calculate the size of a variable-sized array.
--- ./work/gcc-3.3.1/include/obstack.h.ORIG	2007-10-17 11:39:14.000000000 -0400
+++ ./work/gcc-3.3.1/include/obstack.h	2007-10-17 09:44:47.000000000 -0400
@@ -349,7 +349,7 @@
 
 #define obstack_memory_used(h) _obstack_memory_used (h)
 
-#if defined __GNUC__ && defined __STDC__ && __STDC__
+#if defined USE_OBSTACK_MACROS && defined __GNUC__ && defined __STDC__ && __STDC__
 /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
    does not implement __extension__.  But that compiler doesn't define
    __GNUC_MINOR__.  */


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list