#pragma arm Section Description

Source: Internet
Author: User

Transferred from: http://blog.csdn.net/humanbeng/article/details/7971570

4.6.3 #pragma arm section [section_sort_list]

This compilation indicates that the section name to use for subsequent functions or objects is specified. This includes the definition of the anonymous object that the compiler created for initialization.  Note that you can __attribute__ (Section (..)) Used for functions or variables to replace #pragma arm section.

Syntax
#pragma arm section [section_sort_list]
which
section_sort_list specifies an optional list of section names to use for subsequent functions or objects.
Section_sort_list syntax is: section_type[[=] "name"] [, section_type= "name"]*

Valid section types are: code, rodata, rwdata, zidata.

Usage

You can use the scatter-load profile with the ARM linker to control how a named section is placed in a specific memory address.

Limit

This option is not valid for the following:
• Inline functions and their local static variables.
• Template instantiation and its local static variables.
• Delete unused variables and functions. However, you can use the #pragma arm section to make the link
function or variable that might otherwise be retained because it is associated with a function or variable bit used
In the same section.
• The order in which the definitions are written to the object file.

Example

int x1 = 5; In. Data (default)
int y1[100]; In. BSS (default)
int const Z1[3] = {n/a}; In. Constdata (default)
#pragma arm section rwdata = "Foo", Rodata = "Bar"
int x2 = 5; In foo (data part of region)
int y2[100]; In. BSS
int const Z2[3] = {n/a}; In bar
char *S2 = "abc"; S2 in foo, "ABC" in. conststring
#pragma arm section Rodata
int x3 = 5; in Foo
int y3[100]; In. BSS
int const Z3[3] = {n/a}; In. Constdata
char *S3 = "abc"; S3 in Foo, "ABC" in. conststring
#pragma arm section code = "Foo"
int add1 (int x)//in Foo (Code part of region)
{
return x+1;
}
#pragma arm Section Code

In fact, add the additional Name field, place the paragraph at the beginning of code, Rodata, Rwdata, or zidata, and as to which segment is specified by Section_type in section_type[[=] "name".

#pragma arm Section Description

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.