Specifiying alternatives to .data .bss in C source files

Ravishankar S ravishankar.s@hathway.com
Fri Sep 1 15:43:00 GMT 2006


	// preserve variables across wakeup
	#pragma section DATA ".dataW" ".bssW" far-absolute
	#pragma section SDATA ".sdataW" ".sbssW" far-absolute -> Should
this not be near ?

In gcc we specify the section in this way:

int var __attribute__((section(".mysection"));

There is no way to separate initalized variable and uninitialized
variable: it has to done explicitly.

example:

int u_var __attribute__((section(".bssW"));
int i_var __attribute__((section(".dataW")) = 10;


Coming to addressing mode: It has to be specied in command line. 
Options are -msdata=eabi, -G <NUM> -fno-common. Refer to GCC manual for
details. However refer to an earlier mail of mine to see the problems in
the full utilization of SDA in PPC by GCC.

Diab is very powerful in this sense: it allows the definition of more
SDA's than what is specified by the EABI. This is currently may not be
possible in GCC.

- Ravishankar

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Jeff Lasslett
Sent: Thursday, August 31, 2006 12:35 PM
To: gcc-help@gcc.gnu.org
Subject: Specifiying alternatives to .data .bss in C source files


Hello,

The old diab compiler that I am in the process of replacing with GCC
supports the following  ...

	// preserve variables across wakeup
	#pragma section DATA ".dataW" ".bssW" far-absolute
	#pragma section SDATA ".sdataW" ".sbssW" far-absolute

... which causes the compiler to put stuff normally destined for .data,
.bss, .sdata and .sbss into different input sections (.dataW, .sdataW,
.bassW, .sbssW).

We do this because our hardware can start cold, or warm, or 'wake from
sleep' and we don't always want to initialise variables.

Could someone please advise me as to how I can get GCC to do the same
thing?

Thanks,

	Jeff

__________ NOD32 1.1454 (20060321) Information __________

This message was checked by NOD32 antivirus system. http://www.eset.com




More information about the Gcc-help mailing list