blob: 52dadc74e3595d6e85691895d32bd155768349a2 [file] [log] [blame]
Nico Rieck18d49ac2013-04-10 23:28:17 +00001===============
2LLVM Extensions
3===============
4
5.. contents::
6 :local:
Nico Rieck18d49ac2013-04-10 23:28:17 +00007
8.. toctree::
9 :hidden:
10
11Introduction
12============
13
14This document describes extensions to tools and formats LLVM seeks compatibility
15with.
16
Tim Northover003f93f2013-08-14 15:27:20 +000017General Assembly Syntax
18===========================
19
20C99-style Hexadecimal Floating-point Constants
21----------------------------------------------
22
23LLVM's assemblers allow floating-point constants to be written in C99's
24hexadecimal format instead of decimal if desired.
25
26.. code-block:: gas
27 .section .data
28 .float 0x1c2.2ap3
29
Nico Rieck18d49ac2013-04-10 23:28:17 +000030Machine-specific Assembly Syntax
31================================
32
33X86/COFF-Dependent
34------------------
35
Nico Rieck80646282013-07-06 12:13:10 +000036Relocations
37^^^^^^^^^^^
38
Nico Rieck18d49ac2013-04-10 23:28:17 +000039The following additional relocation type is supported:
40
41**@IMGREL** (AT&T syntax only) generates an image-relative relocation that
42corresponds 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
Nico Rieck80646282013-07-06 12:13:10 +000055
56
57``.linkonce`` Directive
58^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
59
60Syntax:
61
62 ``.linkonce [ comdat type [ section identifier ] ]``
63
64Supported 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 ...