[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


define_section

Description:

Arranges object code into sections.

Compatibility:

This pragma is compatible with the following platform targets:

68K
PowerPC

NEC V800

Intel x86

MIPS

Embedded 68K

Prototype:
  #pragma define_section sname istr [ustr] [addrmode] [accmode] Remarks:

This sophisticated and powerful pragma lets you arrange compiled object code into predefined sections and sections you define.

The parameters are:

For example:

#pragma section sname begin

or

__declspec(sname)

  • istr-section name string for initialized data assigned to sname, such as.data (applies to uninitialized data if ustr is omitted)
  • ustr-elf section name for uninitialized data assigned to sname
  • addrmode-indicates how the section is addressed. It can be one of the following
  • ¯ standard-32-bit absolute address

    ¯ near_absolute-16-bit absolute address

    ¯ far_absolute-32-bit absolute address

    ¯ near_code-16-bit offset from TP

    ¯ far_code-32-bit offset from TP

    ¯ near_data-16-bit offset from GP

    ¯ far_data-32-bit offset from GP

  • accmode-indicates the attributes of the section. It can be one of the following:
  • ¯ R-readable

    ¯ RW-readable and writable

    ¯ RX-readable and executable

    ¯ RWX-readable, writable, and executable

    The default value for ustring is the same as istring. The default value for addrmode is "standard". The default value for accmode is "RWX".


    TIP

    Refer to the appropriate Targeting manual for information on the sections that are predefined by a CodeWarrior C/C++ compiler for your build target.

    #pragma define_section can also be used to redefine the attributes of existing sections:

    1. You can force all data to be addressed using 16-bit absolute addresses using


      #pragma define_section data ".data" near_absolute

    2. You can force exception tables to be addressed using 32-bit TP-relative using


    #pragma define_section exceptlist ".exceptlist" far_code
    #pragma define_section exception ".exception" far_code

    If you're going to do this, it is best to put these #pragmas in a prefix file or some other header that will be #included by all source files in your program.


    [ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

    Visit the Metrowerks website at: http://www.metrowerks.com
    For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
    Copyright © 2000, Metrowerks Corp. All rights reserved.

    Last updated: August 17, 2000