r309940 - [mips] Implement -muninit-const-in-rodata

Simon Dardis via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 3 08:39:22 PDT 2017


> From: Joerg Sonnenberger [mailto:joerg at bec.de]
> Sent: 03 August 2017 15:12
> To: cfe-commits at lists.llvm.org
> Cc: Simon Dardis
> Subject: Re: r309940 - [mips] Implement -muninit-const-in-rodata
> 
> On Thu, Aug 03, 2017 at 02:01:17PM -0000, Simon Dardis via cfe-commits
> wrote:
> > Author: sdardis
> > Date: Thu Aug  3 07:01:17 2017
> > New Revision: 309940
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=309940&view=rev
> > Log:
> > [mips] Implement -muninit-const-in-rodata
> >
> > This option when combined with -mgpopt and -membedded-data places all
> > uninitialized constant variables in the read-only section.
> 
> I don't get it. Why is this preferable to just forbidding the use of common
> variables in first placce?
> 
> Joerg

This was added for feature parity with GCC. as -membedded-data changes how
data is laid out in the binary. Using -fno-common places the item in the .bss section
which takes up memory at runtime. Both of those options are provided to reduce
the amount of memory required for some embedded programs.

Thanks,
Simon



More information about the cfe-commits mailing list