Re: Auto-generated .rodata contents and __attribute__((section))

2018-05-24 Thread Florian Weimer
On 05/23/2018 02:55 PM, Michael Matz wrote: On Fri, 18 May 2018, Richard Biener wrote: Interesting. Do they allow merging across such sections? Consider a 8 byte entity 0x12345678 and 4 byte entities 0x1234 0x5678, will the 4 byte entities share the rodata with the 8 byte one? There's no

Re: Auto-generated .rodata contents and __attribute__((section))

2018-05-23 Thread Michael Matz
Hi, On Fri, 18 May 2018, Richard Biener wrote: > Interesting. Do they allow merging across such sections? Consider a 8 > byte entity 0x12345678 and 4 byte entities 0x1234 0x5678, will the 4 > byte entities share the rodata with the 8 byte one? There's no language to forbid this (as long as

Re: Auto-generated .rodata contents and __attribute__((section))

2018-05-18 Thread Richard Biener
On Thu, May 17, 2018 at 11:10 PM Segher Boessenkool < seg...@kernel.crashing.org> wrote: > On Thu, May 17, 2018 at 06:10:13PM +0200, Michael Matz wrote: > > On Wed, 16 May 2018, Richard Biener wrote: > > > > Are constant pool entries merged at compile time or at link time? I > > > > would presume

Re: Auto-generated .rodata contents and __attribute__((section))

2018-05-17 Thread Segher Boessenkool
On Thu, May 17, 2018 at 06:10:13PM +0200, Michael Matz wrote: > On Wed, 16 May 2018, Richard Biener wrote: > > > Are constant pool entries merged at compile time or at link time? I > > > would presume it should be done at link time because otherwise you're > > > only merging entries within a

Re: Auto-generated .rodata contents and __attribute__((section))

2018-05-17 Thread Michael Matz
Hi, On Wed, 16 May 2018, Richard Biener wrote: > > Are constant pool entries merged at compile time or at link time? I > > would presume it should be done at link time because otherwise you're > > only merging entries within a single compilation unit (which doesn't > > sound that useful in a

Re: Auto-generated .rodata contents and __attribute__((section))

2018-05-16 Thread Richard Biener
On Tue, May 15, 2018 at 9:56 PM Julius Werner wrote: > > I think you are asking for per-function constant pool sections. Because > > we generally cannot avoid the need of a constant pool and dependent > > on the target that is always global. Note with per-function

Re: Auto-generated .rodata contents and __attribute__((section))

2018-05-15 Thread Segher Boessenkool
On Tue, May 15, 2018 at 12:56:22PM -0700, Julius Werner wrote: > > I think you are asking for per-function constant pool sections. Because > > we generally cannot avoid the need of a constant pool and dependent > > on the target that is always global. Note with per-function constant > > pools

Re: Auto-generated .rodata contents and __attribute__((section))

2018-05-15 Thread Joseph Myers
This has been listed as a desirable feature for a long time: https://gcc.gnu.org/projects/optimize.html#putting_constants_in_special_sections -- Joseph S. Myers jos...@codesourcery.com

Re: Auto-generated .rodata contents and __attribute__((section))

2018-05-15 Thread Julius Werner
> I think you are asking for per-function constant pool sections. Because > we generally cannot avoid the need of a constant pool and dependent > on the target that is always global. Note with per-function constant > pools you will not benefit from constant pool entry merging across > functions.

Re: Auto-generated .rodata contents and __attribute__((section))

2018-05-15 Thread Segher Boessenkool
On Mon, May 14, 2018 at 04:38:09PM -0700, Julius Werner wrote: > However, I just found an issue with this when the functions include local > variables like this: > > const int some_array[] = { 1, 2, 3, 4, 5, 6 }; Does it work better if you make this "static const"? Segher

Re: Auto-generated .rodata contents and __attribute__((section))

2018-05-15 Thread Richard Biener
On Tue, May 15, 2018 at 1:38 AM Julius Werner wrote: > Hi, > I'm a firmware/embedded engineer and frequently run into cases where > certain parts of the code need to be placed in a special memory area (for > example, because the area that contains the other code is not yet

Auto-generated .rodata contents and __attribute__((section))

2018-05-14 Thread Julius Werner
Hi, I'm a firmware/embedded engineer and frequently run into cases where certain parts of the code need to be placed in a special memory area (for example, because the area that contains the other code is not yet initialized or currently inaccessible). My go-to method to solve this is to mark all