Named bss sections

Christian Iseli chris@lslsun.epfl.ch
Mon Sep 8 06:50:00 GMT 1997


> Exactly what problem are you trying to solve.  As Gavin noted, we
> pulled that patch out as we thought it wasn't strictly necessary.
> 
> If it's necessary on your target, can you please explain why?

When you work with embedded targets, it is usually necessary to specify
where the variables reside in memory.  Most small processors have some
special mean of accessing certain area of their memory, e.g., the first
256 bytes of the RAM (0000 through 00FF) are often seen as "page 0" RAM
and the processor has special instructions to access that particular RAM area.
Moreover, most embedded target have I/O ports mapped in RAM at specific address
and defining those ports using sections is convenient.

Specifying where data reside in RAM is done through sectionning.  You tell
the linker to put a particular section of data at a specified RAM address.

GCC has provision to put global and static variables in user specified sections
using the section attribute, and though it says in the manual that it should
only be used for initialized variables, I see no hard reason for this restriction.
Using the -fno-common flag can partly solve the problem, except that local common
symbols are still output through the ASM_OUTPUT_LOCAL macro and are implicitely
forced to the .data section.

Basically, I want to be able to specify a section for any variable, not only
initialized ones.  For example, if a variable represents some input port mapped
in RAM, it would be wrong to have to initialize it to some value.

					Christian



More information about the Gcc mailing list