Is there any compile option equel "__attribute__" ?

Marek Polacek mmpolacek@gmail.com
Wed Jul 28 13:11:00 GMT 2010


  On 07/28/2010 01:40 PM, star young wrote:
> some data arrays has been defined as const type ,so when i compile the
> source code,the data arrays are put in .text section,but I want to
> move it to .data section. yet i can't change the source code,so  i can
> only make it through the command lin
Oh, I've missed the word *compile*. I think you could achieve this if in 
the source code would be something like

#ifndef SECTION
# define SECTION ".text"
#endif

and the data would be defined with __attribute__((section(SECTION))). 
Then from the command line you could change the section using gcc 
-DSECTION=\".data\" foo.c.
I'm sorry if I'm missing something.

Thanks,
Marek



More information about the Gcc-help mailing list