This is the mail archive of the gcc@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: Auto-generated .rodata contents and __attribute__((section))


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 single compilation unit (which doesn't 
> > > sound that useful in a big project with hundreds of source files), 
> > > right?
> > 
> > constant pool entries are merged at compile time.  There's no such thing
> > as mergeable constant pool sections 
> 
> Actually there is in ELF.  Mergable sections can not only hold strings, 
> but also fixed-size entities (e.g. 4 or 8 byte constants).  Those are 
> merged content-wise at link time and references properly rewritten.  Of 
> course, those still aren't per-function.

It also works correctly in combination with -ffunction-sections,
-fdata-sections, -Wl,--gc-sections.  And not with per-function constant
pools like on arm-linux; I'm not sure how that could ever work.


Segher


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