This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] PowerPC select_section / unique_section


>>>>> Richard Henderson writes:

Richard> Yes, I'm aware that the existing varasm.c code can't handle
Richard> the ppc-eabi .sdata2 section; that can be fixed.

	How about the following patch for handling PPC EABI sdata2 in
varasm.c?  In my proposal targetm.in_small_data_p should have the logic
for allowing or disallowing small readonly data if it only is allowed in
some contexts (like eABI versus SVR4), as opposed to adding another
target-defined function which has some of the functionality of
in_small_data_p.

Thanks, David


	* varasm.c (section_category): Add SECCAT_SRODATA.
	(categorize_decl_for_section): Return SECCAT_SRODATA for sdata if
	READONLY_SDATA_SECTION defined.
	(decl_readonly_section_1): True for SECCAT_SRODATA also.
	(default_elf_select_section_1): Map SECCAT_SRODATA to .sdata2.
	(default_unique_section_1): Likewise.

Index: varasm.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/varasm.c,v
retrieving revision 1.304
diff -c -p -r1.304 varasm.c
*** varasm.c	4 Sep 2002 01:56:11 -0000	1.304
--- varasm.c	4 Sep 2002 04:09:27 -0000
*************** enum section_category
*** 4898,4903 ****
--- 4898,4904 ----
    SECCAT_RODATA_MERGE_STR,
    SECCAT_RODATA_MERGE_STR_INIT,
    SECCAT_RODATA_MERGE_CONST,
+   SECCAT_SRODATA,
  
    SECCAT_DATA,
  
*************** categorize_decl_for_section (decl, reloc
*** 4999,5004 ****
--- 5000,5009 ----
      {
        if (ret == SECCAT_BSS)
  	ret = SECCAT_SBSS;
+ #ifdef READONLY_SDATA_SECTION
+       else if (ret == SECCAT_RODATA)
+ 	ret = SECCAT_SRODATA;
+ #endif
        else
  	ret = SECCAT_SDATA;
      }
*************** decl_readonly_section_1 (decl, reloc, sh
*** 5026,5031 ****
--- 5031,5037 ----
      case SECCAT_RODATA_MERGE_STR:
      case SECCAT_RODATA_MERGE_STR_INIT:
      case SECCAT_RODATA_MERGE_CONST:
+     case SECCAT_SRODATA:
        return true;
        break;
      default:
*************** default_elf_select_section_1 (decl, relo
*** 5069,5074 ****
--- 5075,5083 ----
      case SECCAT_RODATA_MERGE_CONST:
        mergeable_constant_section (DECL_MODE (decl), align, 0);
        break;
+     case SECCAT_SRODATA:
+       named_section (NULL_TREE, ".sdata2", reloc);
+       break;
      case SECCAT_DATA:
        data_section ();
        break;
*************** default_unique_section_1 (decl, reloc, s
*** 5140,5145 ****
--- 5149,5157 ----
      case SECCAT_RODATA_MERGE_STR_INIT:
      case SECCAT_RODATA_MERGE_CONST:
        prefix = one_only ? ".gnu.linkonce.r." : ".rodata.";
+       break;
+     case SECCAT_SRODATA:
+       prefix = one_only ? ".gnu.linkonce.s2." : ".sdata2.";
        break;
      case SECCAT_DATA:
      case SECCAT_DATA_REL:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]