Add the C99 hex-float assembly syntax to our extension document.
[oota-llvm.git] / docs / Extensions.rst
1 ===============
2 LLVM Extensions
3 ===============
4
5 .. contents::
6    :local:
7
8 .. toctree::
9    :hidden:
10
11 Introduction
12 ============
13
14 This document describes extensions to tools and formats LLVM seeks compatibility
15 with.
16
17 General Assembly Syntax
18 ===========================
19
20 C99-style Hexadecimal Floating-point Constants
21 ----------------------------------------------
22
23 LLVM's assemblers allow floating-point constants to be written in C99's
24 hexadecimal format instead of decimal if desired.
25
26 .. code-block:: gas
27   .section .data
28   .float 0x1c2.2ap3
29
30 Machine-specific Assembly Syntax
31 ================================
32
33 X86/COFF-Dependent
34 ------------------
35
36 Relocations
37 ^^^^^^^^^^^
38
39 The following additional relocation type is supported:
40
41 **@IMGREL** (AT&T syntax only) generates an image-relative relocation that
42 corresponds to the COFF relocation types ``IMAGE_REL_I386_DIR32NB`` (32-bit) or
43 ``IMAGE_REL_AMD64_ADDR32NB`` (64-bit).
44
45 .. code-block:: gas
46
47   .text
48   fun:
49     mov foo@IMGREL(%ebx, %ecx, 4), %eax
50
51   .section .pdata
52     .long fun@IMGREL
53     .long (fun@imgrel + 0x3F)
54     .long $unwind$fun@imgrel
55
56
57 ``.linkonce`` Directive
58 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
59
60 Syntax:
61
62    ``.linkonce [ comdat type [ section identifier ] ]``
63
64 Supported COMDAT types:
65
66 ``discard``
67    Discards duplicate sections with the same COMDAT symbol. This is the default
68    if no type is specified.
69
70 ``one_only``
71    If the symbol is defined multiple times, the linker issues an error.
72
73 ``same_size``
74    Duplicates are discarded, but the linker issues an error if any have
75    different sizes.
76
77 ``same_contents``
78    Duplicates are discarded, but the linker issues an error if any duplicates
79    do not have exactly the same content.
80
81 ``associative``
82    Links the section if a certain other COMDAT section is linked. This other
83    section is indicated by its section identifier following the comdat type.
84    The following restrictions apply to the associated section:
85
86    1. It must be the name of a section already defined.
87    2. It must differ from the current section.
88    3. It must be a COMDAT section.
89    4. It cannot be another associative COMDAT section.
90
91 ``largest``
92    Links the largest section from among the duplicates.
93
94 ``newest``
95    Links the newest section from among the duplicates.
96
97
98 .. code-block:: gas
99
100   .section .text$foo
101   .linkonce
102     ...
103
104   .section .xdata$foo
105   .linkonce associative .text$foo
106     ...