SPRAB89A
September 2011 – March 2014
1
Introduction
1.1
ABIs for the C6000
1.2
Scope
1.3
ABI Variants
1.4
Toolchains and Interoperability
1.5
Libraries
1.6
Types of Object Files
1.7
Segments
1.8
C6000 Architecture Overview
1.9
Reference Documents
1.10
Code Fragment Notation
2
Data Representation
2.1
Basic Types
2.2
Data in Registers
2.3
Data in Memory
2.4
Complex Types
2.5
Structures and Unions
2.6
Arrays
2.7
Bit Fields
2.7.1
Volatile Bit Fields
2.8
Enumeration Types
3
Calling Conventions
3.1
Call and Return
3.1.1
Return Address Computation
3.1.2
Call Instructions
3.1.3
Return Instruction
3.1.4
Pipeline Conventions
3.1.5
Weak Functions
3.2
Register Conventions
3.3
Argument Passing
3.4
Return Values
3.5
Structures and Unions Passed and Returned by Reference
3.6
Conventions for Compiler Helper Functions
3.7
Scratch Registers for Inter-Section Calls
3.8
Setting Up DP
4
Data Allocation and Addressing
4.1
Data Sections and Segments
4.2
Allocation and Addressing of Static Data
4.2.1
Addressing Methods for Static Data
4.2.1.1
Near DP-Relative Addressing
4.2.1.2
Far DP-Relative Addressing
4.2.1.3
Absolute Addressing
4.2.1.4
GOT-Indirect Addressing
4.2.1.5
PC-Relative Addressing
4.2.2
Placement Conventions for Static Data
4.2.2.1
Abstract Conventions for Placement
4.2.2.2
Abstract Conventions for Addressing
4.2.2.3
Linker Requirements
4.2.3
Initialization of Static Data
4.3
Automatic Variables
4.4
Frame Layout
4.4.1
Stack Alignment
4.4.2
Register Save Order
4.4.2.1
Big-Endian Pair Swapping
4.4.2.2
Examples
4.4.3
DATA_MEM_BANK
4.4.4
C64x+ Specific Stack Layouts
4.4.4.1
_ _C6000_push_rts Layout
4.4.4.2
Compact Frame Layout
4.5
Heap-Allocated Objects
5
Code Allocation and Addressing
5.1
Computing the Address of a Code Label
5.1.1
Absolute Addressing for Code
5.1.2
PC-Relative Addressing
5.1.3
PC-Relative Addressing Within the Same Section
5.1.4
Short-Offset PC-Relative Addressing (C64x)
5.1.5
GOT-Based Addressing for Code
5.2
Branching
5.3
Calls
5.3.1
Direct PC-Relative Call
5.3.2
Far Call Trampoline
5.3.3
Indirect Calls
5.4
Addressing Compact Instructions
6
Addressing Model for Dynamic Linking
6.1
Terms and Concepts
6.2
Overview of Dynamic Linking Mechanisms
6.3
DSOs and DLLs
6.4
Preemption
6.5
PLT Entries
6.5.1
Direct Calls to Imported Functions
6.5.2
PLT Entry Via Absolute Address
6.5.3
PLT Entry Via GOT
6.6
The Global Offset Table
6.6.1
GOT-Based Reference Using Near DP-Relative Addressing
6.6.2
GOT-Based Reference Using Far DP-Relative Addressing
6.7
The DSBT Model
6.7.1
Entry/Exit Sequence for Exported Functions
6.7.2
Avoiding DP Loads for Internal Functions
6.7.3
Function Pointers
6.7.4
Interrupts
6.7.5
Compatibility With Non-DSBT Code
6.8
Performance Implications of Dynamic Linking
7
Thread-Local Storage Allocation and Addressing
7.1
About Multi-Threading and Thread-Local Storage
7.2
Terms and Concepts
7.3
User Interface
7.4
ELF Object File Representation
7.5
TLS Access Models
7.5.1
C6x Linux TLS Models
7.5.1.1
General Dynamic TLS Access Model
7.5.1.2
Local Dynamic TLS Access Model
7.5.1.3
Initial Exec TLS Access Model
7.5.1.3.1
Thread Pointer
7.5.1.3.2
Initial Exec TLS Addressing
7.5.1.4
Local Exec TLS Access Model
7.5.2
Static Executable TLS Model
7.5.2.1
Static Executable Addressing
7.5.2.2
Static Executable TLS Runtime Architecture
7.5.2.3
Static Executable TLS Allocation
7.5.2.3.1
TLS Initialization Image Allocation
7.5.2.3.2
Main Thread’s TLS Allocation
7.5.2.3.3
Thread Library’s TLS Region Allocation
7.5.2.4
Static Executable TLS Initialization
7.5.2.4.1
Main Thread’s TLS Initialization
7.5.2.4.2
TLS Initialization by Thread Library
7.5.2.5
Thread Pointer
7.5.3
Bare-Metal Dynamic Linking TLS Model
7.5.3.1
Default TLS Addressing for Bare-Metal Dynamic Linking
7.5.3.2
TLS Block Creation
7.6
Thread-Local Symbol Resolution and Weak References
7.6.1
General and Local Dynamic TLS Weak Reference Addressing
7.6.2
Initial and Local Executable TLS Weak Reference Addressing
7.6.3
Static Exec and Bare Metal Dynamic TLS Model Weak References
8
Helper Function API
8.1
Floating-Point Behavior
8.2
C Helper Function API
8.3
Special Register Conventions for Helper Functions
8.4
Helper Functions for Complex Types
8.5
Floating-Point Helper Functions for C99
9
Standard C Library API
9.1
Reserved Symbols
9.2
<assert.h> Implementation
9.3
<complex.h> Implementation
9.4
<ctype.h> Implementation
9.5
<errno.h> Implementation
9.6
<float.h> Implementation
9.7
<inttypes.h> Implementation
9.8
<iso646.h> Implementation
9.9
<limits.h> Implementation
9.10
<locale.h> Implementation
9.11
<math.h> Implementation
9.12
<setjmp.h> Implementation
9.13
<signal.h> Implementation
9.14
<stdarg.h> Implementation
9.15
<stdbool.h> Implementation
9.16
<stddef.h> Implementation
9.17
<stdint.h> Implementation
9.18
<stdio.h> Implementation
9.19
<stdlib.h> Implementation
9.20
<string.h> Implementation
9.21
<tgmath.h> Implementation
9.22
<time.h> Implementation
9.23
<wchar.h> Implementation
9.24
<wctype.h> Implementation
10
C++ ABI
10.1
Limits (GC++ABI 1.2)
10.2
Export Template (GC++ABI 1.4.2)
10.3
Data Layout (GC++ABI Chapter 2)
10.4
Initialization Guard Variables (GC++ABI 2.8)
10.5
Constructor Return Value (GC++ABI 3.1.5)
10.6
One-Time Construction API (GC++ABI 3.3.2)
10.7
Controlling Object Construction Order (GC++ ABI 3.3.4)
10.8
Demangler API (GC++ABI 3.4)
10.9
Static Data (GC++ ABI 5.2.2)
10.10
Virtual Tables and the Key function (GC++ABI 5.2.3)
10.11
Unwind Table Location (GC++ABI 5.3)
11
Exception Handling
11.1
Overview
11.2
PREL31 Encoding
11.3
The Exception Index Table (EXIDX)
11.3.1
Pointer to Out-of-Line EXTAB Entry
11.3.2
EXIDX_CANTUNWIND
11.3.3
Inlined EXTAB Entry
11.4
The Exception Handling Instruction Table (EXTAB)
11.4.1
EXTAB Generic Model
11.4.2
EXTAB Compact Model
11.4.3
Personality Routines
11.5
Unwinding Instructions
11.5.1
Common Sequence
11.5.2
Byte-Encoded Unwinding Instructions
11.5.3
24-Bit Unwinding Encoding
11.6
Descriptors
11.6.1
Encoding of Type Identifiers
11.6.2
Scope
11.6.3
Cleanup Descriptor
11.6.4
Catch Descriptor
11.6.5
Function Exception Specification (FESPEC) Descriptor
11.7
Special Sections
11.8
Interaction With Non-C++ Code
11.8.1
Automatic EXIDX Entry Generation
11.8.2
Hand-Coded Assembly Functions
11.9
Interaction With System Features
11.9.1
Shared Libraries
11.9.2
Overlays
11.9.3
Interrupts
11.10
Assembly Language Operators in the TI Toolchain
12
DWARF
12.1
DWARF Register Names
12.2
Call Frame Information
12.3
Vendor Names
12.4
Vendor Extensions
13
ELF Object Files (Processor Supplement)
13.1
Registered Vendor Names
13.2
ELF Header
13.3
Sections
13.3.1
Section Indexes
13.3.2
Section Types
13.3.3
Extended Section Header Attributes
13.3.4
Subsections
13.3.5
Special Sections
13.3.6
Section Alignment
13.4
Symbol Table
13.4.1
Symbol Types
13.4.2
Common Block Symbols
13.4.3
Symbol Names
13.4.4
Reserved Symbol Names
13.4.5
Mapping Symbols
13.5
Relocation
13.5.1
Relocation Types
13.5.2
Relocation Operations
13.5.3
Relocation of Unresolved Weak References
14
ELF Program Loading and Dynamic Linking (Processor Supplement)
14.1
Program Header
14.1.1
Base Address
14.1.2
Segment Contents
14.1.3
Bound and Read-Only Segments
14.1.4
Thread-Local Storage
14.2
Program Loading
14.3
Dynamic Linking
14.3.1
Program Interpreter
14.3.2
Dynamic Section
14.3.3
Shared Object Dependencies
14.3.4
Global Offset Table
14.3.5
Procedure Linkage Table
14.3.6
Preemption
14.3.7
Initialization and Termination
14.4
Bare-Metal Dynamic Linking Model
14.4.1
File Types
14.4.2
ELF Identification
14.4.3
Visibility and Binding
14.4.4
Data Addressing
14.4.5
Code Addressing
14.4.6
Dynamic Information
15
Linux ABI
15.1
File Types
15.2
ELF Identification
15.3
Program Headers and Segments
15.4
Data Addressing
15.4.1
Data Segment Base Table (DSBT)
15.4.2
Global Offset Table (GOT)
15.5
Code Addressing
15.6
Lazy Binding
15.7
Visibility
15.8
Preemption
15.9
Import-as-Own Preemption
15.10
Program Loading
15.11
Dynamic Information
15.12
Initialization and Termination Functions
15.13
Summary of the Linux Model
16
Symbol Versioning
16.1
ELF Symbol Versioning Overview
16.2
Version Section Identification
17
Build Attributes
17.1
C6000 ABI Build Attribute Subsection
17.2
C6000 Build Attribute Tags
18
Copy Tables and Variable Initialization
18.1
Copy Table Format
18.2
Compressed Data Formats
18.2.1
RLE
18.2.2
LZSS Format
18.3
Variable Initialization
19
Extended Program Header Attributes
19.1
Encoding
19.2
Attribute Tag Definitions
19.3
Extended Program Header Attributes Section Format
20
Revision History
11.8
Interaction With Non-C++ Code