Table of Contents        Previous topic       Next topic       

C/C++ COMPILER->Pragmas->#pragma bss_seg

#pragma bss_seg( ["section-name"] )

The bss_seg pragma specifies the data section where uninitialised C data objects are placed.  Section name can be any valid string contant.  To avoid conflict with the default sections used by the compiler, avoid using names beginning with a double underscore.

Using #pragma bss_seg without a section-name string resets allocation to the default section.


#pragma bss_seg(MYBSS)

int i;

#pragma bss_seg()

int j;

i will be placed in code section MYBSS.  j will be placed in default bss section.

Note that only j will be initialised to zero by the initialisation routine as supplied.  The following example shows how you might initialise the data in section MYBSS to zero:

    section    MYBSS,data
    section    MYINIT,code
    XDEF      _init_my_bss
    move.l    #`size(MYBSS),d0
    beq.s    exit        * MYBSS is empty
    move.l    #MYBSS,a0
    clr.b    (a0)+        * zero fill
    subq.l    #1,d0
    bne.s    moredata