PATCH: Re: optimization/7171: Not enough room for program headers (allocated 7, need 8)

H. J. Lu hjl@lucon.org
Wed Jul 31 12:39:00 GMT 2002


On Wed, Jul 31, 2002 at 10:03:55AM +0200, Peter Schmid wrote:
> Attached to this email is a bzip2 compressed tar archive containing
> the preprocessed source file and the .s file.
> 
> As an aside, when -pedantic is removed from the command line the
> compilation finishes without a problem.
> 

This patch should fix it. The problem is DECL_READONLY_SECTION isn't
consistent with the new function, categorize_decl_for_section, in
gcc 3.3. I added a new function, decl_readonly_section, which calls
categorize_decl_for_section. Any comments?


H.J.
-------------- next part --------------
2002-07-31  H.J. Lu <hjl@gnu.org>

	* output.h (decl_readonly_section): New prototype.
	(DECL_READONLY_SECTION): Use decl_readonly_section.

	* varasm.c (decl_readonly_section): New.

--- gcc/output.h.ro	Thu Jun  6 10:26:20 2002
+++ gcc/output.h	Wed Jul 31 10:19:14 2002
@@ -468,16 +468,13 @@ extern struct rtx_def *current_output_in
    The precise value is the insn being output, to pass to error_for_asm.  */
 extern rtx this_is_asm_operands;
 
+extern bool decl_readonly_section PARAMS ((tree, int));
+
 /* Decide whether DECL needs to be in a writable section.  RELOC is the same
    as for SELECT_SECTION.  */
 
 #define DECL_READONLY_SECTION(DECL,RELOC)		\
-  (TREE_READONLY (DECL)					\
-   && ! TREE_THIS_VOLATILE (DECL)			\
-   && DECL_INITIAL (DECL)				\
-   && (DECL_INITIAL (DECL) == error_mark_node		\
-       || TREE_CONSTANT (DECL_INITIAL (DECL)))		\
-   && ! (RELOC && (flag_pic || DECL_ONE_ONLY (DECL))))
+  decl_readonly_section ((DECL), (RELOC))
 
 /* User label prefix in effect for this compilation.  */
 extern const char *user_label_prefix;
--- gcc/varasm.c.ro	Mon Jul 29 14:37:54 2002
+++ gcc/varasm.c	Wed Jul 31 10:15:24 2002
@@ -5010,6 +5010,25 @@ categorize_decl_for_section (decl, reloc
   return ret;
 }
 
+bool
+decl_readonly_section (decl, reloc)
+     tree decl;
+     int reloc;
+{
+  switch (categorize_decl_for_section (decl, reloc))
+    {
+    case SECCAT_RODATA:
+    case SECCAT_RODATA_MERGE_STR:
+    case SECCAT_RODATA_MERGE_STR_INIT:
+    case SECCAT_RODATA_MERGE_CONST:
+      return true;
+      break;
+    default:
+      return false;
+      break;
+    }
+}
+
 /* Select a section based on the above categorization.  */
 
 void


More information about the Gcc-bugs mailing list