blob: 78ff874abf096877799d3933555e1b4cc48c8ffb [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
17Machine-specific Assembly Syntax
18================================
19
20X86/COFF-Dependent
21------------------
22
Nico Rieck80646282013-07-06 12:13:10 +000023Relocations
24^^^^^^^^^^^
25
Nico Rieck18d49ac2013-04-10 23:28:17 +000026The following additional relocation type is supported:
27
28**@IMGREL** (AT&T syntax only) generates an image-relative relocation that
29corresponds to the COFF relocation types ``IMAGE_REL_I386_DIR32NB`` (32-bit) or
30``IMAGE_REL_AMD64_ADDR32NB`` (64-bit).
31
32.. code-block:: gas
33
34 .text
35 fun:
36 mov foo@IMGREL(%ebx, %ecx, 4), %eax
37
38 .section .pdata
39 .long fun@IMGREL
40 .long (fun@imgrel + 0x3F)
41 .long $unwind$fun@imgrel
Nico Rieck80646282013-07-06 12:13:10 +000042
43
44``.linkonce`` Directive
45^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46
47Syntax:
48
49 ``.linkonce [ comdat type [ section identifier ] ]``
50
51Supported COMDAT types:
52
53``discard``
54 Discards duplicate sections with the same COMDAT symbol. This is the default
55 if no type is specified.
56
57``one_only``
58 If the symbol is defined multiple times, the linker issues an error.
59
60``same_size``
61 Duplicates are discarded, but the linker issues an error if any have
62 different sizes.
63
64``same_contents``
65 Duplicates are discarded, but the linker issues an error if any duplicates
66 do not have exactly the same content.
67
68``associative``
69 Links the section if a certain other COMDAT section is linked. This other
70 section is indicated by its section identifier following the comdat type.
71 The following restrictions apply to the associated section:
72
73 1. It must be the name of a section already defined.
74 2. It must differ from the current section.
75 3. It must be a COMDAT section.
76 4. It cannot be another associative COMDAT section.
77
78``largest``
79 Links the largest section from among the duplicates.
80
81``newest``
82 Links the newest section from among the duplicates.
83
84
85.. code-block:: gas
86
87 .section .text$foo
88 .linkonce
89 ...
90
91 .section .xdata$foo
92 .linkonce associative .text$foo
93 ...