__declspec(section name)

Specifies where to store a variable or function in a section that has been predefined or defined with the #pragma section directive.

Syntax
__declspec(section <section_name>) declaration
  
__declspec(section <section_name>) definition
  
Parameters

section_name

Specifies the name of an initialized data section.

Note: The name of a section must be enclosed in double-quotes (""). To use a user defined section, create the section using #pragma section directive before using __declspec(section <section_name>).
Remarks
__declspec (section ".init") extern void cache_init1(void);
__declspec (section ".text") extern void cache_init2(void); 
extern void cache_init3(void);

void cache_init1(){} // goes into .init if the prototype is visible for 
this definition 

__declspec (section ".init") void cache_init2(){} // ignores previous 
section .text and goes into .init 

__declspec (section ".init") void cache_init3(){} // by default the 
declaration  implies .text but the definition forces it to .init
Predefined sections and default sections

The predefined sections set with an object type become the default section for that type. The compiler predefines the sections listed in the table below.

Table 1. Predefined sections
Type Name Data mode Code mode
code_type ".text" data_mode=far_abs code_mode=pc_rel
data_type ".data" data_mode=far_abs code_mode=pc_rel
const_type ".rodata" data_mode=far_abs code_mode=pc_rel
sdata_type ".sdata" data_mode=sda_rel code_mode=pc_rel
sconst_type ".sdata2" ".sbss2" data_mode=sda_rel code_mode=pc_rel
  ".PPC.EMB.sdata0" ".PPC.EMB.sbss0" data_mode=sda_rel code_mode=pc_rel
Note: The " .PPC.EMB.sdata0 " and " .PPC.EMB.sbss0 " sections are predefined as an alternative to the sdata_type object type.