gcc rodata regression

2015-01-31 Thread Simon Glass
Hi,

I have been fighting with a strange problem on ARM where gcc puts all
the .rodata from a number of files lumped into a single .rodata
section even when -fdata-sections is used.

I searched and found a bug report here:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54303

which exactly describes the problem I see.

According to the bug report this does not happen on x86_64, and there
is a test case provided.

Does anyone have any clues as to how to fix this bug? I am willing to
give it a try with a few pointers. I currently have to add loads of
#ifdefs in the C code to work around this bug and remove the unwanted
and unreferenced data.

Thanks,
Simon


Re: gcc rodata regression

2015-02-01 Thread Simon Glass
 Hi Andreas,

On 1 February 2015 at 01:55, Andreas Schwab  wrote:
> Simon Glass  writes:
>
>> According to the bug report this does not happen on x86_64,
>
> That is not true, see comment #6.

OK, so it is a widespread problem then. Do you have any hints on how I
could begin to figure out how to fix this? It is blocking me from
making progress so I'm willing to invest some time.

Regards,
Simon


Re: gcc rodata regression

2015-02-03 Thread Simon Glass
Hi Segher,

On 2 February 2015 at 01:16, Segher Boessenkool
 wrote:
> On Sat, Jan 31, 2015 at 05:09:29PM -0700, Simon Glass wrote:
>> I have been fighting with a strange problem on ARM where gcc puts all
>> the .rodata from a number of files lumped into a single .rodata
>> section even when -fdata-sections is used.
>>
>> I searched and found a bug report here:
>>
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54303
>>
>> which exactly describes the problem I see.
>
> You could try this patch.  I think there were still some problems with
> it, there must have been some reason I didn't submit it.  Cannot have
> been just laziness :-P

Thanks, I will give it a try and let you know what I find.

[snip]

Regards,
Simon


Fwd: Re: gcc rodata regression

2015-02-09 Thread Simon Glass
Hi Segher,

On 2 February 2015 at 01:16, Segher Boessenkool
 wrote:
> On Sat, Jan 31, 2015 at 05:09:29PM -0700, Simon Glass wrote:
>> I have been fighting with a strange problem on ARM where gcc puts all
>> the .rodata from a number of files lumped into a single .rodata
>> section even when -fdata-sections is used.
>>
>> I searched and found a bug report here:
>>
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54303
>>
>> which exactly describes the problem I see.
>
> You could try this patch. I think there were still some problems with
> it, there must have been some reason I didn't submit it. Cannot have
> been just laziness :-P

I tried this patch and it solved my problem - the rodata section is
now split up and most of it is discarded in the link phase.

I hope some form of this can make it into gcc one day soon and a
suitable regression test case can be added!

Thanks,
Simon

[snip]