Named bss sections
Mon Sep 8 10:32:00 GMT 1997
> 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.
In addition to this, it should be also possible to specify a default section
for read-only data (non-writeable strings etc.), probably as a per-function
attribute. This would simplify implementation of automatical discarding of
init code after it has been executed (as used for example in the Linux kernel).
Have a nice fortnight
Martin `MJ' Mares <email@example.com> http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"Spelling checkers at maximum! Fire!"
More information about the Gcc