define_section

Specifies a predefined section or defines a new section for compiled object code.

#pragma define_section sname ".istr" [.ustr] [addrmode] [accmode]
Parameters

sname

Identifier for source references to this user-defined section. Make sure this name does not conflict with names recognized by the __declspec directive.

istr

Section-name string for initialized data assigned to this section. Double quotes must surround this parameter value, which must begin with a period. (Also applies to uninitialized data if there is no ustr value.)

ustr

Optional: ELF section name for uninitialized data assigned to this section. Must begin with a period. Default value is the istr value.

addrmode

Optional: any of these address-mode values:

accmode

Optional: any of these letter combinations:

(No other letter orders are valid: WR, XR, or XRW would be an error.)

Remarks

The compiler predefines the common PowerPC sections that the following table lists.

Table 1. ColdFire Predefined Sections
Applicability Definition Pragmas
Absolute Addressing Mode #pragma define_section text ".text" far_absolute RX
#pragma define_section data ".data" ".bss" far_absolute RW
#pragma define_section sdata ".sdata" ".sbss" near_data RW
#pragma define_section const ".rodata" far_absolute R
C++, Regardless of Addressing Mode #pragma define_section exception ".exception" far_absolute R
#pragma define_section exceptlist ".exceptlist" far_absolute R
PID Addressing Mode #pragma define_section text ".text" far_absolute RX
#pragma define_section data ".data" ".bss" far_data RW
#pragma define_section sdata ".sdata" ".sbss" near_data RW
#pragma define_section const ".rodata" far_absolute R
PIC Addressing Mode #pragma define_section text ".text" far_code RX
#pragma define_section data ".data" ".bss" far_absolute RW
#pragma define_section sdata ".sdata" ".sbss" near_data RW
#pragma define_section const ".rodata" far_code R

Another use for #pragma define_section is redefining the attributes of predefined sections:

You should put any such attribute-redefinition pragmas, in a prefix file or other header that your program's all source files will include.

Note: The ELF linker's Section Mappings settings panel must map any user-defined compiler section to an appropriate segment.