This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [g++] RFH: Is there a way to make gcc place global const class objects in .rodata ?
- From: "Haase Bjoern (PT-BEU/EMT)" <Bjoern dot Haase at de dot bosch dot com>
- To: "Seongbae Park" <seongbae dot park at gmail dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Thu, 10 Aug 2006 13:57:53 +0200
- Subject: Re: [g++] RFH: Is there a way to make gcc place global const class objects in .rodata ?
>Seongbae Park wrote:
>
>Of course, it's best if this can be implemented in the compiler,
>but if the size and the number of the readonly data is manageable,
>you can do this by hand -
>inspect what the layout of the class is by writing a test program
>and looking at how the fields are layed out,
>and replicating the same data in the assembly.
IMO, that would not really be a solution.
Meanwhile, I have reduced a test case for the issue. It's 6 lines long.
#include <complex>
using namespace std;
const complex<double> should_be_in_rodata (42,-42);
complex<double> should_be_in_data (-42,42);
complex<double> should_be_in_bss;
Presently all of them end up in bss.
Bjoern.