This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: ppc-eabi: interaction betwen section name attributes and -msdata
>>>>> "Geoff" == Geoff Keating <geoffk@geoffk.org> writes:
>> It appears that rs6000_encode_section_info() does exactly that.
>> I'm not sure how much good it does only there. I was thinking of
>> moving that bit of code into it's own function, and re-using in the
>> other functions/macros that compare size against g_switch_value.
Geoff> Yes. When I said it wasn't a good idea, I was speaking from
Geoff> painful experience :-).
Geoff>
Geoff> I guess if you don't want to implement the new feature,
Geoff> splitting out the existing code would be OK.
After further investigation, simply tweaking the existing code in
rs6000_encode_section_info() was all that was necessary to fix my
two problems.
Do you see any problems with the enclosed patch?
--jtc
2001-07-06 J.T. Conklin <jtc@redback.com>
* config/rs6000/rs6000.c (rs6000_encode_section_info): Don't put
the variable in a small data section if an section attribute was
specified. Fixed off by one errors comparing section attributes
and small data section names.
*** rs6000.c 2001/07/06 00:25:37 1.1
--- rs6000.c 2001/07/06 21:43:52
***************
*** 7794,7812 ****
abort ();
}
! if ((size > 0 && size <= g_switch_value)
|| (name
! && ((len == sizeof (".sdata") - 1
&& strcmp (name, ".sdata") == 0)
! || (len == sizeof (".sdata2") - 1
&& strcmp (name, ".sdata2") == 0)
! || (len == sizeof (".sbss") - 1
&& strcmp (name, ".sbss") == 0)
! || (len == sizeof (".sbss2") - 1
&& strcmp (name, ".sbss2") == 0)
! || (len == sizeof (".PPC.EMB.sdata0") - 1
&& strcmp (name, ".PPC.EMB.sdata0") == 0)
! || (len == sizeof (".PPC.EMB.sbss0") - 1
&& strcmp (name, ".PPC.EMB.sbss0") == 0))))
{
rtx sym_ref = XEXP (DECL_RTL (decl), 0);
--- 7794,7813 ----
abort ();
}
! if ((!name
! && (size > 0 && size <= g_switch_value))
|| (name
! && ((len == sizeof (".sdata")
&& strcmp (name, ".sdata") == 0)
! || (len == sizeof (".sdata2")
&& strcmp (name, ".sdata2") == 0)
! || (len == sizeof (".sbss")
&& strcmp (name, ".sbss") == 0)
! || (len == sizeof (".sbss2")
&& strcmp (name, ".sbss2") == 0)
! || (len == sizeof (".PPC.EMB.sdata0")
&& strcmp (name, ".PPC.EMB.sdata0") == 0)
! || (len == sizeof (".PPC.EMB.sbss0")
&& strcmp (name, ".PPC.EMB.sbss0") == 0))))
{
rtx sym_ref = XEXP (DECL_RTL (decl), 0);
--
J.T. Conklin
RedBack Networks