source: trunk/binutils/gas/doc/as.info-4@ 3003

Last change on this file since 3003 was 610, checked in by bird, 22 years ago

This commit was generated by cvs2svn to compensate for changes in r609,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 51.0 KB
Line 
1This is as.info, produced by makeinfo version 4.3 from as.texinfo.
2
3START-INFO-DIR-ENTRY
4* As: (as). The GNU assembler.
5* Gas: (as). The GNU assembler.
6END-INFO-DIR-ENTRY
7
8 This file documents the GNU Assembler "as".
9
10 Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002
11Free Software Foundation, Inc.
12
13 Permission is granted to copy, distribute and/or modify this document
14under the terms of the GNU Free Documentation License, Version 1.1 or
15any later version published by the Free Software Foundation; with no
16Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
17Texts. A copy of the license is included in the section entitled "GNU
18Free Documentation License".
19
20
21File: as.info, Node: Tag, Next: Text, Prev: Symver, Up: Pseudo Ops
22
23`.tag STRUCTNAME'
24=================
25
26 This directive is generated by compilers to include auxiliary
27debugging information in the symbol table. It is only permitted inside
28`.def'/`.endef' pairs. Tags are used to link structure definitions in
29the symbol table with instances of those structures.
30
31 `.tag' is only used when generating COFF format output; when `as' is
32generating `b.out', it accepts this directive but ignores it.
33
34
35File: as.info, Node: Text, Next: Title, Prev: Tag, Up: Pseudo Ops
36
37`.text SUBSECTION'
38==================
39
40 Tells `as' to assemble the following statements onto the end of the
41text subsection numbered SUBSECTION, which is an absolute expression.
42If SUBSECTION is omitted, subsection number zero is used.
43
44
45File: as.info, Node: Title, Next: Type, Prev: Text, Up: Pseudo Ops
46
47`.title "HEADING"'
48==================
49
50 Use HEADING as the title (second line, immediately after the source
51file name and pagenumber) when generating assembly listings.
52
53 This directive affects subsequent pages, as well as the current page
54if it appears within ten lines of the top of a page.
55
56
57File: as.info, Node: Type, Next: Uleb128, Prev: Title, Up: Pseudo Ops
58
59`.type'
60=======
61
62 This directive is used to set the type of a symbol.
63
64COFF Version
65------------
66
67 For COFF targets, this directive is permitted only within
68`.def'/`.endef' pairs. It is used like this:
69
70 .type INT
71
72 This records the integer INT as the type attribute of a symbol table
73entry.
74
75 `.type' is associated only with COFF format output; when `as' is
76configured for `b.out' output, it accepts this directive but ignores it.
77
78ELF Version
79-----------
80
81 For ELF targets, the `.type' directive is used like this:
82
83 .type NAME , TYPE DESCRIPTION
84
85 This sets the type of symbol NAME to be either a function symbol or
86an object symbol. There are five different syntaxes supported for the
87TYPE DESCRIPTION field, in order to provide compatibility with various
88other assemblers. The syntaxes supported are:
89
90 .type <name>,#function
91 .type <name>,#object
92
93 .type <name>,@function
94 .type <name>,@object
95
96 .type <name>,%function
97 .type <name>,%object
98
99 .type <name>,"function"
100 .type <name>,"object"
101
102 .type <name> STT_FUNCTION
103 .type <name> STT_OBJECT
104
105
106File: as.info, Node: Uleb128, Next: Val, Prev: Type, Up: Pseudo Ops
107
108`.uleb128 EXPRESSIONS'
109======================
110
111 ULEB128 stands for "unsigned little endian base 128." This is a
112compact, variable length representation of numbers used by the DWARF
113symbolic debugging format. *Note `.sleb128': Sleb128.
114
115
116File: as.info, Node: Val, Next: Version, Prev: Uleb128, Up: Pseudo Ops
117
118`.val ADDR'
119===========
120
121 This directive, permitted only within `.def'/`.endef' pairs, records
122the address ADDR as the value attribute of a symbol table entry.
123
124 `.val' is used only for COFF output; when `as' is configured for
125`b.out', it accepts this directive but ignores it.
126
127
128File: as.info, Node: Version, Next: VTableEntry, Prev: Val, Up: Pseudo Ops
129
130`.version "STRING"'
131===================
132
133 This directive creates a `.note' section and places into it an ELF
134formatted note of type NT_VERSION. The note's name is set to `string'.
135
136
137File: as.info, Node: VTableEntry, Next: VTableInherit, Prev: Version, Up: Pseudo Ops
138
139`.vtable_entry TABLE, OFFSET'
140=============================
141
142 This directive finds or creates a symbol `table' and creates a
143`VTABLE_ENTRY' relocation for it with an addend of `offset'.
144
145
146File: as.info, Node: VTableInherit, Next: Weak, Prev: VTableEntry, Up: Pseudo Ops
147
148`.vtable_inherit CHILD, PARENT'
149===============================
150
151 This directive finds the symbol `child' and finds or creates the
152symbol `parent' and then creates a `VTABLE_INHERIT' relocation for the
153parent whose addend is the value of the child symbol. As a special
154case the parent name of `0' is treated as refering the `*ABS*' section.
155
156
157File: as.info, Node: Weak, Next: Word, Prev: VTableInherit, Up: Pseudo Ops
158
159`.weak NAMES'
160=============
161
162 This directive sets the weak attribute on the comma separated list
163of symbol `names'. If the symbols do not already exist, they will be
164created.
165
166
167File: as.info, Node: Word, Next: Deprecated, Prev: Weak, Up: Pseudo Ops
168
169`.word EXPRESSIONS'
170===================
171
172 This directive expects zero or more EXPRESSIONS, of any section,
173separated by commas.
174
175 The size of the number emitted, and its byte order, depend on what
176target computer the assembly is for.
177
178 _Warning: Special Treatment to support Compilers_
179
180 Machines with a 32-bit address space, but that do less than 32-bit
181addressing, require the following special treatment. If the machine of
182interest to you does 32-bit addressing (or doesn't require it; *note
183Machine Dependencies::), you can ignore this issue.
184
185 In order to assemble compiler output into something that works, `as'
186occasionally does strange things to `.word' directives. Directives of
187the form `.word sym1-sym2' are often emitted by compilers as part of
188jump tables. Therefore, when `as' assembles a directive of the form
189`.word sym1-sym2', and the difference between `sym1' and `sym2' does
190not fit in 16 bits, `as' creates a "secondary jump table", immediately
191before the next label. This secondary jump table is preceded by a
192short-jump to the first byte after the secondary table. This
193short-jump prevents the flow of control from accidentally falling into
194the new table. Inside the table is a long-jump to `sym2'. The
195original `.word' contains `sym1' minus the address of the long-jump to
196`sym2'.
197
198 If there were several occurrences of `.word sym1-sym2' before the
199secondary jump table, all of them are adjusted. If there was a `.word
200sym3-sym4', that also did not fit in sixteen bits, a long-jump to
201`sym4' is included in the secondary jump table, and the `.word'
202directives are adjusted to contain `sym3' minus the address of the
203long-jump to `sym4'; and so on, for as many entries in the original
204jump table as necessary.
205
206
207File: as.info, Node: Deprecated, Prev: Word, Up: Pseudo Ops
208
209Deprecated Directives
210=====================
211
212 One day these directives won't work. They are included for
213compatibility with older assemblers.
214.abort
215
216.line
217
218File: as.info, Node: Machine Dependencies, Next: Reporting Bugs, Prev: Pseudo Ops, Up: Top
219
220Machine Dependent Features
221**************************
222
223 The machine instruction sets are (almost by definition) different on
224each machine where `as' runs. Floating point representations vary as
225well, and `as' often supports a few additional directives or
226command-line options for compatibility with other assemblers on a
227particular platform. Finally, some versions of `as' support special
228pseudo-instructions for branch optimization.
229
230 This chapter discusses most of these differences, though it does not
231include details on any machine's instruction set. For details on that
232subject, see the hardware manufacturer's manual.
233
234* Menu:
235
236
237* AMD29K-Dependent:: AMD 29K Dependent Features
238
239* Alpha-Dependent:: Alpha Dependent Features
240
241* ARC-Dependent:: ARC Dependent Features
242
243* ARM-Dependent:: ARM Dependent Features
244
245* CRIS-Dependent:: CRIS Dependent Features
246
247* D10V-Dependent:: D10V Dependent Features
248
249* D30V-Dependent:: D30V Dependent Features
250
251* H8/300-Dependent:: Renesas H8/300 Dependent Features
252
253* H8/500-Dependent:: Renesas H8/500 Dependent Features
254
255* HPPA-Dependent:: HPPA Dependent Features
256
257* ESA/390-Dependent:: IBM ESA/390 Dependent Features
258
259* i386-Dependent:: Intel 80386 and AMD x86-64 Dependent Features
260
261* i860-Dependent:: Intel 80860 Dependent Features
262
263* i960-Dependent:: Intel 80960 Dependent Features
264
265* IP2K-Dependent:: IP2K Dependent Features
266
267* M32R-Dependent:: M32R Dependent Features
268
269* M68K-Dependent:: M680x0 Dependent Features
270
271* M68HC11-Dependent:: M68HC11 and 68HC12 Dependent Features
272
273* M88K-Dependent:: M880x0 Dependent Features
274
275* MIPS-Dependent:: MIPS Dependent Features
276
277* MMIX-Dependent:: MMIX Dependent Features
278
279* MSP430-Dependent:: MSP430 Dependent Features
280
281* SH-Dependent:: Renesas / SuperH SH Dependent Features
282* SH64-Dependent:: SuperH SH64 Dependent Features
283
284* PDP-11-Dependent:: PDP-11 Dependent Features
285
286* PJ-Dependent:: picoJava Dependent Features
287
288* PPC-Dependent:: PowerPC Dependent Features
289
290* Sparc-Dependent:: SPARC Dependent Features
291
292* TIC54X-Dependent:: TI TMS320C54x Dependent Features
293
294* V850-Dependent:: V850 Dependent Features
295
296* Xtensa-Dependent:: Xtensa Dependent Features
297
298* Z8000-Dependent:: Z8000 Dependent Features
299
300* Vax-Dependent:: VAX Dependent Features
301
302
303File: as.info, Node: AMD29K-Dependent, Next: Alpha-Dependent, Up: Machine Dependencies
304
305AMD 29K Dependent Features
306==========================
307
308* Menu:
309
310* AMD29K Options:: Options
311* AMD29K Syntax:: Syntax
312* AMD29K Floating Point:: Floating Point
313* AMD29K Directives:: AMD 29K Machine Directives
314* AMD29K Opcodes:: Opcodes
315
316
317File: as.info, Node: AMD29K Options, Next: AMD29K Syntax, Up: AMD29K-Dependent
318
319Options
320-------
321
322 `as' has no additional command-line options for the AMD 29K family.
323
324
325File: as.info, Node: AMD29K Syntax, Next: AMD29K Floating Point, Prev: AMD29K Options, Up: AMD29K-Dependent
326
327Syntax
328------
329
330* Menu:
331
332* AMD29K-Macros:: Macros
333* AMD29K-Chars:: Special Characters
334* AMD29K-Regs:: Register Names
335
336
337File: as.info, Node: AMD29K-Macros, Next: AMD29K-Chars, Up: AMD29K Syntax
338
339Macros
340......
341
342 The macro syntax used on the AMD 29K is like that described in the
343AMD 29K Family Macro Assembler Specification. Normal `as' macros
344should still work.
345
346
347File: as.info, Node: AMD29K-Chars, Next: AMD29K-Regs, Prev: AMD29K-Macros, Up: AMD29K Syntax
348
349Special Characters
350..................
351
352 `;' is the line comment character.
353
354 The character `?' is permitted in identifiers (but may not begin an
355identifier).
356
357
358File: as.info, Node: AMD29K-Regs, Prev: AMD29K-Chars, Up: AMD29K Syntax
359
360Register Names
361..............
362
363 General-purpose registers are represented by predefined symbols of
364the form `GRNNN' (for global registers) or `LRNNN' (for local
365registers), where NNN represents a number between `0' and `127',
366written with no leading zeros. The leading letters may be in either
367upper or lower case; for example, `gr13' and `LR7' are both valid
368register names.
369
370 You may also refer to general-purpose registers by specifying the
371register number as the result of an expression (prefixed with `%%' to
372flag the expression as a register number):
373 %%EXPRESSION
374
375--where EXPRESSION must be an absolute expression evaluating to a
376number between `0' and `255'. The range [0, 127] refers to global
377registers, and the range [128, 255] to local registers.
378
379 In addition, `as' understands the following protected
380special-purpose register names for the AMD 29K family:
381
382 vab chd pc0
383 ops chc pc1
384 cps rbp pc2
385 cfg tmc mmu
386 cha tmr lru
387
388 These unprotected special-purpose register names are also recognized:
389 ipc alu fpe
390 ipa bp inte
391 ipb fc fps
392 q cr exop
393
394
395File: as.info, Node: AMD29K Floating Point, Next: AMD29K Directives, Prev: AMD29K Syntax, Up: AMD29K-Dependent
396
397Floating Point
398--------------
399
400 The AMD 29K family uses IEEE floating-point numbers.
401
402
403File: as.info, Node: AMD29K Directives, Next: AMD29K Opcodes, Prev: AMD29K Floating Point, Up: AMD29K-Dependent
404
405AMD 29K Machine Directives
406--------------------------
407
408`.block SIZE , FILL'
409 This directive emits SIZE bytes, each of value FILL. Both SIZE
410 and FILL are absolute expressions. If the comma and FILL are
411 omitted, FILL is assumed to be zero.
412
413 In other versions of the GNU assembler, this directive is called
414 `.space'.
415
416`.cputype'
417 This directive is ignored; it is accepted for compatibility with
418 other AMD 29K assemblers.
419
420`.file'
421 This directive is ignored; it is accepted for compatibility with
422 other AMD 29K assemblers.
423
424 _Warning:_ in other versions of the GNU assembler, `.file' is
425 used for the directive called `.app-file' in the AMD 29K
426 support.
427
428`.line'
429 This directive is ignored; it is accepted for compatibility with
430 other AMD 29K assemblers.
431
432`.sect'
433 This directive is ignored; it is accepted for compatibility with
434 other AMD 29K assemblers.
435
436`.use SECTION NAME'
437 Establishes the section and subsection for the following code;
438 SECTION NAME may be one of `.text', `.data', `.data1', or `.lit'.
439 With one of the first three SECTION NAME options, `.use' is
440 equivalent to the machine directive SECTION NAME; the remaining
441 case, `.use .lit', is the same as `.data 200'.
442
443
444File: as.info, Node: AMD29K Opcodes, Prev: AMD29K Directives, Up: AMD29K-Dependent
445
446Opcodes
447-------
448
449 `as' implements all the standard AMD 29K opcodes. No additional
450pseudo-instructions are needed on this family.
451
452 For information on the 29K machine instruction set, see `Am29000
453User's Manual', Advanced Micro Devices, Inc.
454
455
456File: as.info, Node: Alpha-Dependent, Next: ARC-Dependent, Prev: AMD29K-Dependent, Up: Machine Dependencies
457
458Alpha Dependent Features
459========================
460
461* Menu:
462
463* Alpha Notes:: Notes
464* Alpha Options:: Options
465* Alpha Syntax:: Syntax
466* Alpha Floating Point:: Floating Point
467* Alpha Directives:: Alpha Machine Directives
468* Alpha Opcodes:: Opcodes
469
470
471File: as.info, Node: Alpha Notes, Next: Alpha Options, Up: Alpha-Dependent
472
473Notes
474-----
475
476 The documentation here is primarily for the ELF object format. `as'
477also supports the ECOFF and EVAX formats, but features specific to
478these formats are not yet documented.
479
480
481File: as.info, Node: Alpha Options, Next: Alpha Syntax, Prev: Alpha Notes, Up: Alpha-Dependent
482
483Options
484-------
485
486`-mCPU'
487 This option specifies the target processor. If an attempt is made
488 to assemble an instruction which will not execute on the target
489 processor, the assembler may either expand the instruction as a
490 macro or issue an error message. This option is equivalent to the
491 `.arch' directive.
492
493 The following processor names are recognized: `21064', `21064a',
494 `21066', `21068', `21164', `21164a', `21164pc', `21264', `21264a',
495 `21264b', `ev4', `ev5', `lca45', `ev5', `ev56', `pca56', `ev6',
496 `ev67', `ev68'. The special name `all' may be used to allow the
497 assembler to accept instructions valid for any Alpha processor.
498
499 In order to support existing practice in OSF/1 with respect to
500 `.arch', and existing practice within `MILO' (the Linux ARC
501 bootloader), the numbered processor names (e.g. 21064) enable the
502 processor-specific PALcode instructions, while the
503 "electro-vlasic" names (e.g. `ev4') do not.
504
505`-mdebug'
506`-no-mdebug'
507 Enables or disables the generation of `.mdebug' encapsulation for
508 stabs directives and procedure descriptors. The default is to
509 automatically enable `.mdebug' when the first stabs directive is
510 seen.
511
512`-relax'
513 This option forces all relocations to be put into the object file,
514 instead of saving space and resolving some relocations at assembly
515 time. Note that this option does not propagate all symbol
516 arithmetic into the object file, because not all symbol arithmetic
517 can be represented. However, the option can still be useful in
518 specific applications.
519
520`-g'
521 This option is used when the compiler generates debug information.
522 When `gcc' is using `mips-tfile' to generate debug information
523 for ECOFF, local labels must be passed through to the object file.
524 Otherwise this option has no effect.
525
526`-GSIZE'
527 A local common symbol larger than SIZE is placed in `.bss', while
528 smaller symbols are placed in `.sbss'.
529
530`-F'
531`-32addr'
532 These options are ignored for backward compatibility.
533
534
535File: as.info, Node: Alpha Syntax, Next: Alpha Floating Point, Prev: Alpha Options, Up: Alpha-Dependent
536
537Syntax
538------
539
540 The assembler syntax closely follow the Alpha Reference Manual;
541assembler directives and general syntax closely follow the OSF/1 and
542OpenVMS syntax, with a few differences for ELF.
543
544* Menu:
545
546* Alpha-Chars:: Special Characters
547* Alpha-Regs:: Register Names
548* Alpha-Relocs:: Relocations
549
550
551File: as.info, Node: Alpha-Chars, Next: Alpha-Regs, Up: Alpha Syntax
552
553Special Characters
554..................
555
556 `#' is the line comment character.
557
558 `;' can be used instead of a newline to separate statements.
559
560
561File: as.info, Node: Alpha-Regs, Next: Alpha-Relocs, Prev: Alpha-Chars, Up: Alpha Syntax
562
563Register Names
564..............
565
566 The 32 integer registers are refered to as `$N' or `$rN'. In
567addition, registers 15, 28, 29, and 30 may be refered to by the symbols
568`$fp', `$at', `$gp', and `$sp' respectively.
569
570 The 32 floating-point registers are refered to as `$fN'.
571
572
573File: as.info, Node: Alpha-Relocs, Prev: Alpha-Regs, Up: Alpha Syntax
574
575Relocations
576...........
577
578 Some of these relocations are available for ECOFF, but mostly only
579for ELF. They are modeled after the relocation format introduced in
580Digial Unix 4.0, but there are additions.
581
582 The format is `!TAG' or `!TAG!NUMBER' where TAG is the name of the
583relocation. In some cases NUMBER is used to relate specific
584instructions.
585
586 The relocation is placed at the end of the instruction like so:
587
588 ldah $0,a($29) !gprelhigh
589 lda $0,a($0) !gprellow
590 ldq $1,b($29) !literal!100
591 ldl $2,0($1) !lituse_base!100
592
593`!literal'
594`!literal!N'
595 Used with an `ldq' instruction to load the address of a symbol
596 from the GOT.
597
598 A sequence number N is optional, and if present is used to pair
599 `lituse' relocations with this `literal' relocation. The `lituse'
600 relocations are used by the linker to optimize the code based on
601 the final location of the symbol.
602
603 Note that these optimizations are dependent on the data flow of the
604 program. Therefore, if _any_ `lituse' is paired with a `literal'
605 relocation, then _all_ uses of the register set by the `literal'
606 instruction must also be marked with `lituse' relocations. This
607 is because the original `literal' instruction may be deleted or
608 transformed into another instruction.
609
610 Also note that there may be a one-to-many relationship between
611 `literal' and `lituse', but not a many-to-one. That is, if there
612 are two code paths that load up the same address and feed the
613 value to a single use, then the use may not use a `lituse'
614 relocation.
615
616`!lituse_base!N'
617 Used with any memory format instruction (e.g. `ldl') to indicate
618 that the literal is used for an address load. The offset field of
619 the instruction must be zero. During relaxation, the code may be
620 altered to use a gp-relative load.
621
622`!lituse_jsr!N'
623 Used with a register branch format instruction (e.g. `jsr') to
624 indicate that the literal is used for a call. During relaxation,
625 the code may be altered to use a direct branch (e.g. `bsr').
626
627`!lituse_bytoff!N'
628 Used with a byte mask instruction (e.g. `extbl') to indicate that
629 only the low 3 bits of the address are relevant. During
630 relaxation, the code may be altered to use an immediate instead of
631 a register shift.
632
633`!lituse_addr!N'
634 Used with any other instruction to indicate that the original
635 address is in fact used, and the original `ldq' instruction may
636 not be altered or deleted. This is useful in conjunction with
637 `lituse_jsr' to test whether a weak symbol is defined.
638
639 ldq $27,foo($29) !literal!1
640 beq $27,is_undef !lituse_addr!1
641 jsr $26,($27),foo !lituse_jsr!1
642
643`!lituse_tlsgd!N'
644 Used with a register branch format instruction to indicate that the
645 literal is the call to `__tls_get_addr' used to compute the
646 address of the thread-local storage variable whose descriptor was
647 loaded with `!tlsgd!N'.
648
649`!lituse_tlsldm!N'
650 Used with a register branch format instruction to indicate that the
651 literal is the call to `__tls_get_addr' used to compute the
652 address of the base of the thread-local storage block for the
653 current module. The descriptor for the module must have been
654 loaded with `!tlsldm!N'.
655
656`!gpdisp!N'
657 Used with `ldah' and `lda' to load the GP from the current
658 address, a-la the `ldgp' macro. The source register for the
659 `ldah' instruction must contain the address of the `ldah'
660 instruction. There must be exactly one `lda' instruction paired
661 with the `ldah' instruction, though it may appear anywhere in the
662 instruction stream. The immediate operands must be zero.
663
664 bsr $26,foo
665 ldah $29,0($26) !gpdisp!1
666 lda $29,0($29) !gpdisp!1
667
668`!gprelhigh'
669 Used with an `ldah' instruction to add the high 16 bits of a
670 32-bit displacement from the GP.
671
672`!gprellow'
673 Used with any memory format instruction to add the low 16 bits of a
674 32-bit displacement from the GP.
675
676`!gprel'
677 Used with any memory format instruction to add a 16-bit
678 displacement from the GP.
679
680`!samegp'
681 Used with any branch format instruction to skip the GP load at the
682 target address. The referenced symbol must have the same GP as the
683 source object file, and it must be declared to either not use `$27'
684 or perform a standard GP load in the first two instructions via the
685 `.prologue' directive.
686
687`!tlsgd'
688`!tlsgd!N'
689 Used with an `lda' instruction to load the address of a TLS
690 descriptor for a symbol in the GOT.
691
692 The sequence number N is optional, and if present it used to pair
693 the descriptor load with both the `literal' loading the address of
694 the `__tls_get_addr' function and the `lituse_tlsgd' marking the
695 call to that function.
696
697 For proper relaxation, both the `tlsgd', `literal' and `lituse'
698 relocations must be in the same extended basic block. That is,
699 the relocation with the lowest address must be executed first at
700 runtime.
701
702`!tlsldm'
703`!tlsldm!N'
704 Used with an `lda' instruction to load the address of a TLS
705 descriptor for the current module in the GOT.
706
707 Similar in other respects to `tlsgd'.
708
709`!gotdtprel'
710 Used with an `ldq' instruction to load the offset of the TLS
711 symbol within its module's thread-local storage block. Also known
712 as the dynamic thread pointer offset or dtp-relative offset.
713
714`!dtprelhi'
715`!dtprello'
716`!dtprel'
717 Like `gprel' relocations except they compute dtp-relative offsets.
718
719`!gottprel'
720 Used with an `ldq' instruction to load the offset of the TLS
721 symbol from the thread pointer. Also known as the tp-relative
722 offset.
723
724`!tprelhi'
725`!tprello'
726`!tprel'
727 Like `gprel' relocations except they compute tp-relative offsets.
728
729
730File: as.info, Node: Alpha Floating Point, Next: Alpha Directives, Prev: Alpha Syntax, Up: Alpha-Dependent
731
732Floating Point
733--------------
734
735 The Alpha family uses both IEEE and VAX floating-point numbers.
736
737
738File: as.info, Node: Alpha Directives, Next: Alpha Opcodes, Prev: Alpha Floating Point, Up: Alpha-Dependent
739
740Alpha Assembler Directives
741--------------------------
742
743 `as' for the Alpha supports many additional directives for
744compatibility with the native assembler. This section describes them
745only briefly.
746
747 These are the additional directives in `as' for the Alpha:
748
749`.arch CPU'
750 Specifies the target processor. This is equivalent to the `-mCPU'
751 command-line option. *Note Options: Alpha Options, for a list of
752 values for CPU.
753
754`.ent FUNCTION[, N]'
755 Mark the beginning of FUNCTION. An optional number may follow for
756 compatibility with the OSF/1 assembler, but is ignored. When
757 generating `.mdebug' information, this will create a procedure
758 descriptor for the function. In ELF, it will mark the symbol as a
759 function a-la the generic `.type' directive.
760
761`.end FUNCTION'
762 Mark the end of FUNCTION. In ELF, it will set the size of the
763 symbol a-la the generic `.size' directive.
764
765`.mask MASK, OFFSET'
766 Indicate which of the integer registers are saved in the current
767 function's stack frame. MASK is interpreted a bit mask in which
768 bit N set indicates that register N is saved. The registers are
769 saved in a block located OFFSET bytes from the "canonical frame
770 address" (CFA) which is the value of the stack pointer on entry to
771 the function. The registers are saved sequentially, except that
772 the return address register (normally `$26') is saved first.
773
774 This and the other directives that describe the stack frame are
775 currently only used when generating `.mdebug' information. They
776 may in the future be used to generate DWARF2 `.debug_frame' unwind
777 information for hand written assembly.
778
779`.fmask MASK, OFFSET'
780 Indicate which of the floating-point registers are saved in the
781 current stack frame. The MASK and OFFSET parameters are
782 interpreted as with `.mask'.
783
784`.frame FRAMEREG, FRAMEOFFSET, RETREG[, ARGOFFSET]'
785 Describes the shape of the stack frame. The frame pointer in use
786 is FRAMEREG; normally this is either `$fp' or `$sp'. The frame
787 pointer is FRAMEOFFSET bytes below the CFA. The return address is
788 initially located in RETREG until it is saved as indicated in
789 `.mask'. For compatibility with OSF/1 an optional ARGOFFSET
790 parameter is accepted and ignored. It is believed to indicate the
791 offset from the CFA to the saved argument registers.
792
793`.prologue N'
794 Indicate that the stack frame is set up and all registers have been
795 spilled. The argument N indicates whether and how the function
796 uses the incoming "procedure vector" (the address of the called
797 function) in `$27'. 0 indicates that `$27' is not used; 1
798 indicates that the first two instructions of the function use `$27'
799 to perform a load of the GP register; 2 indicates that `$27' is
800 used in some non-standard way and so the linker cannot elide the
801 load of the procedure vector during relaxation.
802
803`.gprel32 EXPRESSION'
804 Computes the difference between the address in EXPRESSION and the
805 GP for the current object file, and stores it in 4 bytes. In
806 addition to being smaller than a full 8 byte address, this also
807 does not require a dynamic relocation when used in a shared
808 library.
809
810`.t_floating EXPRESSION'
811 Stores EXPRESSION as an IEEE double precision value.
812
813`.s_floating EXPRESSION'
814 Stores EXPRESSION as an IEEE single precision value.
815
816`.f_floating EXPRESSION'
817 Stores EXPRESSION as a VAX F format value.
818
819`.g_floating EXPRESSION'
820 Stores EXPRESSION as a VAX G format value.
821
822`.d_floating EXPRESSION'
823 Stores EXPRESSION as a VAX D format value.
824
825`.set FEATURE'
826 Enables or disables various assembler features. Using the positive
827 name of the feature enables while using `noFEATURE' disables.
828
829 `at'
830 Indicates that macro expansions may clobber the "assembler
831 temporary" (`$at' or `$28') register. Some macros may not be
832 expanded without this and will generate an error message if
833 `noat' is in effect. When `at' is in effect, a warning will
834 be generated if `$at' is used by the programmer.
835
836 `macro'
837 Enables the expansion of macro instructions. Note that
838 variants of real instructions, such as `br label' vs `br
839 $31,label' are considered alternate forms and not macros.
840
841 `move'
842 `reorder'
843 `volatile'
844 These control whether and how the assembler may re-order
845 instructions. Accepted for compatibility with the OSF/1
846 assembler, but `as' does not do instruction scheduling, so
847 these features are ignored.
848
849 The following directives are recognized for compatibility with the
850OSF/1 assembler but are ignored.
851
852 .proc .aproc
853 .reguse .livereg
854 .option .aent
855 .ugen .eflag
856 .alias .noalias
857
858
859File: as.info, Node: Alpha Opcodes, Prev: Alpha Directives, Up: Alpha-Dependent
860
861Opcodes
862-------
863
864 For detailed information on the Alpha machine instruction set, see
865the Alpha Architecture Handbook
866(ftp://ftp.digital.com/pub/Digital/info/semiconductor/literature/alphaahb.pdf).
867
868
869File: as.info, Node: ARC-Dependent, Next: ARM-Dependent, Prev: Alpha-Dependent, Up: Machine Dependencies
870
871ARC Dependent Features
872======================
873
874* Menu:
875
876* ARC Options:: Options
877* ARC Syntax:: Syntax
878* ARC Floating Point:: Floating Point
879* ARC Directives:: ARC Machine Directives
880* ARC Opcodes:: Opcodes
881
882
883File: as.info, Node: ARC Options, Next: ARC Syntax, Up: ARC-Dependent
884
885Options
886-------
887
888`-marc[5|6|7|8]'
889 This option selects the core processor variant. Using `-marc' is
890 the same as `-marc6', which is also the default.
891
892 `arc5'
893 Base instruction set.
894
895 `arc6'
896 Jump-and-link (jl) instruction. No requirement of an
897 instruction between setting flags and conditional jump. For
898 example:
899
900 mov.f r0,r1
901 beq foo
902
903 `arc7'
904 Break (brk) and sleep (sleep) instructions.
905
906 `arc8'
907 Software interrupt (swi) instruction.
908
909 Note: the `.option' directive can to be used to select a core
910 variant from within assembly code.
911
912`-EB'
913 This option specifies that the output generated by the assembler
914 should be marked as being encoded for a big-endian processor.
915
916`-EL'
917 This option specifies that the output generated by the assembler
918 should be marked as being encoded for a little-endian processor -
919 this is the default.
920
921
922File: as.info, Node: ARC Syntax, Next: ARC Floating Point, Prev: ARC Options, Up: ARC-Dependent
923
924Syntax
925------
926
927* Menu:
928
929* ARC-Chars:: Special Characters
930* ARC-Regs:: Register Names
931
932
933File: as.info, Node: ARC-Chars, Next: ARC-Regs, Up: ARC Syntax
934
935Special Characters
936..................
937
938 *TODO*
939
940
941File: as.info, Node: ARC-Regs, Prev: ARC-Chars, Up: ARC Syntax
942
943Register Names
944..............
945
946 *TODO*
947
948
949File: as.info, Node: ARC Floating Point, Next: ARC Directives, Prev: ARC Syntax, Up: ARC-Dependent
950
951Floating Point
952--------------
953
954 The ARC core does not currently have hardware floating point
955support. Software floating point support is provided by `GCC' and uses
956IEEE floating-point numbers.
957
958
959File: as.info, Node: ARC Directives, Next: ARC Opcodes, Prev: ARC Floating Point, Up: ARC-Dependent
960
961ARC Machine Directives
962----------------------
963
964 The ARC version of `as' supports the following additional machine
965directives:
966
967`.2byte EXPRESSIONS'
968 *TODO*
969
970`.3byte EXPRESSIONS'
971 *TODO*
972
973`.4byte EXPRESSIONS'
974 *TODO*
975
976`.extAuxRegister NAME,ADDRESS,MODE'
977 *TODO*
978
979 .extAuxRegister mulhi,0x12,w
980
981`.extCondCode SUFFIX,VALUE'
982 *TODO*
983
984 .extCondCode is_busy,0x14
985
986`.extCoreRegister NAME,REGNUM,MODE,SHORTCUT'
987 *TODO*
988
989 .extCoreRegister mlo,57,r,can_shortcut
990
991`.extInstruction NAME,OPCODE,SUBOPCODE,SUFFIXCLASS,SYNTAXCLASS'
992 *TODO*
993
994 .extInstruction mul64,0x14,0x0,SUFFIX_COND,SYNTAX_3OP|OP1_MUST_BE_IMM
995
996`.half EXPRESSIONS'
997 *TODO*
998
999`.long EXPRESSIONS'
1000 *TODO*
1001
1002`.option ARC|ARC5|ARC6|ARC7|ARC8'
1003 The `.option' directive must be followed by the desired core
1004 version. Again `arc' is an alias for `arc6'.
1005
1006 Note: the `.option' directive overrides the command line option
1007 `-marc'; a warning is emitted when the version is not consistent
1008 between the two - even for the implicit default core version
1009 (arc6).
1010
1011`.short EXPRESSIONS'
1012 *TODO*
1013
1014`.word EXPRESSIONS'
1015 *TODO*
1016
1017
1018File: as.info, Node: ARC Opcodes, Prev: ARC Directives, Up: ARC-Dependent
1019
1020Opcodes
1021-------
1022
1023 For information on the ARC instruction set, see `ARC Programmers
1024Reference Manual', ARC Cores Ltd.
1025
1026
1027File: as.info, Node: ARM-Dependent, Next: CRIS-Dependent, Prev: ARC-Dependent, Up: Machine Dependencies
1028
1029ARM Dependent Features
1030======================
1031
1032* Menu:
1033
1034* ARM Options:: Options
1035* ARM Syntax:: Syntax
1036* ARM Floating Point:: Floating Point
1037* ARM Directives:: ARM Machine Directives
1038* ARM Opcodes:: Opcodes
1039
1040
1041File: as.info, Node: ARM Options, Next: ARM Syntax, Up: ARM-Dependent
1042
1043Options
1044-------
1045
1046`-mcpu=PROCESSOR[+EXTENSION...]'
1047 This option specifies the target processor. The assembler will
1048 issue an error message if an attempt is made to assemble an
1049 instruction which will not execute on the target processor. The
1050 following processor names are recognized: `arm1', `arm2', `arm250',
1051 `arm3', `arm6', `arm60', `arm600', `arm610', `arm620', `arm7',
1052 `arm7m', `arm7d', `arm7dm', `arm7di', `arm7dmi', `arm70', `arm700',
1053 `arm700i', `arm710', `arm710t', `arm720', `arm720t', `arm740t',
1054 `arm710c', `arm7100', `arm7500', `arm7500fe', `arm7t', `arm7tdmi',
1055 `arm8', `arm810', `strongarm', `strongarm1', `strongarm110',
1056 `strongarm1100', `strongarm1110', `arm9', `arm920', `arm920t',
1057 `arm922t', `arm940t', `arm9tdmi', `arm9e', `arm946e-r0', `arm946e',
1058 `arm966e-r0', `arm966e', `arm10t', `arm10e', `arm1020', `arm1020t',
1059 `arm1020e', `ep9312' (ARM920 with Cirrus Maverick coprocessor),
1060 `i80200' (Intel XScale processor) `iwmmxt' (Intel(r) XScale
1061 processor with Wireless MMX(tm) technology coprocessor) and
1062 `xscale'. The special name `all' may be used to allow the
1063 assembler to accept instructions valid for any ARM processor.
1064
1065 In addition to the basic instruction set, the assembler can be
1066 told to accept various extension mnemonics that extend the
1067 processor using the co-processor instruction space. For example,
1068 `-mcpu=arm920+maverick' is equivalent to specifying
1069 `-mcpu=ep9312'. The following extensions are currently supported:
1070 `+maverick' `+iwmmxt' and `+xscale'.
1071
1072`-march=ARCHITECTURE[+EXTENSION...]'
1073 This option specifies the target architecture. The assembler will
1074 issue an error message if an attempt is made to assemble an
1075 instruction which will not execute on the target architecture.
1076 The following architecture names are recognized: `armv1', `armv2',
1077 `armv2a', `armv2s', `armv3', `armv3m', `armv4', `armv4xm',
1078 `armv4t', `armv4txm', `armv5', `armv5t', `armv5txm', `armv5te',
1079 `armv5texp' `iwmmxt' and `xscale'. If both `-mcpu' and `-march'
1080 are specified, the assembler will use the setting for `-mcpu'.
1081
1082 The architecture option can be extended with the same instruction
1083 set extension options as the `-mcpu' option.
1084
1085`-mfpu=FLOATING-POINT-FORMAT'
1086 This option specifies the floating point format to assemble for.
1087 The assembler will issue an error message if an attempt is made to
1088 assemble an instruction which will not execute on the target
1089 floating point unit. The following format options are recognized:
1090 `softfpa', `fpe', `fpe2', `fpe3', `fpa', `fpa10', `fpa11',
1091 `arm7500fe', `softvfp', `softvfp+vfp', `vfp', `vfp10', `vfp10-r0',
1092 `vfp9', `vfpxd', `arm1020t' and `arm1020e'.
1093
1094 In addition to determining which instructions are assembled, this
1095 option also affects the way in which the `.double' assembler
1096 directive behaves when assembling little-endian code.
1097
1098 The default is dependent on the processor selected. For
1099 Architecture 5 or later, the default is to assembler for VFP
1100 instructions; for earlier architectures the default is to assemble
1101 for FPA instructions.
1102
1103`-mthumb'
1104 This option specifies that the assembler should start assembling
1105 Thumb instructions; that is, it should behave as though the file
1106 starts with a `.code 16' directive.
1107
1108`-mthumb-interwork'
1109 This option specifies that the output generated by the assembler
1110 should be marked as supporting interworking.
1111
1112`-mapcs `[26|32]''
1113 This option specifies that the output generated by the assembler
1114 should be marked as supporting the indicated version of the Arm
1115 Procedure. Calling Standard.
1116
1117`-matpcs'
1118 This option specifies that the output generated by the assembler
1119 should be marked as supporting the Arm/Thumb Procedure Calling
1120 Standard. If enabled this option will cause the assembler to
1121 create an empty debugging section in the object file called
1122 .arm.atpcs. Debuggers can use this to determine the ABI being
1123 used by.
1124
1125`-mapcs-float'
1126 This indicates the the floating point variant of the APCS should be
1127 used. In this variant floating point arguments are passed in FP
1128 registers rather than integer registers.
1129
1130`-mapcs-reentrant'
1131 This indicates that the reentrant variant of the APCS should be
1132 used. This variant supports position independent code.
1133
1134`-EB'
1135 This option specifies that the output generated by the assembler
1136 should be marked as being encoded for a big-endian processor.
1137
1138`-EL'
1139 This option specifies that the output generated by the assembler
1140 should be marked as being encoded for a little-endian processor.
1141
1142`-k'
1143 This option specifies that the output of the assembler should be
1144 marked as position-independent code (PIC).
1145
1146`-moabi'
1147 This indicates that the code should be assembled using the old ARM
1148 ELF conventions, based on a beta release release of the ARM-ELF
1149 specifications, rather than the default conventions which are
1150 based on the final release of the ARM-ELF specifications.
1151
1152
1153File: as.info, Node: ARM Syntax, Next: ARM Floating Point, Prev: ARM Options, Up: ARM-Dependent
1154
1155Syntax
1156------
1157
1158* Menu:
1159
1160* ARM-Chars:: Special Characters
1161* ARM-Regs:: Register Names
1162
1163
1164File: as.info, Node: ARM-Chars, Next: ARM-Regs, Up: ARM Syntax
1165
1166Special Characters
1167..................
1168
1169 The presence of a `@' on a line indicates the start of a comment
1170that extends to the end of the current line. If a `#' appears as the
1171first character of a line, the whole line is treated as a comment.
1172
1173 The `;' character can be used instead of a newline to separate
1174statements.
1175
1176 Either `#' or `$' can be used to indicate immediate operands.
1177
1178 *TODO* Explain about /data modifier on symbols.
1179
1180
1181File: as.info, Node: ARM-Regs, Prev: ARM-Chars, Up: ARM Syntax
1182
1183Register Names
1184..............
1185
1186 *TODO* Explain about ARM register naming, and the predefined names.
1187
1188
1189File: as.info, Node: ARM Floating Point, Next: ARM Directives, Prev: ARM Syntax, Up: ARM-Dependent
1190
1191Floating Point
1192--------------
1193
1194 The ARM family uses IEEE floating-point numbers.
1195
1196
1197File: as.info, Node: ARM Directives, Next: ARM Opcodes, Prev: ARM Floating Point, Up: ARM-Dependent
1198
1199ARM Machine Directives
1200----------------------
1201
1202`.align EXPRESSION [, EXPRESSION]'
1203 This is the generic .ALIGN directive. For the ARM however if the
1204 first argument is zero (ie no alignment is needed) the assembler
1205 will behave as if the argument had been 2 (ie pad to the next four
1206 byte boundary). This is for compatibility with ARM's own
1207 assembler.
1208
1209`NAME .req REGISTER NAME'
1210 This creates an alias for REGISTER NAME called NAME. For example:
1211
1212 foo .req r0
1213
1214`.code `[16|32]''
1215 This directive selects the instruction set being generated. The
1216 value 16 selects Thumb, with the value 32 selecting ARM.
1217
1218`.thumb'
1219 This performs the same action as .CODE 16.
1220
1221`.arm'
1222 This performs the same action as .CODE 32.
1223
1224`.force_thumb'
1225 This directive forces the selection of Thumb instructions, even if
1226 the target processor does not support those instructions
1227
1228`.thumb_func'
1229 This directive specifies that the following symbol is the name of a
1230 Thumb encoded function. This information is necessary in order to
1231 allow the assembler and linker to generate correct code for
1232 interworking between Arm and Thumb instructions and should be used
1233 even if interworking is not going to be performed. The presence
1234 of this directive also implies `.thumb'
1235
1236`.thumb_set'
1237 This performs the equivalent of a `.set' directive in that it
1238 creates a symbol which is an alias for another symbol (possibly
1239 not yet defined). This directive also has the added property in
1240 that it marks the aliased symbol as being a thumb function entry
1241 point, in the same way that the `.thumb_func' directive does.
1242
1243`.ltorg'
1244 This directive causes the current contents of the literal pool to
1245 be dumped into the current section (which is assumed to be the
1246 .text section) at the current location (aligned to a word
1247 boundary). `GAS' maintains a separate literal pool for each
1248 section and each sub-section. The `.ltorg' directive will only
1249 affect the literal pool of the current section and sub-section.
1250 At the end of assembly all remaining, un-empty literal pools will
1251 automatically be dumped.
1252
1253 Note - older versions of `GAS' would dump the current literal pool
1254 any time a section change occurred. This is no longer done, since
1255 it prevents accurate control of the placement of literal pools.
1256
1257`.pool'
1258 This is a synonym for .ltorg.
1259
1260
1261File: as.info, Node: ARM Opcodes, Prev: ARM Directives, Up: ARM-Dependent
1262
1263Opcodes
1264-------
1265
1266 `as' implements all the standard ARM opcodes. It also implements
1267several pseudo opcodes, including several synthetic load instructions.
1268
1269`NOP'
1270 nop
1271
1272 This pseudo op will always evaluate to a legal ARM instruction
1273 that does nothing. Currently it will evaluate to MOV r0, r0.
1274
1275`LDR'
1276 ldr <register> , = <expression>
1277
1278 If expression evaluates to a numeric constant then a MOV or MVN
1279 instruction will be used in place of the LDR instruction, if the
1280 constant can be generated by either of these instructions.
1281 Otherwise the constant will be placed into the nearest literal
1282 pool (if it not already there) and a PC relative LDR instruction
1283 will be generated.
1284
1285`ADR'
1286 adr <register> <label>
1287
1288 This instruction will load the address of LABEL into the indicated
1289 register. The instruction will evaluate to a PC relative ADD or
1290 SUB instruction depending upon where the label is located. If the
1291 label is out of range, or if it is not defined in the same file
1292 (and section) as the ADR instruction, then an error will be
1293 generated. This instruction will not make use of the literal pool.
1294
1295`ADRL'
1296 adrl <register> <label>
1297
1298 This instruction will load the address of LABEL into the indicated
1299 register. The instruction will evaluate to one or two PC relative
1300 ADD or SUB instructions depending upon where the label is located.
1301 If a second instruction is not needed a NOP instruction will be
1302 generated in its place, so that this instruction is always 8 bytes
1303 long.
1304
1305 If the label is out of range, or if it is not defined in the same
1306 file (and section) as the ADRL instruction, then an error will be
1307 generated. This instruction will not make use of the literal pool.
1308
1309 For information on the ARM or Thumb instruction sets, see `ARM
1310Software Development Toolkit Reference Manual', Advanced RISC Machines
1311Ltd.
1312
1313
1314File: as.info, Node: CRIS-Dependent, Next: D10V-Dependent, Prev: ARM-Dependent, Up: Machine Dependencies
1315
1316CRIS Dependent Features
1317=======================
1318
1319* Menu:
1320
1321* CRIS-Opts:: Command-line Options
1322* CRIS-Expand:: Instruction expansion
1323* CRIS-Syntax:: Syntax
1324
1325
1326File: as.info, Node: CRIS-Opts, Next: CRIS-Expand, Up: CRIS-Dependent
1327
1328Command-line Options
1329--------------------
1330
1331 The CRIS version of `as' has these machine-dependent command-line
1332options.
1333
1334 The format of the generated object files can be either ELF or a.out,
1335specified by the command-line options `--emulation=crisaout' and
1336`--emulation=criself'. The default is ELF (criself), unless `as' has
1337been configured specifically for a.out by using the configuration name
1338`cris-axis-aout'.
1339
1340 There are two different link-incompatible ELF object file variants
1341for CRIS, for use in environments where symbols are expected to be
1342prefixed by a leading `_' character and for environments without such a
1343symbol prefix. The variant used for GNU/Linux port has no symbol
1344prefix. Which variant to produce is specified by either of the options
1345`--underscore' and `--no-underscore'. The default is `--underscore'.
1346Since symbols in CRIS a.out objects are expected to have a `_' prefix,
1347specifying `--no-underscore' when generating a.out objects is an error.
1348Besides the object format difference, the effect of this option is to
1349parse register names differently (*note crisnous::). The
1350`--no-underscore' option makes a `$' register prefix mandatory.
1351
1352 The option `--pic' must be passed to `as' in order to recognize the
1353symbol syntax used for ELF (SVR4 PIC) position-independent-code (*note
1354crispic::). This will also affect expansion of instructions. The
1355expansion with `--pic' will use PC-relative rather than (slightly
1356faster) absolute addresses in those expansions.
1357
1358 When `-N' is specified, `as' will emit a warning when a 16-bit
1359branch instruction is expanded into a 32-bit multiple-instruction
1360construct (*note CRIS-Expand::).
1361
1362
1363File: as.info, Node: CRIS-Expand, Next: CRIS-Syntax, Prev: CRIS-Opts, Up: CRIS-Dependent
1364
1365Instruction expansion
1366---------------------
1367
1368 `as' will silently choose an instruction that fits the operand size
1369for `[register+constant]' operands. For example, the offset `127' in
1370`move.d [r3+127],r4' fits in an instruction using a signed-byte offset.
1371Similarly, `move.d [r2+32767],r1' will generate an instruction using a
137216-bit offset. For symbolic expressions and constants that do not fit
1373in 16 bits including the sign bit, a 32-bit offset is generated.
1374
1375 For branches, `as' will expand from a 16-bit branch instruction into
1376a sequence of instructions that can reach a full 32-bit address. Since
1377this does not correspond to a single instruction, such expansions can
1378optionally be warned about. *Note CRIS-Opts::.
1379
1380
1381File: as.info, Node: CRIS-Syntax, Prev: CRIS-Expand, Up: CRIS-Dependent
1382
1383Syntax
1384------
1385
1386 There are different aspects of the CRIS assembly syntax.
1387
1388* Menu:
1389
1390* CRIS-Chars:: Special Characters
1391* CRIS-Pic:: Position-Independent Code Symbols
1392* CRIS-Regs:: Register Names
1393* CRIS-Pseudos:: Assembler Directives
1394
1395
1396File: as.info, Node: CRIS-Chars, Next: CRIS-Pic, Up: CRIS-Syntax
1397
1398Special Characters
1399..................
1400
1401 The character `#' is a line comment character. It starts a comment
1402if and only if it is placed at the beginning of a line.
1403
1404 A `;' character starts a comment anywhere on the line, causing all
1405characters up to the end of the line to be ignored.
1406
1407 A `@' character is handled as a line separator equivalent to a
1408logical new-line character (except in a comment), so separate
1409instructions can be specified on a single line.
1410
1411
1412File: as.info, Node: CRIS-Pic, Next: CRIS-Regs, Prev: CRIS-Chars, Up: CRIS-Syntax
1413
1414Symbols in position-independent code
1415....................................
1416
1417 When generating position-independent code (SVR4 PIC) for use in
1418cris-axis-linux-gnu shared libraries, symbol suffixes are used to
1419specify what kind of run-time symbol lookup will be used, expressed in
1420the object as different _relocation types_. Usually, all absolute
1421symbol values must be located in a table, the _global offset table_,
1422leaving the code position-independent; independent of values of global
1423symbols and independent of the address of the code. The suffix
1424modifies the value of the symbol, into for example an index into the
1425global offset table where the real symbol value is entered, or a
1426PC-relative value, or a value relative to the start of the global
1427offset table. All symbol suffixes start with the character `:'
1428(omitted in the list below). Every symbol use in code or a read-only
1429section must therefore have a PIC suffix to enable a useful shared
1430library to be created. Usually, these constructs must not be used with
1431an additive constant offset as is usually allowed, i.e. no 4 as in
1432`symbol + 4' is allowed. This restriction is checked at link-time, not
1433at assembly-time.
1434
1435`GOT'
1436 Attaching this suffix to a symbol in an instruction causes the
1437 symbol to be entered into the global offset table. The value is a
1438 32-bit index for that symbol into the global offset table. The
1439 name of the corresponding relocation is `R_CRIS_32_GOT'. Example:
1440 `move.d [$r0+extsym:GOT],$r9'
1441
1442`GOT16'
1443 Same as for `GOT', but the value is a 16-bit index into the global
1444 offset table. The corresponding relocation is `R_CRIS_16_GOT'.
1445 Example: `move.d [$r0+asymbol:GOT16],$r10'
1446
1447`PLT'
1448 This suffix is used for function symbols. It causes a _procedure
1449 linkage table_, an array of code stubs, to be created at the time
1450 the shared object is created or linked against, together with a
1451 global offset table entry. The value is a pc-relative offset to
1452 the corresponding stub code in the procedure linkage table. This
1453 arrangement causes the run-time symbol resolver to be called to
1454 look up and set the value of the symbol the first time the
1455 function is called (at latest; depending environment variables).
1456 It is only safe to leave the symbol unresolved this way if all
1457 references are function calls. The name of the relocation is
1458 `R_CRIS_32_PLT_PCREL'. Example: `add.d fnname:PLT,$pc'
1459
1460`PLTG'
1461 Like PLT, but the value is relative to the beginning of the global
1462 offset table. The relocation is `R_CRIS_32_PLT_GOTREL'. Example:
1463 `move.d fnname:PLTG,$r3'
1464
1465`GOTPLT'
1466 Similar to `PLT', but the value of the symbol is a 32-bit index
1467 into the global offset table. This is somewhat of a mix between
1468 the effect of the `GOT' and the `PLT' suffix; the difference to
1469 `GOT' is that there will be a procedure linkage table entry
1470 created, and that the symbol is assumed to be a function entry and
1471 will be resolved by the run-time resolver as with `PLT'. The
1472 relocation is `R_CRIS_32_GOTPLT'. Example: `jsr
1473 [$r0+fnname:GOTPLT]'
1474
1475`GOTPLT16'
1476 A variant of `GOTPLT' giving a 16-bit value. Its relocation name
1477 is `R_CRIS_16_GOTPLT'. Example: `jsr [$r0+fnname:GOTPLT16]'
1478
1479`GOTOFF'
1480 This suffix must only be attached to a local symbol, but may be
1481 used in an expression adding an offset. The value is the address
1482 of the symbol relative to the start of the global offset table.
1483 The relocation name is `R_CRIS_32_GOTREL'. Example: `move.d
1484 [$r0+localsym:GOTOFF],r3'
1485
Note: See TracBrowser for help on using the repository browser.