Gnu Assembler
Total Page:16
File Type:pdf, Size:1020Kb
Using as The gnu Assembler (Sourcery G++ Lite 2010q1-188) Version 2.19.51 The Free Software Foundation Inc. thanks The Nice Computer Company of Australia for loaning Dean Elsner to write the first (Vax) version of as for Project gnu. The proprietors, management and staff of TNCCA thank FSF for distracting the boss while they gotsome work done. Dean Elsner, Jay Fenlason & friends Using as Edited by Cygnus Support Copyright c 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled \GNU Free Documentation License". i Table of Contents 1 Overview :::::::::::::::::::::::::::::::::::::::: 1 1.1 Structure of this Manual :::::::::::::::::::::::::::::::::::::: 14 1.2 The GNU Assembler :::::::::::::::::::::::::::::::::::::::::: 15 1.3 Object File Formats::::::::::::::::::::::::::::::::::::::::::: 15 1.4 Command Line ::::::::::::::::::::::::::::::::::::::::::::::: 15 1.5 Input Files :::::::::::::::::::::::::::::::::::::::::::::::::::: 16 1.6 Output (Object) File:::::::::::::::::::::::::::::::::::::::::: 16 1.7 Error and Warning Messages :::::::::::::::::::::::::::::::::: 16 2 Command-Line Options::::::::::::::::::::::: 19 2.1 Enable Listings: `-a[cdghlns]' ::::::::::::::::::::::::::::::: 19 2.2 `--alternate' :::::::::::::::::::::::::::::::::::::::::::::::: 19 2.3 `-D' ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 20 2.4 Work Faster: `-f' ::::::::::::::::::::::::::::::::::::::::::::: 20 2.5 .include Search Path: `-I' path :::::::::::::::::::::::::::::: 20 2.6 Difference Tables:-K ` ' :::::::::::::::::::::::::::::::::::::::: 20 2.7 Include Local Symbols: `-L' ::::::::::::::::::::::::::::::::::: 20 2.8 Configuring listing output:--listing ` ' ::::::::::::::::::::::: 20 2.9 Assemble in MRI Compatibility Mode: `-M':::::::::::::::::::: 21 2.10 Dependency Tracking: `--MD'::::::::::::::::::::::::::::::::: 23 2.11 Name the Object File: `-o' ::::::::::::::::::::::::::::::::::: 23 2.12 Join Data and Text Sections: `-R' :::::::::::::::::::::::::::: 23 2.13 Display Assembly Statistics: `--statistics' ::::::::::::::::: 23 2.14 Compatible Output: `--traditional-format':::::::::::::::: 23 2.15 Announce Version: `-v' :::::::::::::::::::::::::::::::::::::: 23 2.16 Control Warnings: `-W', `--warn', `--no-warn', `--fatal-warnings' ::::::::::::::::::::::::::::::::::::::::::: 24 2.17 Generate Object File in Spite of Errors: `-Z':::::::::::::::::: 24 3 Syntax:::::::::::::::::::::::::::::::::::::::::: 25 3.1 Preprocessing ::::::::::::::::::::::::::::::::::::::::::::::::: 25 3.2 Whitespace ::::::::::::::::::::::::::::::::::::::::::::::::::: 25 3.3 Comments :::::::::::::::::::::::::::::::::::::::::::::::::::: 25 3.4 Symbols :::::::::::::::::::::::::::::::::::::::::::::::::::::: 26 3.5 Statements:::::::::::::::::::::::::::::::::::::::::::::::::::: 26 3.6 Constants::::::::::::::::::::::::::::::::::::::::::::::::::::: 27 3.6.1 Character Constants ::::::::::::::::::::::::::::::::::::: 27 3.6.1.1 Strings :::::::::::::::::::::::::::::::::::::::::::::: 27 3.6.1.2 Characters :::::::::::::::::::::::::::::::::::::::::: 28 3.6.2 Number Constants ::::::::::::::::::::::::::::::::::::::: 28 3.6.2.1 Integers ::::::::::::::::::::::::::::::::::::::::::::: 28 3.6.2.2 Bignums :::::::::::::::::::::::::::::::::::::::::::: 29 3.6.2.3 Flonums :::::::::::::::::::::::::::::::::::::::::::: 29 ii Using as 4 Sections and Relocation::::::::::::::::::::::: 31 4.1 Background ::::::::::::::::::::::::::::::::::::::::::::::::::: 31 4.2 Linker Sections ::::::::::::::::::::::::::::::::::::::::::::::: 32 4.3 Assembler Internal Sections ::::::::::::::::::::::::::::::::::: 33 4.4 Sub-Sections :::::::::::::::::::::::::::::::::::::::::::::::::: 33 4.5 bss Section:::::::::::::::::::::::::::::::::::::::::::::::::::: 34 5 Symbols :::::::::::::::::::::::::::::::::::::::: 37 5.1 Labels :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 37 5.2 Giving Symbols Other Values ::::::::::::::::::::::::::::::::: 37 5.3 Symbol Names :::::::::::::::::::::::::::::::::::::::::::::::: 37 5.4 The Special Dot Symbol :::::::::::::::::::::::::::::::::::::: 39 5.5 Symbol Attributes :::::::::::::::::::::::::::::::::::::::::::: 39 5.5.1 Value :::::::::::::::::::::::::::::::::::::::::::::::::::: 39 5.5.2 Type::::::::::::::::::::::::::::::::::::::::::::::::::::: 39 5.5.3 Symbol Attributes: a.out :::::::::::::::::::::::::::::::: 39 5.5.3.1 Descriptor::::::::::::::::::::::::::::::::::::::::::: 40 5.5.3.2 Other ::::::::::::::::::::::::::::::::::::::::::::::: 40 5.5.4 Symbol Attributes for COFF ::::::::::::::::::::::::::::: 40 5.5.4.1 Primary Attributes :::::::::::::::::::::::::::::::::: 40 5.5.4.2 Auxiliary Attributes ::::::::::::::::::::::::::::::::: 40 5.5.5 Symbol Attributes for SOM :::::::::::::::::::::::::::::: 40 6 Expressions :::::::::::::::::::::::::::::::::::: 41 6.1 Empty Expressions:::::::::::::::::::::::::::::::::::::::::::: 41 6.2 Integer Expressions ::::::::::::::::::::::::::::::::::::::::::: 41 6.2.1 Arguments ::::::::::::::::::::::::::::::::::::::::::::::: 41 6.2.2 Operators :::::::::::::::::::::::::::::::::::::::::::::::: 41 6.2.3 Prefix Operator :::::::::::::::::::::::::::::::::::::::::: 41 6.2.4 Infix Operators::::::::::::::::::::::::::::::::::::::::::: 42 7 Assembler Directives :::::::::::::::::::::::::: 45 7.1 .abort ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 45 7.2 .ABORT (COFF)::::::::::::::::::::::::::::::::::::::::::::::: 45 7.3 .align abs-expr, abs-expr, abs-expr :::::::::::::::::::::: 45 7.4 .altmacro :::::::::::::::::::::::::::::::::::::::::::::::::::: 46 7.5 .ascii "string"... :::::::::::::::::::::::::::::::::::::::::: 46 7.6 .asciz "string"... :::::::::::::::::::::::::::::::::::::::::: 46 7.7 .balign[wl] abs-expr, abs-expr, abs-expr :::::::::::::::: 46 7.8 .byte expressions ::::::::::::::::::::::::::::::::::::::::::: 47 7.9 .cfi_sections section_list :::::::::::::::::::::::::::::::: 47 7.10 .cfi_startproc [simple]::::::::::::::::::::::::::::::::::: 47 7.11 .cfi_endproc ::::::::::::::::::::::::::::::::::::::::::::::: 47 7.12 .cfi_personality encoding [, exp] ::::::::::::::::::::::: 47 7.13 .cfi_lsda encoding [, exp] ::::::::::::::::::::::::::::::: 47 7.14 .cfi_def_cfa register, offset :::::::::::::::::::::::::::: 48 7.15 .cfi_def_cfa_register register :::::::::::::::::::::::::: 48 iii 7.16 .cfi_def_cfa_offset offset ::::::::::::::::::::::::::::::: 48 7.17 .cfi_adjust_cfa_offset offset ::::::::::::::::::::::::::: 48 7.18 .cfi_offset register, offset ::::::::::::::::::::::::::::: 48 7.19 .cfi_rel_offset register, offset :::::::::::::::::::::::: 48 7.20 .cfi_register register1, register2 :::::::::::::::::::::: 48 7.21 .cfi_restore register ::::::::::::::::::::::::::::::::::::: 48 7.22 .cfi_undefined register :::::::::::::::::::::::::::::::::: 48 7.23 .cfi_same_value register ::::::::::::::::::::::::::::::::: 48 7.24 .cfi_remember_state, :::::::::::::::::::::::::::::::::::::: 48 7.25 .cfi_return_column register :::::::::::::::::::::::::::::: 49 7.26 .cfi_signal_frame ::::::::::::::::::::::::::::::::::::::::: 49 7.27 .cfi_window_save::::::::::::::::::::::::::::::::::::::::::: 49 7.28 .cfi_escape expression[, . .]:::::::::::::::::::::::::::::::: 49 7.29 .cfi_val_encoded_addr register, encoding, label :::::: 49 7.30 .comm symbol , length ::::::::::::::::::::::::::::::::::::: 49 7.31 .data subsection ::::::::::::::::::::::::::::::::::::::::::: 50 7.32 .def name ::::::::::::::::::::::::::::::::::::::::::::::::::: 50 7.33 .desc symbol, abs-expression ::::::::::::::::::::::::::::: 50 7.34 .dim::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 50 7.35 .double flonums :::::::::::::::::::::::::::::::::::::::::::: 50 7.36 .eject :::::::::::::::::::::::::::::::::::::::::::::::::::::: 50 7.37 .else:::::::::::::::::::::::::::::::::::::::::::::::::::::::: 50 7.38 .elseif ::::::::::::::::::::::::::::::::::::::::::::::::::::: 50 7.39 .end::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 51 7.40 .endef :::::::::::::::::::::::::::::::::::::::::::::::::::::: 51 7.41 .endfunc :::::::::::::::::::::::::::::::::::::::::::::::::::: 51 7.42 .endif :::::::::::::::::::::::::::::::::::::::::::::::::::::: 51 7.43 .equ symbol, expression ::::::::::::::::::::::::::::::::::: 51 7.44 .equiv symbol, expression :::::::::::::::::::::::::::::::: 51 7.45 .eqv symbol, expression ::::::::::::::::::::::::::::::::::: 51 7.46 .err::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 51 7.47 .error "string" :::::::::::::::::::::::::::::::::::::::::::: 52 7.48 .exitm :::::::::::::::::::::::::::::::::::::::::::::::::::::: 52 7.49 .extern ::::::::::::::::::::::::::::::::::::::::::::::::::::: 52 7.50 .fail expression ::::::::::::::::::::::::::::::::::::::::::: 52 7.51 .file:::::::::::::::::::::::::::::::::::::::::::::::::::::::: 52 7.52 .fill repeat , size , value ::::::::::::::::::::::::::::::: 53 7.53 .float flonums ::::::::::::::::::::::::::::::::::::::::::::: 53 7.54 .func name[,label] :::::::::::::::::::::::::::::::::::::::: 53 7.55 .global symbol, .globl symbol :::::::::::::::::::::::::::: 53 7.56 .gnu_attribute tag,value ::::::::::::::::::::::::::::::::: 53 7.57 .hidden names :::::::::::::::::::::::::::::::::::::::::::::: 53 7.58 .hword expressions :::::::::::::::::::::::::::::::::::::::: 54 7.59 .ident