Keil™, An ARM® Company

RealView Compiler Reference Guide

Technical Support

On-Line Manuals

RealView Compiler Reference Guide

Preface
Introduction
Compiler Command-line Options
Language Extensions
Compiler-specific Features
Keywords and operators
__align
__alignof__
__ALIGNOF__
__asm
__forceinline
__global_reg
__inline
__int64
__INTADDR__
__irq
__packed
__pure
__smc
__softfp
__svc
__svc_indirect
__svc_indirect_r7
__value_in_regs
__weak
__writeonly
__declspec attributes
__declspec(dllexport)
__declspec(dllimport)
__declspec(noinline)
__declspec(noreturn)
__declspec(nothrow)
__declspec(notshared)
__declspec(thread)
Function attributes
__attribute__((alias))
__attribute__((always_inline))
__attribute__((const))
__attribute__((deprecated))
__attribute__((malloc))
__attribute__((noinline))
__attribute__((no_instrument_function))
__attribute__((nomerge))
__attribute__((nonnull))
__attribute__((noreturn))
__attribute__((notailcall))
__attribute__((pure))
__attribute__((section("name")))
__attribute__((unused))
__attribute__((used))
__attribute__((visibility("visibility_type&qu
__attribute__((weak))
Type attributes
__attribute__((bitband))
__attribute__((aligned))
__attribute((packed))
__attribute__((transparent_union))
Variable attributes
__attribute__((alias))
__attribute__((at(address)))
__attribute__((aligned))
__attribute__((deprecated))
__attribute__((packed))
__attribute__((section("name")))
__attribute__((transparent_union))
__attribute__((unused))
__attribute__((used))
__attribute__((visibility("visibility_type&qu
__attribute__((weak))
__attribute__((zero_init))
Pragmas
#pragma anon_unions, #pragma no_anon_unions
#pragma arm
#pragma arm section [section_sort_list]
#pragma diag_default tag[,tag,...]
#pragma diag_error tag[,tag,...]
#pragma diag_remark tag[,tag,...]
#pragma diag_suppress tag[,tag,...]
#pragma diag_warning tag[, tag, ...]
#pragma exceptions_unwind, #pragma no_exceptions_u
#pragma hdrstop
#pragma import symbol_name
#pragma import(__use_full_stdio)
#pragma inline, #pragma no_inline
#pragma no_pch
#pragma Onum
#pragma once
#pragma Ospace
#pragma Otime
#pragma pack(n)
#pragma pop
#pragma push
#pragma softfp_linkage, #pragma no_softfp_linkage
#pragma unroll [(n)]
#pragma unroll_completely
#pragma thumb
Instruction intrinsics
__breakpoint
__cdp
__clrex
__clz
__current_pc
__current_sp
__disable_fiq
__disable_irq
__enable_fiq
__enable_irq
__fabs
__fabsf
__force_stores
__ldrex
__ldrexd
__ldrt
__memory_changed
__nop
__pld
__pli
__qadd
__qdbl
__qsub
__rbit
__rev
__return_address
__ror
__schedule_barrier
__sev
__sqrt
__sqrtf
__ssat
__strex
__strexd
__strt
__swp
__usat
__wfe
__wfi
__yield
ARMv6 SIMD intrinsics
ETSI basic operations
C55x intrinsics
Named register variables
VFP status intrinsic
__vfp_status
GNU builtin functions
Nonstandard functions
C99 functions
C99 functions in the C90 reserved namespace
C94 functions
C90 functions
C99 floating-point functions
Other builtin functions
Compiler predefines
Predefined macros
Function names
C and C++ Implementation Details
Via File Syntax
Standard C Implementation Definition
Standard C++ Implementation Definition
C and C++ Compiler Implementation Limits

#pragma arm section [section_sort_list]

4.6.3. #pragma arm section [section_sort_list]

This pragma specifies a section name to be used for subsequent functions or objects. This includes definitions of anonymous objects the compiler creates for initializations.

Note

You can use __attribute__((section(..))) for functions or variables as an alternative to #pragma arm section.

Syntax

#pragma arm section [section_sort_list]

Where:

section_sort_list

specifies an optional list of section names to be used for subsequent functions or objects. The syntax of section_sort_list is:

section_type[[=]"name"] [,section_type="name"]*

Valid section types are:

  • code

  • rodata

  • rwdata

  • zidata.

Usage

Use a scatter-loading description file with the ARM linker to control how to place a named section at a particular address in memory.

Restrictions

This option has no effect on:

  • Inline functions and their local static variables.

  • Template instantiations and their local static variables.

  • Elimination of unused variables and functions. However, using #pragma arm section enables the linker to eliminate a function or variable that might otherwise be kept because it is in the same section as a used function or variable.

  • The order that definitions are written to the object file.

Example

int x1 = 5;                     // in .data (default)
int y1[100];                    // in .bss (default)
int const z1[3] = {1,2,3};      // 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] = {1,2,3};      // 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] = {1,2,3};      // 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
Copyright © 2007, 2008 ARM Limited. All rights reserved.ARM DUI 0376B
Non-ConfidentialUnrestricted Access