Flag

Action

cSets the "code" hint for a segment. When this flag is set, it indicates that the segment mostly contains code that may be executed. When not set, it indicates that it is unlikely that the segment contains code. This flag is not set by default. The code hint is off by default.

gGroups segments together. A segment declared with g flag is grouped with a segment preceding it in the mapfile. Any number of segments can be grouped together. The grouping affects the way in which addresses are assigned to segments. The segments in one group are assigned consecutive virtual addresses.

oTells the linker that all the segment attributes declared for this segment can be changed or modified to achieve space and/or time optimization. When this flag is set, the linker considers all other segment attribute specifications (for this segment) as hints and change or modify them as it thinks fit for space and/or time optimization.

R

Readable

W

Writable

X

Executable

Mapfile Segment Declaration Examples

The following example declares a segment with segment_type LOAD and segment_flags readable and executable.

text = LOAD ?RX;

The following example declares a LOADable segment (default) with segment_flags readable and writable. The virtual_address and alignment values are set to V0x80000000 and A0x1000 respectively.

mydata = ?RW V0x80000000 A0x1000;

Defining Mapfile Section Mapping Directives

A section mapping directive specifies how the linker must map the input section onto output segments. This directive tells the linker what attributes of a section must be matched in order to map that section into the named segment. The set of attribute values that a section must have to map into a specific segment is called the entrance criteria.

segment_name : {section_attribute_value}*

;

The section attributes and their valid values are as follows:

Section Attribute

Value

section_name

Any valid section name

section_type

$PROGBITS, $NOBITS, $UNWIND, $NOTE, $REL, $RELA

section_flags

?[[!]A][[!]W][[!]X][[!][S]][[!][T]]

Flag

Value

A

Allocatable (takes up virtual memory)

W

Writable

X

Executable

S

Short data

T

TLS (thread local storage)

 

Defining Mapfile Section Mapping Directives 197

Page 197
Image 197
HP UX Software Transition Kit (STK) Defining Mapfile Section Mapping Directives, Mapfile Segment Declaration Examples