Using As, the GNU Assembler

Using As, the GNU Assembler

Using as The gnu Assembler Version 2.14 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 got some 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 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.1 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 ................................ 12 1.2 The GNU Assembler ................................... 12 1.3 Object File Formats .................................... 12 1.4 Command Line ........................................ 12 1.5 Input Files............................................. 13 1.6 Output (Object) File ................................... 13 1.7 Error and Warning Messages ............................ 14 2 Command-Line Options ................... 15 2.1 Enable Listings: ‘-a[cdhlns]’........................... 15 2.2 ‘-D’ ................................................... 15 2.3 Work Faster: ‘-f’ ...................................... 16 2.4 .include Search Path: ‘-I’ path ........................ 16 2.5 Difference Tables: ‘-K’ .................................. 16 2.6 Include Local Labels: ‘-L’............................... 16 2.7 Configuring listing output: ‘--listing’ .................. 16 2.8 Assemble in MRI Compatibility Mode: ‘-M’ .............. 17 2.9 Dependency Tracking: ‘--MD’............................ 19 2.10 Name the Object File: ‘-o’............................. 19 2.11 Join Data and Text Sections: ‘-R’ ...................... 19 2.12 Display Assembly Statistics: ‘--statistics’ ............ 19 2.13 Compatible Output: ‘--traditional-format’........... 19 2.14 Announce Version: ‘-v’ ................................ 20 2.15 Control Warnings: ‘-W’, ‘--warn’, ‘--no-warn’, ‘--fatal-warnings’ .................................... 20 2.16 Generate Object File in Spite of Errors: ‘-Z’ ............ 20 3 Syntax ................................... 21 3.1 Preprocessing .......................................... 21 3.2 Whitespace ............................................ 21 3.3 Comments ............................................. 21 3.4 Symbols ............................................... 22 3.5 Statements ............................................ 23 3.6 Constants ............................................. 23 3.6.1 Character Constants ........................... 23 3.6.1.1 Strings ............................... 24 3.6.1.2 Characters ........................... 24 3.6.2 Number Constants............................. 25 3.6.2.1 Integers .............................. 25 3.6.2.2 Bignums ............................. 25 3.6.2.3 Flonums.............................. 25 ii Using as 4 Sections and Relocation ................... 27 4.1 Background............................................ 27 4.2 Linker Sections......................................... 28 4.3 Assembler Internal Sections ............................. 29 4.4 Sub-Sections ........................................... 30 4.5 bss Section ............................................ 31 5 Symbols.................................. 33 5.1 Labels................................................. 33 5.2 Giving Symbols Other Values ........................... 33 5.3 Symbol Names ......................................... 33 5.4 The Special Dot Symbol ................................ 35 5.5 Symbol Attributes...................................... 35 5.5.1 Value ......................................... 35 5.5.2 Type ......................................... 35 5.5.3 Symbol Attributes: a.out ...................... 35 5.5.3.1 Descriptor ............................ 36 5.5.3.2 Other ................................ 36 5.5.4 Symbol Attributes for COFF ................... 36 5.5.4.1 Primary Attributes.................... 36 5.5.4.2 Auxiliary Attributes................... 36 5.5.5 Symbol Attributes for SOM .................... 36 6 Expressions .............................. 37 6.1 Empty Expressions ..................................... 37 6.2 Integer Expressions..................................... 37 6.2.1 Arguments .................................... 37 6.2.2 Operators ..................................... 37 6.2.3 Prefix Operator ............................... 38 6.2.4 Infix Operators ................................ 38 7 Assembler Directives...................... 41 7.1 .abort ................................................ 41 7.2 .ABORT ................................................ 41 7.3 .align abs-expr, abs-expr, abs-expr ................. 41 7.4 .ascii "string"... ................................... 42 7.5 .asciz "string"... ................................... 42 7.6 .balign[wl] abs-expr, abs-expr, abs-expr ........... 42 7.7 .byte expressions .................................... 42 7.8 .comm symbol , length ............................... 43 7.9 .data subsection ..................................... 43 7.10 .def name ............................................ 43 7.11 .desc symbol, abs-expression ....................... 43 7.12 .dim ................................................. 43 7.13 .double flonums ..................................... 44 7.14 .eject ............................................... 44 7.15 .else ................................................ 44 iii 7.16 .elseif .............................................. 44 7.17 .end ................................................. 44 7.18 .endef ............................................... 44 7.19 .endfunc ............................................. 44 7.20 .endif ............................................... 44 7.21 .equ symbol, expression ............................. 45 7.22 .equiv symbol, expression .......................... 45 7.23 .err ................................................. 45 7.24 .exitm ............................................... 45 7.25 .extern .............................................. 45 7.26 .fail expression .................................... 45 7.27 .file string ........................................ 46 7.28 .fill repeat , size , value ......................... 46 7.29 .float flonums ...................................... 46 7.30 .func name[,label].................................. 46 7.31 .global symbol, .globl symbol ....................... 46 7.32 .hidden names ....................................... 47 7.33 .hword expressions .................................. 47 7.34 .ident ............................................... 47 7.35 .if absolute expression ............................. 47 7.36 .incbin "file"[,skip[,count]] ..................... 48 7.37 .include "file" ..................................... 49 7.38 .int expressions .................................... 49 7.39 .internal names ..................................... 49 7.40 .irp symbol,values ... ............................... 49 7.41 .irpc symbol,values ... .............................. 49 7.42 .lcomm symbol , length .............................. 50 7.43 .lflags .............................................. 50 7.44 .line line-number ................................... 50 7.45 .linkonce [type] .................................... 51 7.46 .ln line-number ..................................... 51 7.47 .mri val ............................................. 51 7.48 .list ................................................ 51 7.49 .long expressions ................................... 52 7.50 .macro ............................................... 52 7.51 .nolist .............................................. 53 7.52 .octa bignums ....................................... 53 7.53 .org new-lc , fill .................................. 53 7.54 .p2align[wl] abs-expr, abs-expr, abs-expr ......... 54 7.55 .previous............................................ 54 7.56 .popsection ......................................... 54 7.57 .print string ....................................... 55 7.58 .protected names .................................... 55 7.59 .psize lines , columns .............................. 55 7.60 .purgem name ........................................ 55 7.61 .pushsection name , subsection ..................... 55 7.62 .quad bignums ....................................... 56 7.63 .rept count .......................................... 56 iv Using as 7.64 .sbttl "subheading"................................. 56 7.65 .scl class ........................................... 56 7.66 .section name ....................................... 56 7.67 .set symbol, expression ............................. 58 7.68 .short expressions .................................. 58 7.69 .single flonums ..................................... 59 7.70 .size ................................................ 59 7.71 .sleb128 expressions ................................ 59 7.72 .skip size , fill ................................... 59 7.73 .space size , fill .................................. 60 7.74 .stabd, .stabn, .stabs .............................. 60 7.75 .string "str" .......................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    238 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us