| 1 | This is as.info, produced by makeinfo version 4.3 from as.texinfo.
|
|---|
| 2 |
|
|---|
| 3 | START-INFO-DIR-ENTRY
|
|---|
| 4 | * As: (as). The GNU assembler.
|
|---|
| 5 | * Gas: (as). The GNU assembler.
|
|---|
| 6 | END-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
|
|---|
| 11 | Free Software Foundation, Inc.
|
|---|
| 12 |
|
|---|
| 13 | Permission is granted to copy, distribute and/or modify this document
|
|---|
| 14 | under the terms of the GNU Free Documentation License, Version 1.1 or
|
|---|
| 15 | any later version published by the Free Software Foundation; with no
|
|---|
| 16 | Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
|---|
| 17 | Texts. A copy of the license is included in the section entitled "GNU
|
|---|
| 18 | Free Documentation License".
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 | File: as.info, Node: Comments, Next: Symbol Intro, Prev: Whitespace, Up: Syntax
|
|---|
| 22 |
|
|---|
| 23 | Comments
|
|---|
| 24 | ========
|
|---|
| 25 |
|
|---|
| 26 | There are two ways of rendering comments to `as'. In both cases the
|
|---|
| 27 | comment is equivalent to one space.
|
|---|
| 28 |
|
|---|
| 29 | Anything from `/*' through the next `*/' is a comment. This means
|
|---|
| 30 | you may not nest these comments.
|
|---|
| 31 |
|
|---|
| 32 | /*
|
|---|
| 33 | The only way to include a newline ('\n') in a comment
|
|---|
| 34 | is to use this sort of comment.
|
|---|
| 35 | */
|
|---|
| 36 |
|
|---|
| 37 | /* This sort of comment does not nest. */
|
|---|
| 38 |
|
|---|
| 39 | Anything from the "line comment" character to the next newline is
|
|---|
| 40 | considered a comment and is ignored. The line comment character is `;'
|
|---|
| 41 | for the AMD 29K family; `;' on the ARC; `@' on the ARM; `;' for the
|
|---|
| 42 | H8/300 family; `!' for the H8/500 family; `;' for the HPPA; `#' on the
|
|---|
| 43 | i386 and x86-64; `#' on the i960; `;' for the PDP-11; `;' for picoJava;
|
|---|
| 44 | `;' for Motorola PowerPC; `!' for the Renesas / SuperH SH; `!' on the
|
|---|
| 45 | SPARC; `#' on the ip2k; `#' on the m32r; `|' on the 680x0; `#' on the
|
|---|
| 46 | 68HC11 and 68HC12; `;' on the M880x0; `#' on the Vax; `!' for the Z8000;
|
|---|
| 47 | `#' on the V850; `#' for Xtensa systems; see *Note Machine
|
|---|
| 48 | Dependencies::.
|
|---|
| 49 |
|
|---|
| 50 | On some machines there are two different line comment characters.
|
|---|
| 51 | One character only begins a comment if it is the first non-whitespace
|
|---|
| 52 | character on a line, while the other always begins a comment.
|
|---|
| 53 |
|
|---|
| 54 | The V850 assembler also supports a double dash as starting a comment
|
|---|
| 55 | that extends to the end of the line.
|
|---|
| 56 |
|
|---|
| 57 | `--';
|
|---|
| 58 |
|
|---|
| 59 | To be compatible with past assemblers, lines that begin with `#'
|
|---|
| 60 | have a special interpretation. Following the `#' should be an absolute
|
|---|
| 61 | expression (*note Expressions::): the logical line number of the _next_
|
|---|
| 62 | line. Then a string (*note Strings: Strings.) is allowed: if present
|
|---|
| 63 | it is a new logical file name. The rest of the line, if any, should be
|
|---|
| 64 | whitespace.
|
|---|
| 65 |
|
|---|
| 66 | If the first non-whitespace characters on the line are not numeric,
|
|---|
| 67 | the line is ignored. (Just like a comment.)
|
|---|
| 68 |
|
|---|
| 69 | # This is an ordinary comment.
|
|---|
| 70 | # 42-6 "new_file_name" # New logical file name
|
|---|
| 71 | # This is logical line # 36.
|
|---|
| 72 | This feature is deprecated, and may disappear from future versions
|
|---|
| 73 | of `as'.
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 | File: as.info, Node: Symbol Intro, Next: Statements, Prev: Comments, Up: Syntax
|
|---|
| 77 |
|
|---|
| 78 | Symbols
|
|---|
| 79 | =======
|
|---|
| 80 |
|
|---|
| 81 | A "symbol" is one or more characters chosen from the set of all
|
|---|
| 82 | letters (both upper and lower case), digits and the three characters
|
|---|
| 83 | `_.$'. On most machines, you can also use `$' in symbol names;
|
|---|
| 84 | exceptions are noted in *Note Machine Dependencies::. No symbol may
|
|---|
| 85 | begin with a digit. Case is significant. There is no length limit:
|
|---|
| 86 | all characters are significant. Symbols are delimited by characters
|
|---|
| 87 | not in that set, or by the beginning of a file (since the source
|
|---|
| 88 | program must end with a newline, the end of a file is not a possible
|
|---|
| 89 | symbol delimiter). *Note Symbols::.
|
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 | File: as.info, Node: Statements, Next: Constants, Prev: Symbol Intro, Up: Syntax
|
|---|
| 93 |
|
|---|
| 94 | Statements
|
|---|
| 95 | ==========
|
|---|
| 96 |
|
|---|
| 97 | A "statement" ends at a newline character (`\n') or line separator
|
|---|
| 98 | character. (The line separator is usually `;', unless this conflicts
|
|---|
| 99 | with the comment character; *note Machine Dependencies::.) The newline
|
|---|
| 100 | or separator character is considered part of the preceding statement.
|
|---|
| 101 | Newlines and separators within character constants are an exception:
|
|---|
| 102 | they do not end statements.
|
|---|
| 103 |
|
|---|
| 104 | It is an error to end any statement with end-of-file: the last
|
|---|
| 105 | character of any input file should be a newline.
|
|---|
| 106 |
|
|---|
| 107 | An empty statement is allowed, and may include whitespace. It is
|
|---|
| 108 | ignored.
|
|---|
| 109 |
|
|---|
| 110 | A statement begins with zero or more labels, optionally followed by a
|
|---|
| 111 | key symbol which determines what kind of statement it is. The key
|
|---|
| 112 | symbol determines the syntax of the rest of the statement. If the
|
|---|
| 113 | symbol begins with a dot `.' then the statement is an assembler
|
|---|
| 114 | directive: typically valid for any computer. If the symbol begins with
|
|---|
| 115 | a letter the statement is an assembly language "instruction": it
|
|---|
| 116 | assembles into a machine language instruction. Different versions of
|
|---|
| 117 | `as' for different computers recognize different instructions. In
|
|---|
| 118 | fact, the same symbol may represent a different instruction in a
|
|---|
| 119 | different computer's assembly language.
|
|---|
| 120 |
|
|---|
| 121 | A label is a symbol immediately followed by a colon (`:').
|
|---|
| 122 | Whitespace before a label or after a colon is permitted, but you may not
|
|---|
| 123 | have whitespace between a label's symbol and its colon. *Note Labels::.
|
|---|
| 124 |
|
|---|
| 125 | For HPPA targets, labels need not be immediately followed by a
|
|---|
| 126 | colon, but the definition of a label must begin in column zero. This
|
|---|
| 127 | also implies that only one label may be defined on each line.
|
|---|
| 128 |
|
|---|
| 129 | label: .directive followed by something
|
|---|
| 130 | another_label: # This is an empty statement.
|
|---|
| 131 | instruction operand_1, operand_2, ...
|
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 | File: as.info, Node: Constants, Prev: Statements, Up: Syntax
|
|---|
| 135 |
|
|---|
| 136 | Constants
|
|---|
| 137 | =========
|
|---|
| 138 |
|
|---|
| 139 | A constant is a number, written so that its value is known by
|
|---|
| 140 | inspection, without knowing any context. Like this:
|
|---|
| 141 | .byte 74, 0112, 092, 0x4A, 0X4a, 'J, '\J # All the same value.
|
|---|
| 142 | .ascii "Ring the bell\7" # A string constant.
|
|---|
| 143 | .octa 0x123456789abcdef0123456789ABCDEF0 # A bignum.
|
|---|
| 144 | .float 0f-314159265358979323846264338327\
|
|---|
| 145 | 95028841971.693993751E-40 # - pi, a flonum.
|
|---|
| 146 |
|
|---|
| 147 | * Menu:
|
|---|
| 148 |
|
|---|
| 149 | * Characters:: Character Constants
|
|---|
| 150 | * Numbers:: Number Constants
|
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 | File: as.info, Node: Characters, Next: Numbers, Up: Constants
|
|---|
| 154 |
|
|---|
| 155 | Character Constants
|
|---|
| 156 | -------------------
|
|---|
| 157 |
|
|---|
| 158 | There are two kinds of character constants. A "character" stands
|
|---|
| 159 | for one character in one byte and its value may be used in numeric
|
|---|
| 160 | expressions. String constants (properly called string _literals_) are
|
|---|
| 161 | potentially many bytes and their values may not be used in arithmetic
|
|---|
| 162 | expressions.
|
|---|
| 163 |
|
|---|
| 164 | * Menu:
|
|---|
| 165 |
|
|---|
| 166 | * Strings:: Strings
|
|---|
| 167 | * Chars:: Characters
|
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 | File: as.info, Node: Strings, Next: Chars, Up: Characters
|
|---|
| 171 |
|
|---|
| 172 | Strings
|
|---|
| 173 | .......
|
|---|
| 174 |
|
|---|
| 175 | A "string" is written between double-quotes. It may contain
|
|---|
| 176 | double-quotes or null characters. The way to get special characters
|
|---|
| 177 | into a string is to "escape" these characters: precede them with a
|
|---|
| 178 | backslash `\' character. For example `\\' represents one backslash:
|
|---|
| 179 | the first `\' is an escape which tells `as' to interpret the second
|
|---|
| 180 | character literally as a backslash (which prevents `as' from
|
|---|
| 181 | recognizing the second `\' as an escape character). The complete list
|
|---|
| 182 | of escapes follows.
|
|---|
| 183 |
|
|---|
| 184 | `\b'
|
|---|
| 185 | Mnemonic for backspace; for ASCII this is octal code 010.
|
|---|
| 186 |
|
|---|
| 187 | `\f'
|
|---|
| 188 | Mnemonic for FormFeed; for ASCII this is octal code 014.
|
|---|
| 189 |
|
|---|
| 190 | `\n'
|
|---|
| 191 | Mnemonic for newline; for ASCII this is octal code 012.
|
|---|
| 192 |
|
|---|
| 193 | `\r'
|
|---|
| 194 | Mnemonic for carriage-Return; for ASCII this is octal code 015.
|
|---|
| 195 |
|
|---|
| 196 | `\t'
|
|---|
| 197 | Mnemonic for horizontal Tab; for ASCII this is octal code 011.
|
|---|
| 198 |
|
|---|
| 199 | `\ DIGIT DIGIT DIGIT'
|
|---|
| 200 | An octal character code. The numeric code is 3 octal digits. For
|
|---|
| 201 | compatibility with other Unix systems, 8 and 9 are accepted as
|
|---|
| 202 | digits: for example, `\008' has the value 010, and `\009' the
|
|---|
| 203 | value 011.
|
|---|
| 204 |
|
|---|
| 205 | `\`x' HEX-DIGITS...'
|
|---|
| 206 | A hex character code. All trailing hex digits are combined.
|
|---|
| 207 | Either upper or lower case `x' works.
|
|---|
| 208 |
|
|---|
| 209 | `\\'
|
|---|
| 210 | Represents one `\' character.
|
|---|
| 211 |
|
|---|
| 212 | `\"'
|
|---|
| 213 | Represents one `"' character. Needed in strings to represent this
|
|---|
| 214 | character, because an unescaped `"' would end the string.
|
|---|
| 215 |
|
|---|
| 216 | `\ ANYTHING-ELSE'
|
|---|
| 217 | Any other character when escaped by `\' gives a warning, but
|
|---|
| 218 | assembles as if the `\' was not present. The idea is that if you
|
|---|
| 219 | used an escape sequence you clearly didn't want the literal
|
|---|
| 220 | interpretation of the following character. However `as' has no
|
|---|
| 221 | other interpretation, so `as' knows it is giving you the wrong
|
|---|
| 222 | code and warns you of the fact.
|
|---|
| 223 |
|
|---|
| 224 | Which characters are escapable, and what those escapes represent,
|
|---|
| 225 | varies widely among assemblers. The current set is what we think the
|
|---|
| 226 | BSD 4.2 assembler recognizes, and is a subset of what most C compilers
|
|---|
| 227 | recognize. If you are in doubt, do not use an escape sequence.
|
|---|
| 228 |
|
|---|
| 229 |
|
|---|
| 230 | File: as.info, Node: Chars, Prev: Strings, Up: Characters
|
|---|
| 231 |
|
|---|
| 232 | Characters
|
|---|
| 233 | ..........
|
|---|
| 234 |
|
|---|
| 235 | A single character may be written as a single quote immediately
|
|---|
| 236 | followed by that character. The same escapes apply to characters as to
|
|---|
| 237 | strings. So if you want to write the character backslash, you must
|
|---|
| 238 | write `'\\' where the first `\' escapes the second `\'. As you can
|
|---|
| 239 | see, the quote is an acute accent, not a grave accent. A newline
|
|---|
| 240 | immediately following an acute accent is taken as a literal character
|
|---|
| 241 | and does not count as the end of a statement. The value of a character
|
|---|
| 242 | constant in a numeric expression is the machine's byte-wide code for
|
|---|
| 243 | that character. `as' assumes your character code is ASCII: `'A' means
|
|---|
| 244 | 65, `'B' means 66, and so on.
|
|---|
| 245 |
|
|---|
| 246 |
|
|---|
| 247 | File: as.info, Node: Numbers, Prev: Characters, Up: Constants
|
|---|
| 248 |
|
|---|
| 249 | Number Constants
|
|---|
| 250 | ----------------
|
|---|
| 251 |
|
|---|
| 252 | `as' distinguishes three kinds of numbers according to how they are
|
|---|
| 253 | stored in the target machine. _Integers_ are numbers that would fit
|
|---|
| 254 | into an `int' in the C language. _Bignums_ are integers, but they are
|
|---|
| 255 | stored in more than 32 bits. _Flonums_ are floating point numbers,
|
|---|
| 256 | described below.
|
|---|
| 257 |
|
|---|
| 258 | * Menu:
|
|---|
| 259 |
|
|---|
| 260 | * Integers:: Integers
|
|---|
| 261 | * Bignums:: Bignums
|
|---|
| 262 | * Flonums:: Flonums
|
|---|
| 263 |
|
|---|
| 264 |
|
|---|
| 265 | File: as.info, Node: Integers, Next: Bignums, Up: Numbers
|
|---|
| 266 |
|
|---|
| 267 | Integers
|
|---|
| 268 | ........
|
|---|
| 269 |
|
|---|
| 270 | A binary integer is `0b' or `0B' followed by zero or more of the
|
|---|
| 271 | binary digits `01'.
|
|---|
| 272 |
|
|---|
| 273 | An octal integer is `0' followed by zero or more of the octal digits
|
|---|
| 274 | (`01234567').
|
|---|
| 275 |
|
|---|
| 276 | A decimal integer starts with a non-zero digit followed by zero or
|
|---|
| 277 | more digits (`0123456789').
|
|---|
| 278 |
|
|---|
| 279 | A hexadecimal integer is `0x' or `0X' followed by one or more
|
|---|
| 280 | hexadecimal digits chosen from `0123456789abcdefABCDEF'.
|
|---|
| 281 |
|
|---|
| 282 | Integers have the usual values. To denote a negative integer, use
|
|---|
| 283 | the prefix operator `-' discussed under expressions (*note Prefix
|
|---|
| 284 | Operators: Prefix Ops.).
|
|---|
| 285 |
|
|---|
| 286 |
|
|---|
| 287 | File: as.info, Node: Bignums, Next: Flonums, Prev: Integers, Up: Numbers
|
|---|
| 288 |
|
|---|
| 289 | Bignums
|
|---|
| 290 | .......
|
|---|
| 291 |
|
|---|
| 292 | A "bignum" has the same syntax and semantics as an integer except
|
|---|
| 293 | that the number (or its negative) takes more than 32 bits to represent
|
|---|
| 294 | in binary. The distinction is made because in some places integers are
|
|---|
| 295 | permitted while bignums are not.
|
|---|
| 296 |
|
|---|
| 297 |
|
|---|
| 298 | File: as.info, Node: Flonums, Prev: Bignums, Up: Numbers
|
|---|
| 299 |
|
|---|
| 300 | Flonums
|
|---|
| 301 | .......
|
|---|
| 302 |
|
|---|
| 303 | A "flonum" represents a floating point number. The translation is
|
|---|
| 304 | indirect: a decimal floating point number from the text is converted by
|
|---|
| 305 | `as' to a generic binary floating point number of more than sufficient
|
|---|
| 306 | precision. This generic floating point number is converted to a
|
|---|
| 307 | particular computer's floating point format (or formats) by a portion
|
|---|
| 308 | of `as' specialized to that computer.
|
|---|
| 309 |
|
|---|
| 310 | A flonum is written by writing (in order)
|
|---|
| 311 | * The digit `0'. (`0' is optional on the HPPA.)
|
|---|
| 312 |
|
|---|
| 313 | * A letter, to tell `as' the rest of the number is a flonum. `e' is
|
|---|
| 314 | recommended. Case is not important.
|
|---|
| 315 |
|
|---|
| 316 | On the H8/300, H8/500, Renesas / SuperH SH, and AMD 29K
|
|---|
| 317 | architectures, the letter must be one of the letters `DFPRSX' (in
|
|---|
| 318 | upper or lower case).
|
|---|
| 319 |
|
|---|
| 320 | On the ARC, the letter must be one of the letters `DFRS' (in upper
|
|---|
| 321 | or lower case).
|
|---|
| 322 |
|
|---|
| 323 | On the Intel 960 architecture, the letter must be one of the
|
|---|
| 324 | letters `DFT' (in upper or lower case).
|
|---|
| 325 |
|
|---|
| 326 | On the HPPA architecture, the letter must be `E' (upper case only).
|
|---|
| 327 |
|
|---|
| 328 | * An optional sign: either `+' or `-'.
|
|---|
| 329 |
|
|---|
| 330 | * An optional "integer part": zero or more decimal digits.
|
|---|
| 331 |
|
|---|
| 332 | * An optional "fractional part": `.' followed by zero or more
|
|---|
| 333 | decimal digits.
|
|---|
| 334 |
|
|---|
| 335 | * An optional exponent, consisting of:
|
|---|
| 336 |
|
|---|
| 337 | * An `E' or `e'.
|
|---|
| 338 |
|
|---|
| 339 | * Optional sign: either `+' or `-'.
|
|---|
| 340 |
|
|---|
| 341 | * One or more decimal digits.
|
|---|
| 342 |
|
|---|
| 343 |
|
|---|
| 344 | At least one of the integer part or the fractional part must be
|
|---|
| 345 | present. The floating point number has the usual base-10 value.
|
|---|
| 346 |
|
|---|
| 347 | `as' does all processing using integers. Flonums are computed
|
|---|
| 348 | independently of any floating point hardware in the computer running
|
|---|
| 349 | `as'.
|
|---|
| 350 |
|
|---|
| 351 |
|
|---|
| 352 | File: as.info, Node: Sections, Next: Symbols, Prev: Syntax, Up: Top
|
|---|
| 353 |
|
|---|
| 354 | Sections and Relocation
|
|---|
| 355 | ***********************
|
|---|
| 356 |
|
|---|
| 357 | * Menu:
|
|---|
| 358 |
|
|---|
| 359 | * Secs Background:: Background
|
|---|
| 360 | * Ld Sections:: Linker Sections
|
|---|
| 361 | * As Sections:: Assembler Internal Sections
|
|---|
| 362 | * Sub-Sections:: Sub-Sections
|
|---|
| 363 | * bss:: bss Section
|
|---|
| 364 |
|
|---|
| 365 |
|
|---|
| 366 | File: as.info, Node: Secs Background, Next: Ld Sections, Up: Sections
|
|---|
| 367 |
|
|---|
| 368 | Background
|
|---|
| 369 | ==========
|
|---|
| 370 |
|
|---|
| 371 | Roughly, a section is a range of addresses, with no gaps; all data
|
|---|
| 372 | "in" those addresses is treated the same for some particular purpose.
|
|---|
| 373 | For example there may be a "read only" section.
|
|---|
| 374 |
|
|---|
| 375 | The linker `ld' reads many object files (partial programs) and
|
|---|
| 376 | combines their contents to form a runnable program. When `as' emits an
|
|---|
| 377 | object file, the partial program is assumed to start at address 0.
|
|---|
| 378 | `ld' assigns the final addresses for the partial program, so that
|
|---|
| 379 | different partial programs do not overlap. This is actually an
|
|---|
| 380 | oversimplification, but it suffices to explain how `as' uses sections.
|
|---|
| 381 |
|
|---|
| 382 | `ld' moves blocks of bytes of your program to their run-time
|
|---|
| 383 | addresses. These blocks slide to their run-time addresses as rigid
|
|---|
| 384 | units; their length does not change and neither does the order of bytes
|
|---|
| 385 | within them. Such a rigid unit is called a _section_. Assigning
|
|---|
| 386 | run-time addresses to sections is called "relocation". It includes the
|
|---|
| 387 | task of adjusting mentions of object-file addresses so they refer to
|
|---|
| 388 | the proper run-time addresses. For the H8/300 and H8/500, and for the
|
|---|
| 389 | Renesas / SuperH SH, `as' pads sections if needed to ensure they end on
|
|---|
| 390 | a word (sixteen bit) boundary.
|
|---|
| 391 |
|
|---|
| 392 | An object file written by `as' has at least three sections, any of
|
|---|
| 393 | which may be empty. These are named "text", "data" and "bss" sections.
|
|---|
| 394 |
|
|---|
| 395 | When it generates COFF or ELF output, `as' can also generate
|
|---|
| 396 | whatever other named sections you specify using the `.section'
|
|---|
| 397 | directive (*note `.section': Section.). If you do not use any
|
|---|
| 398 | directives that place output in the `.text' or `.data' sections, these
|
|---|
| 399 | sections still exist, but are empty.
|
|---|
| 400 |
|
|---|
| 401 | When `as' generates SOM or ELF output for the HPPA, `as' can also
|
|---|
| 402 | generate whatever other named sections you specify using the `.space'
|
|---|
| 403 | and `.subspace' directives. See `HP9000 Series 800 Assembly Language
|
|---|
| 404 | Reference Manual' (HP 92432-90001) for details on the `.space' and
|
|---|
| 405 | `.subspace' assembler directives.
|
|---|
| 406 |
|
|---|
| 407 | Additionally, `as' uses different names for the standard text, data,
|
|---|
| 408 | and bss sections when generating SOM output. Program text is placed
|
|---|
| 409 | into the `$CODE$' section, data into `$DATA$', and BSS into `$BSS$'.
|
|---|
| 410 |
|
|---|
| 411 | Within the object file, the text section starts at address `0', the
|
|---|
| 412 | data section follows, and the bss section follows the data section.
|
|---|
| 413 |
|
|---|
| 414 | When generating either SOM or ELF output files on the HPPA, the text
|
|---|
| 415 | section starts at address `0', the data section at address `0x4000000',
|
|---|
| 416 | and the bss section follows the data section.
|
|---|
| 417 |
|
|---|
| 418 | To let `ld' know which data changes when the sections are relocated,
|
|---|
| 419 | and how to change that data, `as' also writes to the object file
|
|---|
| 420 | details of the relocation needed. To perform relocation `ld' must
|
|---|
| 421 | know, each time an address in the object file is mentioned:
|
|---|
| 422 | * Where in the object file is the beginning of this reference to an
|
|---|
| 423 | address?
|
|---|
| 424 |
|
|---|
| 425 | * How long (in bytes) is this reference?
|
|---|
| 426 |
|
|---|
| 427 | * Which section does the address refer to? What is the numeric
|
|---|
| 428 | value of
|
|---|
| 429 | (ADDRESS) - (START-ADDRESS OF SECTION)?
|
|---|
| 430 |
|
|---|
| 431 | * Is the reference to an address "Program-Counter relative"?
|
|---|
| 432 |
|
|---|
| 433 | In fact, every address `as' ever uses is expressed as
|
|---|
| 434 | (SECTION) + (OFFSET INTO SECTION)
|
|---|
| 435 |
|
|---|
| 436 | Further, most expressions `as' computes have this section-relative
|
|---|
| 437 | nature. (For some object formats, such as SOM for the HPPA, some
|
|---|
| 438 | expressions are symbol-relative instead.)
|
|---|
| 439 |
|
|---|
| 440 | In this manual we use the notation {SECNAME N} to mean "offset N
|
|---|
| 441 | into section SECNAME."
|
|---|
| 442 |
|
|---|
| 443 | Apart from text, data and bss sections you need to know about the
|
|---|
| 444 | "absolute" section. When `ld' mixes partial programs, addresses in the
|
|---|
| 445 | absolute section remain unchanged. For example, address `{absolute 0}'
|
|---|
| 446 | is "relocated" to run-time address 0 by `ld'. Although the linker
|
|---|
| 447 | never arranges two partial programs' data sections with overlapping
|
|---|
| 448 | addresses after linking, _by definition_ their absolute sections must
|
|---|
| 449 | overlap. Address `{absolute 239}' in one part of a program is always
|
|---|
| 450 | the same address when the program is running as address `{absolute
|
|---|
| 451 | 239}' in any other part of the program.
|
|---|
| 452 |
|
|---|
| 453 | The idea of sections is extended to the "undefined" section. Any
|
|---|
| 454 | address whose section is unknown at assembly time is by definition
|
|---|
| 455 | rendered {undefined U}--where U is filled in later. Since numbers are
|
|---|
| 456 | always defined, the only way to generate an undefined address is to
|
|---|
| 457 | mention an undefined symbol. A reference to a named common block would
|
|---|
| 458 | be such a symbol: its value is unknown at assembly time so it has
|
|---|
| 459 | section _undefined_.
|
|---|
| 460 |
|
|---|
| 461 | By analogy the word _section_ is used to describe groups of sections
|
|---|
| 462 | in the linked program. `ld' puts all partial programs' text sections
|
|---|
| 463 | in contiguous addresses in the linked program. It is customary to
|
|---|
| 464 | refer to the _text section_ of a program, meaning all the addresses of
|
|---|
| 465 | all partial programs' text sections. Likewise for data and bss
|
|---|
| 466 | sections.
|
|---|
| 467 |
|
|---|
| 468 | Some sections are manipulated by `ld'; others are invented for use
|
|---|
| 469 | of `as' and have no meaning except during assembly.
|
|---|
| 470 |
|
|---|
| 471 |
|
|---|
| 472 | File: as.info, Node: Ld Sections, Next: As Sections, Prev: Secs Background, Up: Sections
|
|---|
| 473 |
|
|---|
| 474 | Linker Sections
|
|---|
| 475 | ===============
|
|---|
| 476 |
|
|---|
| 477 | `ld' deals with just four kinds of sections, summarized below.
|
|---|
| 478 |
|
|---|
| 479 | *named sections*
|
|---|
| 480 | *text section*
|
|---|
| 481 | *data section*
|
|---|
| 482 | These sections hold your program. `as' and `ld' treat them as
|
|---|
| 483 | separate but equal sections. Anything you can say of one section
|
|---|
| 484 | is true of another. When the program is running, however, it is
|
|---|
| 485 | customary for the text section to be unalterable. The text
|
|---|
| 486 | section is often shared among processes: it contains instructions,
|
|---|
| 487 | constants and the like. The data section of a running program is
|
|---|
| 488 | usually alterable: for example, C variables would be stored in the
|
|---|
| 489 | data section.
|
|---|
| 490 |
|
|---|
| 491 | *bss section*
|
|---|
| 492 | This section contains zeroed bytes when your program begins
|
|---|
| 493 | running. It is used to hold uninitialized variables or common
|
|---|
| 494 | storage. The length of each partial program's bss section is
|
|---|
| 495 | important, but because it starts out containing zeroed bytes there
|
|---|
| 496 | is no need to store explicit zero bytes in the object file. The
|
|---|
| 497 | bss section was invented to eliminate those explicit zeros from
|
|---|
| 498 | object files.
|
|---|
| 499 |
|
|---|
| 500 | *absolute section*
|
|---|
| 501 | Address 0 of this section is always "relocated" to runtime address
|
|---|
| 502 | 0. This is useful if you want to refer to an address that `ld'
|
|---|
| 503 | must not change when relocating. In this sense we speak of
|
|---|
| 504 | absolute addresses being "unrelocatable": they do not change
|
|---|
| 505 | during relocation.
|
|---|
| 506 |
|
|---|
| 507 | *undefined section*
|
|---|
| 508 | This "section" is a catch-all for address references to objects
|
|---|
| 509 | not in the preceding sections.
|
|---|
| 510 |
|
|---|
| 511 | An idealized example of three relocatable sections follows. The
|
|---|
| 512 | example uses the traditional section names `.text' and `.data'. Memory
|
|---|
| 513 | addresses are on the horizontal axis.
|
|---|
| 514 |
|
|---|
| 515 | +-----+----+--+
|
|---|
| 516 | partial program # 1: |ttttt|dddd|00|
|
|---|
| 517 | +-----+----+--+
|
|---|
| 518 |
|
|---|
| 519 | text data bss
|
|---|
| 520 | seg. seg. seg.
|
|---|
| 521 |
|
|---|
| 522 | +---+---+---+
|
|---|
| 523 | partial program # 2: |TTT|DDD|000|
|
|---|
| 524 | +---+---+---+
|
|---|
| 525 |
|
|---|
| 526 | +--+---+-----+--+----+---+-----+~~
|
|---|
| 527 | linked program: | |TTT|ttttt| |dddd|DDD|00000|
|
|---|
| 528 | +--+---+-----+--+----+---+-----+~~
|
|---|
| 529 |
|
|---|
| 530 | addresses: 0 ...
|
|---|
| 531 |
|
|---|
| 532 |
|
|---|
| 533 | File: as.info, Node: As Sections, Next: Sub-Sections, Prev: Ld Sections, Up: Sections
|
|---|
| 534 |
|
|---|
| 535 | Assembler Internal Sections
|
|---|
| 536 | ===========================
|
|---|
| 537 |
|
|---|
| 538 | These sections are meant only for the internal use of `as'. They
|
|---|
| 539 | have no meaning at run-time. You do not really need to know about these
|
|---|
| 540 | sections for most purposes; but they can be mentioned in `as' warning
|
|---|
| 541 | messages, so it might be helpful to have an idea of their meanings to
|
|---|
| 542 | `as'. These sections are used to permit the value of every expression
|
|---|
| 543 | in your assembly language program to be a section-relative address.
|
|---|
| 544 |
|
|---|
| 545 | ASSEMBLER-INTERNAL-LOGIC-ERROR!
|
|---|
| 546 | An internal assembler logic error has been found. This means
|
|---|
| 547 | there is a bug in the assembler.
|
|---|
| 548 |
|
|---|
| 549 | expr section
|
|---|
| 550 | The assembler stores complex expression internally as combinations
|
|---|
| 551 | of symbols. When it needs to represent an expression as a symbol,
|
|---|
| 552 | it puts it in the expr section.
|
|---|
| 553 |
|
|---|
| 554 |
|
|---|
| 555 | File: as.info, Node: Sub-Sections, Next: bss, Prev: As Sections, Up: Sections
|
|---|
| 556 |
|
|---|
| 557 | Sub-Sections
|
|---|
| 558 | ============
|
|---|
| 559 |
|
|---|
| 560 | Assembled bytes conventionally fall into two sections: text and data.
|
|---|
| 561 | You may have separate groups of data in named sections that you want to
|
|---|
| 562 | end up near to each other in the object file, even though they are not
|
|---|
| 563 | contiguous in the assembler source. `as' allows you to use
|
|---|
| 564 | "subsections" for this purpose. Within each section, there can be
|
|---|
| 565 | numbered subsections with values from 0 to 8192. Objects assembled
|
|---|
| 566 | into the same subsection go into the object file together with other
|
|---|
| 567 | objects in the same subsection. For example, a compiler might want to
|
|---|
| 568 | store constants in the text section, but might not want to have them
|
|---|
| 569 | interspersed with the program being assembled. In this case, the
|
|---|
| 570 | compiler could issue a `.text 0' before each section of code being
|
|---|
| 571 | output, and a `.text 1' before each group of constants being output.
|
|---|
| 572 |
|
|---|
| 573 | Subsections are optional. If you do not use subsections, everything
|
|---|
| 574 | goes in subsection number zero.
|
|---|
| 575 |
|
|---|
| 576 | Each subsection is zero-padded up to a multiple of four bytes.
|
|---|
| 577 | (Subsections may be padded a different amount on different flavors of
|
|---|
| 578 | `as'.)
|
|---|
| 579 |
|
|---|
| 580 | Subsections appear in your object file in numeric order, lowest
|
|---|
| 581 | numbered to highest. (All this to be compatible with other people's
|
|---|
| 582 | assemblers.) The object file contains no representation of
|
|---|
| 583 | subsections; `ld' and other programs that manipulate object files see
|
|---|
| 584 | no trace of them. They just see all your text subsections as a text
|
|---|
| 585 | section, and all your data subsections as a data section.
|
|---|
| 586 |
|
|---|
| 587 | To specify which subsection you want subsequent statements assembled
|
|---|
| 588 | into, use a numeric argument to specify it, in a `.text EXPRESSION' or
|
|---|
| 589 | a `.data EXPRESSION' statement. When generating COFF or ELF output, you
|
|---|
| 590 | can also use an extra subsection argument with arbitrary named
|
|---|
| 591 | sections: `.section NAME, EXPRESSION'. EXPRESSION should be an
|
|---|
| 592 | absolute expression. (*Note Expressions::.) If you just say `.text'
|
|---|
| 593 | then `.text 0' is assumed. Likewise `.data' means `.data 0'. Assembly
|
|---|
| 594 | begins in `text 0'. For instance:
|
|---|
| 595 | .text 0 # The default subsection is text 0 anyway.
|
|---|
| 596 | .ascii "This lives in the first text subsection. *"
|
|---|
| 597 | .text 1
|
|---|
| 598 | .ascii "But this lives in the second text subsection."
|
|---|
| 599 | .data 0
|
|---|
| 600 | .ascii "This lives in the data section,"
|
|---|
| 601 | .ascii "in the first data subsection."
|
|---|
| 602 | .text 0
|
|---|
| 603 | .ascii "This lives in the first text section,"
|
|---|
| 604 | .ascii "immediately following the asterisk (*)."
|
|---|
| 605 |
|
|---|
| 606 | Each section has a "location counter" incremented by one for every
|
|---|
| 607 | byte assembled into that section. Because subsections are merely a
|
|---|
| 608 | convenience restricted to `as' there is no concept of a subsection
|
|---|
| 609 | location counter. There is no way to directly manipulate a location
|
|---|
| 610 | counter--but the `.align' directive changes it, and any label
|
|---|
| 611 | definition captures its current value. The location counter of the
|
|---|
| 612 | section where statements are being assembled is said to be the "active"
|
|---|
| 613 | location counter.
|
|---|
| 614 |
|
|---|
| 615 |
|
|---|
| 616 | File: as.info, Node: bss, Prev: Sub-Sections, Up: Sections
|
|---|
| 617 |
|
|---|
| 618 | bss Section
|
|---|
| 619 | ===========
|
|---|
| 620 |
|
|---|
| 621 | The bss section is used for local common variable storage. You may
|
|---|
| 622 | allocate address space in the bss section, but you may not dictate data
|
|---|
| 623 | to load into it before your program executes. When your program starts
|
|---|
| 624 | running, all the contents of the bss section are zeroed bytes.
|
|---|
| 625 |
|
|---|
| 626 | The `.lcomm' pseudo-op defines a symbol in the bss section; see
|
|---|
| 627 | *Note `.lcomm': Lcomm.
|
|---|
| 628 |
|
|---|
| 629 | The `.comm' pseudo-op may be used to declare a common symbol, which
|
|---|
| 630 | is another form of uninitialized symbol; see *Note `.comm': Comm.
|
|---|
| 631 |
|
|---|
| 632 | When assembling for a target which supports multiple sections, such
|
|---|
| 633 | as ELF or COFF, you may switch into the `.bss' section and define
|
|---|
| 634 | symbols as usual; see *Note `.section': Section. You may only assemble
|
|---|
| 635 | zero values into the section. Typically the section will only contain
|
|---|
| 636 | symbol definitions and `.skip' directives (*note `.skip': Skip.).
|
|---|
| 637 |
|
|---|
| 638 |
|
|---|
| 639 | File: as.info, Node: Symbols, Next: Expressions, Prev: Sections, Up: Top
|
|---|
| 640 |
|
|---|
| 641 | Symbols
|
|---|
| 642 | *******
|
|---|
| 643 |
|
|---|
| 644 | Symbols are a central concept: the programmer uses symbols to name
|
|---|
| 645 | things, the linker uses symbols to link, and the debugger uses symbols
|
|---|
| 646 | to debug.
|
|---|
| 647 |
|
|---|
| 648 | _Warning:_ `as' does not place symbols in the object file in the
|
|---|
| 649 | same order they were declared. This may break some debuggers.
|
|---|
| 650 |
|
|---|
| 651 | * Menu:
|
|---|
| 652 |
|
|---|
| 653 | * Labels:: Labels
|
|---|
| 654 | * Setting Symbols:: Giving Symbols Other Values
|
|---|
| 655 | * Symbol Names:: Symbol Names
|
|---|
| 656 | * Dot:: The Special Dot Symbol
|
|---|
| 657 | * Symbol Attributes:: Symbol Attributes
|
|---|
| 658 |
|
|---|
| 659 |
|
|---|
| 660 | File: as.info, Node: Labels, Next: Setting Symbols, Up: Symbols
|
|---|
| 661 |
|
|---|
| 662 | Labels
|
|---|
| 663 | ======
|
|---|
| 664 |
|
|---|
| 665 | A "label" is written as a symbol immediately followed by a colon
|
|---|
| 666 | `:'. The symbol then represents the current value of the active
|
|---|
| 667 | location counter, and is, for example, a suitable instruction operand.
|
|---|
| 668 | You are warned if you use the same symbol to represent two different
|
|---|
| 669 | locations: the first definition overrides any other definitions.
|
|---|
| 670 |
|
|---|
| 671 | On the HPPA, the usual form for a label need not be immediately
|
|---|
| 672 | followed by a colon, but instead must start in column zero. Only one
|
|---|
| 673 | label may be defined on a single line. To work around this, the HPPA
|
|---|
| 674 | version of `as' also provides a special directive `.label' for defining
|
|---|
| 675 | labels more flexibly.
|
|---|
| 676 |
|
|---|
| 677 |
|
|---|
| 678 | File: as.info, Node: Setting Symbols, Next: Symbol Names, Prev: Labels, Up: Symbols
|
|---|
| 679 |
|
|---|
| 680 | Giving Symbols Other Values
|
|---|
| 681 | ===========================
|
|---|
| 682 |
|
|---|
| 683 | A symbol can be given an arbitrary value by writing a symbol,
|
|---|
| 684 | followed by an equals sign `=', followed by an expression (*note
|
|---|
| 685 | Expressions::). This is equivalent to using the `.set' directive.
|
|---|
| 686 | *Note `.set': Set.
|
|---|
| 687 |
|
|---|
| 688 |
|
|---|
| 689 | File: as.info, Node: Symbol Names, Next: Dot, Prev: Setting Symbols, Up: Symbols
|
|---|
| 690 |
|
|---|
| 691 | Symbol Names
|
|---|
| 692 | ============
|
|---|
| 693 |
|
|---|
| 694 | Symbol names begin with a letter or with one of `._'. On most
|
|---|
| 695 | machines, you can also use `$' in symbol names; exceptions are noted in
|
|---|
| 696 | *Note Machine Dependencies::. That character may be followed by any
|
|---|
| 697 | string of digits, letters, dollar signs (unless otherwise noted in
|
|---|
| 698 | *Note Machine Dependencies::), and underscores. For the AMD 29K
|
|---|
| 699 | family, `?' is also allowed in the body of a symbol name, though not at
|
|---|
| 700 | its beginning.
|
|---|
| 701 |
|
|---|
| 702 | Case of letters is significant: `foo' is a different symbol name
|
|---|
| 703 | than `Foo'.
|
|---|
| 704 |
|
|---|
| 705 | Each symbol has exactly one name. Each name in an assembly language
|
|---|
| 706 | program refers to exactly one symbol. You may use that symbol name any
|
|---|
| 707 | number of times in a program.
|
|---|
| 708 |
|
|---|
| 709 | Local Symbol Names
|
|---|
| 710 | ------------------
|
|---|
| 711 |
|
|---|
| 712 | Local symbols help compilers and programmers use names temporarily.
|
|---|
| 713 | They create symbols which are guaranteed to be unique over the entire
|
|---|
| 714 | scope of the input source code and which can be referred to by a simple
|
|---|
| 715 | notation. To define a local symbol, write a label of the form `N:'
|
|---|
| 716 | (where N represents any positive integer). To refer to the most recent
|
|---|
| 717 | previous definition of that symbol write `Nb', using the same number as
|
|---|
| 718 | when you defined the label. To refer to the next definition of a local
|
|---|
| 719 | label, write `Nf'-- The `b' stands for"backwards" and the `f' stands
|
|---|
| 720 | for "forwards".
|
|---|
| 721 |
|
|---|
| 722 | There is no restriction on how you can use these labels, and you can
|
|---|
| 723 | reuse them too. So that it is possible to repeatedly define the same
|
|---|
| 724 | local label (using the same number `N'), although you can only refer to
|
|---|
| 725 | the most recently defined local label of that number (for a backwards
|
|---|
| 726 | reference) or the next definition of a specific local label for a
|
|---|
| 727 | forward reference. It is also worth noting that the first 10 local
|
|---|
| 728 | labels (`0:'...`9:') are implemented in a slightly more efficient
|
|---|
| 729 | manner than the others.
|
|---|
| 730 |
|
|---|
| 731 | Here is an example:
|
|---|
| 732 |
|
|---|
| 733 | 1: branch 1f
|
|---|
| 734 | 2: branch 1b
|
|---|
| 735 | 1: branch 2f
|
|---|
| 736 | 2: branch 1b
|
|---|
| 737 |
|
|---|
| 738 | Which is the equivalent of:
|
|---|
| 739 |
|
|---|
| 740 | label_1: branch label_3
|
|---|
| 741 | label_2: branch label_1
|
|---|
| 742 | label_3: branch label_4
|
|---|
| 743 | label_4: branch label_3
|
|---|
| 744 |
|
|---|
| 745 | Local symbol names are only a notational device. They are
|
|---|
| 746 | immediately transformed into more conventional symbol names before the
|
|---|
| 747 | assembler uses them. The symbol names stored in the symbol table,
|
|---|
| 748 | appearing in error messages and optionally emitted to the object file.
|
|---|
| 749 | The names are constructed using these parts:
|
|---|
| 750 |
|
|---|
| 751 | `L'
|
|---|
| 752 | All local labels begin with `L'. Normally both `as' and `ld'
|
|---|
| 753 | forget symbols that start with `L'. These labels are used for
|
|---|
| 754 | symbols you are never intended to see. If you use the `-L' option
|
|---|
| 755 | then `as' retains these symbols in the object file. If you also
|
|---|
| 756 | instruct `ld' to retain these symbols, you may use them in
|
|---|
| 757 | debugging.
|
|---|
| 758 |
|
|---|
| 759 | `NUMBER'
|
|---|
| 760 | This is the number that was used in the local label definition.
|
|---|
| 761 | So if the label is written `55:' then the number is `55'.
|
|---|
| 762 |
|
|---|
| 763 | `C-B'
|
|---|
| 764 | This unusual character is included so you do not accidentally
|
|---|
| 765 | invent a symbol of the same name. The character has ASCII value
|
|---|
| 766 | of `\002' (control-B).
|
|---|
| 767 |
|
|---|
| 768 | `_ordinal number_'
|
|---|
| 769 | This is a serial number to keep the labels distinct. The first
|
|---|
| 770 | definition of `0:' gets the number `1'. The 15th definition of
|
|---|
| 771 | `0:' gets the number `15', and so on. Likewise the first
|
|---|
| 772 | definition of `1:' gets the number `1' and its 15th defintion gets
|
|---|
| 773 | `15' as well.
|
|---|
| 774 |
|
|---|
| 775 | So for example, the first `1:' is named `L1C-B1', the 44th `3:' is
|
|---|
| 776 | named `L3C-B44'.
|
|---|
| 777 |
|
|---|
| 778 | Dollar Local Labels
|
|---|
| 779 | -------------------
|
|---|
| 780 |
|
|---|
| 781 | `as' also supports an even more local form of local labels called
|
|---|
| 782 | dollar labels. These labels go out of scope (ie they become undefined)
|
|---|
| 783 | as soon as a non-local label is defined. Thus they remain valid for
|
|---|
| 784 | only a small region of the input source code. Normal local labels, by
|
|---|
| 785 | contrast, remain in scope for the entire file, or until they are
|
|---|
| 786 | redefined by another occurrence of the same local label.
|
|---|
| 787 |
|
|---|
| 788 | Dollar labels are defined in exactly the same way as ordinary local
|
|---|
| 789 | labels, except that instead of being terminated by a colon, they are
|
|---|
| 790 | terminated by a dollar sign. eg `55$'.
|
|---|
| 791 |
|
|---|
| 792 | They can also be distinguished from ordinary local labels by their
|
|---|
| 793 | transformed name which uses ASCII character `\001' (control-A) as the
|
|---|
| 794 | magic character to distinguish them from ordinary labels. Thus the 5th
|
|---|
| 795 | defintion of `6$' is named `L6C-A5'.
|
|---|
| 796 |
|
|---|
| 797 |
|
|---|
| 798 | File: as.info, Node: Dot, Next: Symbol Attributes, Prev: Symbol Names, Up: Symbols
|
|---|
| 799 |
|
|---|
| 800 | The Special Dot Symbol
|
|---|
| 801 | ======================
|
|---|
| 802 |
|
|---|
| 803 | The special symbol `.' refers to the current address that `as' is
|
|---|
| 804 | assembling into. Thus, the expression `melvin: .long .' defines
|
|---|
| 805 | `melvin' to contain its own address. Assigning a value to `.' is
|
|---|
| 806 | treated the same as a `.org' directive. Thus, the expression `.=.+4'
|
|---|
| 807 | is the same as saying `.space 4'.
|
|---|
| 808 |
|
|---|
| 809 |
|
|---|
| 810 | File: as.info, Node: Symbol Attributes, Prev: Dot, Up: Symbols
|
|---|
| 811 |
|
|---|
| 812 | Symbol Attributes
|
|---|
| 813 | =================
|
|---|
| 814 |
|
|---|
| 815 | Every symbol has, as well as its name, the attributes "Value" and
|
|---|
| 816 | "Type". Depending on output format, symbols can also have auxiliary
|
|---|
| 817 | attributes.
|
|---|
| 818 |
|
|---|
| 819 | If you use a symbol without defining it, `as' assumes zero for all
|
|---|
| 820 | these attributes, and probably won't warn you. This makes the symbol
|
|---|
| 821 | an externally defined symbol, which is generally what you would want.
|
|---|
| 822 |
|
|---|
| 823 | * Menu:
|
|---|
| 824 |
|
|---|
| 825 | * Symbol Value:: Value
|
|---|
| 826 | * Symbol Type:: Type
|
|---|
| 827 |
|
|---|
| 828 |
|
|---|
| 829 | * a.out Symbols:: Symbol Attributes: `a.out'
|
|---|
| 830 |
|
|---|
| 831 | * COFF Symbols:: Symbol Attributes for COFF
|
|---|
| 832 |
|
|---|
| 833 | * SOM Symbols:: Symbol Attributes for SOM
|
|---|
| 834 |
|
|---|
| 835 |
|
|---|
| 836 | File: as.info, Node: Symbol Value, Next: Symbol Type, Up: Symbol Attributes
|
|---|
| 837 |
|
|---|
| 838 | Value
|
|---|
| 839 | -----
|
|---|
| 840 |
|
|---|
| 841 | The value of a symbol is (usually) 32 bits. For a symbol which
|
|---|
| 842 | labels a location in the text, data, bss or absolute sections the value
|
|---|
| 843 | is the number of addresses from the start of that section to the label.
|
|---|
| 844 | Naturally for text, data and bss sections the value of a symbol changes
|
|---|
| 845 | as `ld' changes section base addresses during linking. Absolute
|
|---|
| 846 | symbols' values do not change during linking: that is why they are
|
|---|
| 847 | called absolute.
|
|---|
| 848 |
|
|---|
| 849 | The value of an undefined symbol is treated in a special way. If it
|
|---|
| 850 | is 0 then the symbol is not defined in this assembler source file, and
|
|---|
| 851 | `ld' tries to determine its value from other files linked into the same
|
|---|
| 852 | program. You make this kind of symbol simply by mentioning a symbol
|
|---|
| 853 | name without defining it. A non-zero value represents a `.comm' common
|
|---|
| 854 | declaration. The value is how much common storage to reserve, in bytes
|
|---|
| 855 | (addresses). The symbol refers to the first address of the allocated
|
|---|
| 856 | storage.
|
|---|
| 857 |
|
|---|
| 858 |
|
|---|
| 859 | File: as.info, Node: Symbol Type, Next: a.out Symbols, Prev: Symbol Value, Up: Symbol Attributes
|
|---|
| 860 |
|
|---|
| 861 | Type
|
|---|
| 862 | ----
|
|---|
| 863 |
|
|---|
| 864 | The type attribute of a symbol contains relocation (section)
|
|---|
| 865 | information, any flag settings indicating that a symbol is external, and
|
|---|
| 866 | (optionally), other information for linkers and debuggers. The exact
|
|---|
| 867 | format depends on the object-code output format in use.
|
|---|
| 868 |
|
|---|
| 869 |
|
|---|
| 870 | File: as.info, Node: a.out Symbols, Next: COFF Symbols, Prev: Symbol Type, Up: Symbol Attributes
|
|---|
| 871 |
|
|---|
| 872 | Symbol Attributes: `a.out'
|
|---|
| 873 | --------------------------
|
|---|
| 874 |
|
|---|
| 875 | * Menu:
|
|---|
| 876 |
|
|---|
| 877 | * Symbol Desc:: Descriptor
|
|---|
| 878 | * Symbol Other:: Other
|
|---|
| 879 |
|
|---|
| 880 |
|
|---|
| 881 | File: as.info, Node: Symbol Desc, Next: Symbol Other, Up: a.out Symbols
|
|---|
| 882 |
|
|---|
| 883 | Descriptor
|
|---|
| 884 | ..........
|
|---|
| 885 |
|
|---|
| 886 | This is an arbitrary 16-bit value. You may establish a symbol's
|
|---|
| 887 | descriptor value by using a `.desc' statement (*note `.desc': Desc.).
|
|---|
| 888 | A descriptor value means nothing to `as'.
|
|---|
| 889 |
|
|---|
| 890 |
|
|---|
| 891 | File: as.info, Node: Symbol Other, Prev: Symbol Desc, Up: a.out Symbols
|
|---|
| 892 |
|
|---|
| 893 | Other
|
|---|
| 894 | .....
|
|---|
| 895 |
|
|---|
| 896 | This is an arbitrary 8-bit value. It means nothing to `as'.
|
|---|
| 897 |
|
|---|
| 898 |
|
|---|
| 899 | File: as.info, Node: COFF Symbols, Next: SOM Symbols, Prev: a.out Symbols, Up: Symbol Attributes
|
|---|
| 900 |
|
|---|
| 901 | Symbol Attributes for COFF
|
|---|
| 902 | --------------------------
|
|---|
| 903 |
|
|---|
| 904 | The COFF format supports a multitude of auxiliary symbol attributes;
|
|---|
| 905 | like the primary symbol attributes, they are set between `.def' and
|
|---|
| 906 | `.endef' directives.
|
|---|
| 907 |
|
|---|
| 908 | Primary Attributes
|
|---|
| 909 | ..................
|
|---|
| 910 |
|
|---|
| 911 | The symbol name is set with `.def'; the value and type,
|
|---|
| 912 | respectively, with `.val' and `.type'.
|
|---|
| 913 |
|
|---|
| 914 | Auxiliary Attributes
|
|---|
| 915 | ....................
|
|---|
| 916 |
|
|---|
| 917 | The `as' directives `.dim', `.line', `.scl', `.size', and `.tag' can
|
|---|
| 918 | generate auxiliary symbol table information for COFF.
|
|---|
| 919 |
|
|---|
| 920 |
|
|---|
| 921 | File: as.info, Node: SOM Symbols, Prev: COFF Symbols, Up: Symbol Attributes
|
|---|
| 922 |
|
|---|
| 923 | Symbol Attributes for SOM
|
|---|
| 924 | -------------------------
|
|---|
| 925 |
|
|---|
| 926 | The SOM format for the HPPA supports a multitude of symbol
|
|---|
| 927 | attributes set with the `.EXPORT' and `.IMPORT' directives.
|
|---|
| 928 |
|
|---|
| 929 | The attributes are described in `HP9000 Series 800 Assembly Language
|
|---|
| 930 | Reference Manual' (HP 92432-90001) under the `IMPORT' and `EXPORT'
|
|---|
| 931 | assembler directive documentation.
|
|---|
| 932 |
|
|---|
| 933 |
|
|---|
| 934 | File: as.info, Node: Expressions, Next: Pseudo Ops, Prev: Symbols, Up: Top
|
|---|
| 935 |
|
|---|
| 936 | Expressions
|
|---|
| 937 | ***********
|
|---|
| 938 |
|
|---|
| 939 | An "expression" specifies an address or numeric value. Whitespace
|
|---|
| 940 | may precede and/or follow an expression.
|
|---|
| 941 |
|
|---|
| 942 | The result of an expression must be an absolute number, or else an
|
|---|
| 943 | offset into a particular section. If an expression is not absolute,
|
|---|
| 944 | and there is not enough information when `as' sees the expression to
|
|---|
| 945 | know its section, a second pass over the source program might be
|
|---|
| 946 | necessary to interpret the expression--but the second pass is currently
|
|---|
| 947 | not implemented. `as' aborts with an error message in this situation.
|
|---|
| 948 |
|
|---|
| 949 | * Menu:
|
|---|
| 950 |
|
|---|
| 951 | * Empty Exprs:: Empty Expressions
|
|---|
| 952 | * Integer Exprs:: Integer Expressions
|
|---|
| 953 |
|
|---|
| 954 |
|
|---|
| 955 | File: as.info, Node: Empty Exprs, Next: Integer Exprs, Up: Expressions
|
|---|
| 956 |
|
|---|
| 957 | Empty Expressions
|
|---|
| 958 | =================
|
|---|
| 959 |
|
|---|
| 960 | An empty expression has no value: it is just whitespace or null.
|
|---|
| 961 | Wherever an absolute expression is required, you may omit the
|
|---|
| 962 | expression, and `as' assumes a value of (absolute) 0. This is
|
|---|
| 963 | compatible with other assemblers.
|
|---|
| 964 |
|
|---|
| 965 |
|
|---|
| 966 | File: as.info, Node: Integer Exprs, Prev: Empty Exprs, Up: Expressions
|
|---|
| 967 |
|
|---|
| 968 | Integer Expressions
|
|---|
| 969 | ===================
|
|---|
| 970 |
|
|---|
| 971 | An "integer expression" is one or more _arguments_ delimited by
|
|---|
| 972 | _operators_.
|
|---|
| 973 |
|
|---|
| 974 | * Menu:
|
|---|
| 975 |
|
|---|
| 976 | * Arguments:: Arguments
|
|---|
| 977 | * Operators:: Operators
|
|---|
| 978 | * Prefix Ops:: Prefix Operators
|
|---|
| 979 | * Infix Ops:: Infix Operators
|
|---|
| 980 |
|
|---|
| 981 |
|
|---|
| 982 | File: as.info, Node: Arguments, Next: Operators, Up: Integer Exprs
|
|---|
| 983 |
|
|---|
| 984 | Arguments
|
|---|
| 985 | ---------
|
|---|
| 986 |
|
|---|
| 987 | "Arguments" are symbols, numbers or subexpressions. In other
|
|---|
| 988 | contexts arguments are sometimes called "arithmetic operands". In this
|
|---|
| 989 | manual, to avoid confusing them with the "instruction operands" of the
|
|---|
| 990 | machine language, we use the term "argument" to refer to parts of
|
|---|
| 991 | expressions only, reserving the word "operand" to refer only to machine
|
|---|
| 992 | instruction operands.
|
|---|
| 993 |
|
|---|
| 994 | Symbols are evaluated to yield {SECTION NNN} where SECTION is one of
|
|---|
| 995 | text, data, bss, absolute, or undefined. NNN is a signed, 2's
|
|---|
| 996 | complement 32 bit integer.
|
|---|
| 997 |
|
|---|
| 998 | Numbers are usually integers.
|
|---|
| 999 |
|
|---|
| 1000 | A number can be a flonum or bignum. In this case, you are warned
|
|---|
| 1001 | that only the low order 32 bits are used, and `as' pretends these 32
|
|---|
| 1002 | bits are an integer. You may write integer-manipulating instructions
|
|---|
| 1003 | that act on exotic constants, compatible with other assemblers.
|
|---|
| 1004 |
|
|---|
| 1005 | Subexpressions are a left parenthesis `(' followed by an integer
|
|---|
| 1006 | expression, followed by a right parenthesis `)'; or a prefix operator
|
|---|
| 1007 | followed by an argument.
|
|---|
| 1008 |
|
|---|
| 1009 |
|
|---|
| 1010 | File: as.info, Node: Operators, Next: Prefix Ops, Prev: Arguments, Up: Integer Exprs
|
|---|
| 1011 |
|
|---|
| 1012 | Operators
|
|---|
| 1013 | ---------
|
|---|
| 1014 |
|
|---|
| 1015 | "Operators" are arithmetic functions, like `+' or `%'. Prefix
|
|---|
| 1016 | operators are followed by an argument. Infix operators appear between
|
|---|
| 1017 | their arguments. Operators may be preceded and/or followed by
|
|---|
| 1018 | whitespace.
|
|---|
| 1019 |
|
|---|
| 1020 |
|
|---|
| 1021 | File: as.info, Node: Prefix Ops, Next: Infix Ops, Prev: Operators, Up: Integer Exprs
|
|---|
| 1022 |
|
|---|
| 1023 | Prefix Operator
|
|---|
| 1024 | ---------------
|
|---|
| 1025 |
|
|---|
| 1026 | `as' has the following "prefix operators". They each take one
|
|---|
| 1027 | argument, which must be absolute.
|
|---|
| 1028 |
|
|---|
| 1029 | `-'
|
|---|
| 1030 | "Negation". Two's complement negation.
|
|---|
| 1031 |
|
|---|
| 1032 | `~'
|
|---|
| 1033 | "Complementation". Bitwise not.
|
|---|
| 1034 |
|
|---|
| 1035 |
|
|---|
| 1036 | File: as.info, Node: Infix Ops, Prev: Prefix Ops, Up: Integer Exprs
|
|---|
| 1037 |
|
|---|
| 1038 | Infix Operators
|
|---|
| 1039 | ---------------
|
|---|
| 1040 |
|
|---|
| 1041 | "Infix operators" take two arguments, one on either side. Operators
|
|---|
| 1042 | have precedence, but operations with equal precedence are performed left
|
|---|
| 1043 | to right. Apart from `+' or `-', both arguments must be absolute, and
|
|---|
| 1044 | the result is absolute.
|
|---|
| 1045 |
|
|---|
| 1046 | 1. Highest Precedence
|
|---|
| 1047 |
|
|---|
| 1048 | `*'
|
|---|
| 1049 | "Multiplication".
|
|---|
| 1050 |
|
|---|
| 1051 | `/'
|
|---|
| 1052 | "Division". Truncation is the same as the C operator `/'
|
|---|
| 1053 |
|
|---|
| 1054 | `%'
|
|---|
| 1055 | "Remainder".
|
|---|
| 1056 |
|
|---|
| 1057 | `<'
|
|---|
| 1058 | `<<'
|
|---|
| 1059 | "Shift Left". Same as the C operator `<<'.
|
|---|
| 1060 |
|
|---|
| 1061 | `>'
|
|---|
| 1062 | `>>'
|
|---|
| 1063 | "Shift Right". Same as the C operator `>>'.
|
|---|
| 1064 |
|
|---|
| 1065 | 2. Intermediate precedence
|
|---|
| 1066 |
|
|---|
| 1067 | `|'
|
|---|
| 1068 | "Bitwise Inclusive Or".
|
|---|
| 1069 |
|
|---|
| 1070 | `&'
|
|---|
| 1071 | "Bitwise And".
|
|---|
| 1072 |
|
|---|
| 1073 | `^'
|
|---|
| 1074 | "Bitwise Exclusive Or".
|
|---|
| 1075 |
|
|---|
| 1076 | `!'
|
|---|
| 1077 | "Bitwise Or Not".
|
|---|
| 1078 |
|
|---|
| 1079 | 3. Low Precedence
|
|---|
| 1080 |
|
|---|
| 1081 | `+'
|
|---|
| 1082 | "Addition". If either argument is absolute, the result has
|
|---|
| 1083 | the section of the other argument. You may not add together
|
|---|
| 1084 | arguments from different sections.
|
|---|
| 1085 |
|
|---|
| 1086 | `-'
|
|---|
| 1087 | "Subtraction". If the right argument is absolute, the result
|
|---|
| 1088 | has the section of the left argument. If both arguments are
|
|---|
| 1089 | in the same section, the result is absolute. You may not
|
|---|
| 1090 | subtract arguments from different sections.
|
|---|
| 1091 |
|
|---|
| 1092 | `=='
|
|---|
| 1093 | "Is Equal To"
|
|---|
| 1094 |
|
|---|
| 1095 | `<>'
|
|---|
| 1096 | "Is Not Equal To"
|
|---|
| 1097 |
|
|---|
| 1098 | `<'
|
|---|
| 1099 | "Is Less Than"
|
|---|
| 1100 |
|
|---|
| 1101 | `>'
|
|---|
| 1102 | "Is Greater Than"
|
|---|
| 1103 |
|
|---|
| 1104 | `>='
|
|---|
| 1105 | "Is Greater Than Or Equal To"
|
|---|
| 1106 |
|
|---|
| 1107 | `<='
|
|---|
| 1108 | "Is Less Than Or Equal To"
|
|---|
| 1109 |
|
|---|
| 1110 | The comparison operators can be used as infix operators. A
|
|---|
| 1111 | true results has a value of -1 whereas a false result has a
|
|---|
| 1112 | value of 0. Note, these operators perform signed
|
|---|
| 1113 | comparisons.
|
|---|
| 1114 |
|
|---|
| 1115 | 4. Lowest Precedence
|
|---|
| 1116 |
|
|---|
| 1117 | `&&'
|
|---|
| 1118 | "Logical And".
|
|---|
| 1119 |
|
|---|
| 1120 | `||'
|
|---|
| 1121 | "Logical Or".
|
|---|
| 1122 |
|
|---|
| 1123 | These two logical operations can be used to combine the
|
|---|
| 1124 | results of sub expressions. Note, unlike the comparison
|
|---|
| 1125 | operators a true result returns a value of 1 but a false
|
|---|
| 1126 | results does still return 0. Also note that the logical or
|
|---|
| 1127 | operator has a slightly lower precedence than logical and.
|
|---|
| 1128 |
|
|---|
| 1129 |
|
|---|
| 1130 | In short, it's only meaningful to add or subtract the _offsets_ in an
|
|---|
| 1131 | address; you can only have a defined section in one of the two
|
|---|
| 1132 | arguments.
|
|---|
| 1133 |
|
|---|
| 1134 |
|
|---|
| 1135 | File: as.info, Node: Pseudo Ops, Next: Machine Dependencies, Prev: Expressions, Up: Top
|
|---|
| 1136 |
|
|---|
| 1137 | Assembler Directives
|
|---|
| 1138 | ********************
|
|---|
| 1139 |
|
|---|
| 1140 | All assembler directives have names that begin with a period (`.').
|
|---|
| 1141 | The rest of the name is letters, usually in lower case.
|
|---|
| 1142 |
|
|---|
| 1143 | This chapter discusses directives that are available regardless of
|
|---|
| 1144 | the target machine configuration for the GNU assembler. Some machine
|
|---|
| 1145 | configurations provide additional directives. *Note Machine
|
|---|
| 1146 | Dependencies::.
|
|---|
| 1147 |
|
|---|
| 1148 | * Menu:
|
|---|
| 1149 |
|
|---|
| 1150 | * Abort:: `.abort'
|
|---|
| 1151 |
|
|---|
| 1152 | * ABORT:: `.ABORT'
|
|---|
| 1153 |
|
|---|
| 1154 | * Align:: `.align ABS-EXPR , ABS-EXPR'
|
|---|
| 1155 | * Ascii:: `.ascii "STRING"'...
|
|---|
| 1156 | * Asciz:: `.asciz "STRING"'...
|
|---|
| 1157 | * Balign:: `.balign ABS-EXPR , ABS-EXPR'
|
|---|
| 1158 | * Byte:: `.byte EXPRESSIONS'
|
|---|
| 1159 | * Comm:: `.comm SYMBOL , LENGTH '
|
|---|
| 1160 | * Data:: `.data SUBSECTION'
|
|---|
| 1161 |
|
|---|
| 1162 | * Def:: `.def NAME'
|
|---|
| 1163 |
|
|---|
| 1164 | * Desc:: `.desc SYMBOL, ABS-EXPRESSION'
|
|---|
| 1165 |
|
|---|
| 1166 | * Dim:: `.dim'
|
|---|
| 1167 |
|
|---|
| 1168 | * Double:: `.double FLONUMS'
|
|---|
| 1169 | * Eject:: `.eject'
|
|---|
| 1170 | * Else:: `.else'
|
|---|
| 1171 | * Elseif:: `.elseif'
|
|---|
| 1172 | * End:: `.end'
|
|---|
| 1173 |
|
|---|
| 1174 | * Endef:: `.endef'
|
|---|
| 1175 |
|
|---|
| 1176 | * Endfunc:: `.endfunc'
|
|---|
| 1177 | * Endif:: `.endif'
|
|---|
| 1178 | * Equ:: `.equ SYMBOL, EXPRESSION'
|
|---|
| 1179 | * Equiv:: `.equiv SYMBOL, EXPRESSION'
|
|---|
| 1180 | * Err:: `.err'
|
|---|
| 1181 | * Exitm:: `.exitm'
|
|---|
| 1182 | * Extern:: `.extern'
|
|---|
| 1183 | * Fail:: `.fail'
|
|---|
| 1184 |
|
|---|
| 1185 | * File:: `.file STRING'
|
|---|
| 1186 |
|
|---|
| 1187 | * Fill:: `.fill REPEAT , SIZE , VALUE'
|
|---|
| 1188 | * Float:: `.float FLONUMS'
|
|---|
| 1189 | * Func:: `.func'
|
|---|
| 1190 | * Global:: `.global SYMBOL', `.globl SYMBOL'
|
|---|
| 1191 |
|
|---|
| 1192 | * Hidden:: `.hidden NAMES'
|
|---|
| 1193 |
|
|---|
| 1194 | * hword:: `.hword EXPRESSIONS'
|
|---|
| 1195 | * Ident:: `.ident'
|
|---|
| 1196 | * If:: `.if ABSOLUTE EXPRESSION'
|
|---|
| 1197 | * Incbin:: `.incbin "FILE"[,SKIP[,COUNT]]'
|
|---|
| 1198 | * Include:: `.include "FILE"'
|
|---|
| 1199 | * Int:: `.int EXPRESSIONS'
|
|---|
| 1200 |
|
|---|
| 1201 | * Internal:: `.internal NAMES'
|
|---|
| 1202 |
|
|---|
| 1203 | * Irp:: `.irp SYMBOL,VALUES'...
|
|---|
| 1204 | * Irpc:: `.irpc SYMBOL,VALUES'...
|
|---|
| 1205 | * Lcomm:: `.lcomm SYMBOL , LENGTH'
|
|---|
| 1206 | * Lflags:: `.lflags'
|
|---|
| 1207 |
|
|---|
| 1208 | * Line:: `.line LINE-NUMBER'
|
|---|
| 1209 |
|
|---|
| 1210 | * Ln:: `.ln LINE-NUMBER'
|
|---|
| 1211 | * Linkonce:: `.linkonce [TYPE]'
|
|---|
| 1212 | * List:: `.list'
|
|---|
| 1213 | * Long:: `.long EXPRESSIONS'
|
|---|
| 1214 |
|
|---|
| 1215 | * Macro:: `.macro NAME ARGS'...
|
|---|
| 1216 | * MRI:: `.mri VAL'
|
|---|
| 1217 | * Nolist:: `.nolist'
|
|---|
| 1218 | * Octa:: `.octa BIGNUMS'
|
|---|
| 1219 | * Org:: `.org NEW-LC , FILL'
|
|---|
| 1220 | * P2align:: `.p2align ABS-EXPR , ABS-EXPR'
|
|---|
| 1221 |
|
|---|
| 1222 | * PopSection:: `.popsection'
|
|---|
| 1223 | * Previous:: `.previous'
|
|---|
| 1224 |
|
|---|
| 1225 | * Print:: `.print STRING'
|
|---|
| 1226 |
|
|---|
| 1227 | * Protected:: `.protected NAMES'
|
|---|
| 1228 |
|
|---|
| 1229 | * Psize:: `.psize LINES, COLUMNS'
|
|---|
| 1230 | * Purgem:: `.purgem NAME'
|
|---|
| 1231 |
|
|---|
| 1232 | * PushSection:: `.pushsection NAME'
|
|---|
| 1233 |
|
|---|
| 1234 | * Quad:: `.quad BIGNUMS'
|
|---|
| 1235 | * Rept:: `.rept COUNT'
|
|---|
| 1236 | * Sbttl:: `.sbttl "SUBHEADING"'
|
|---|
| 1237 |
|
|---|
| 1238 | * Scl:: `.scl CLASS'
|
|---|
| 1239 |
|
|---|
| 1240 | * Section:: `.section NAME'
|
|---|
| 1241 |
|
|---|
| 1242 | * Set:: `.set SYMBOL, EXPRESSION'
|
|---|
| 1243 | * Short:: `.short EXPRESSIONS'
|
|---|
| 1244 | * Single:: `.single FLONUMS'
|
|---|
| 1245 |
|
|---|
| 1246 | * Size:: `.size [NAME , EXPRESSION]'
|
|---|
| 1247 |
|
|---|
| 1248 | * Skip:: `.skip SIZE , FILL'
|
|---|
| 1249 | * Sleb128:: `.sleb128 EXPRESSIONS'
|
|---|
| 1250 | * Space:: `.space SIZE , FILL'
|
|---|
| 1251 |
|
|---|
| 1252 | * Stab:: `.stabd, .stabn, .stabs'
|
|---|
| 1253 |
|
|---|
| 1254 | * String:: `.string "STR"'
|
|---|
| 1255 | * Struct:: `.struct EXPRESSION'
|
|---|
| 1256 |
|
|---|
| 1257 | * SubSection:: `.subsection'
|
|---|
| 1258 | * Symver:: `.symver NAME,NAME2@NODENAME'
|
|---|
| 1259 |
|
|---|
| 1260 |
|
|---|
| 1261 | * Tag:: `.tag STRUCTNAME'
|
|---|
| 1262 |
|
|---|
| 1263 | * Text:: `.text SUBSECTION'
|
|---|
| 1264 | * Title:: `.title "HEADING"'
|
|---|
| 1265 |
|
|---|
| 1266 | * Type:: `.type <INT | NAME , TYPE DESCRIPTION>'
|
|---|
| 1267 |
|
|---|
| 1268 | * Uleb128:: `.uleb128 EXPRESSIONS'
|
|---|
| 1269 |
|
|---|
| 1270 | * Val:: `.val ADDR'
|
|---|
| 1271 |
|
|---|
| 1272 |
|
|---|
| 1273 | * Version:: `.version "STRING"'
|
|---|
| 1274 | * VTableEntry:: `.vtable_entry TABLE, OFFSET'
|
|---|
| 1275 | * VTableInherit:: `.vtable_inherit CHILD, PARENT'
|
|---|
| 1276 | * Weak:: `.weak NAMES'
|
|---|
| 1277 |
|
|---|
| 1278 | * Word:: `.word EXPRESSIONS'
|
|---|
| 1279 | * Deprecated:: Deprecated Directives
|
|---|
| 1280 |
|
|---|
| 1281 |
|
|---|
| 1282 | File: as.info, Node: Abort, Next: ABORT, Up: Pseudo Ops
|
|---|
| 1283 |
|
|---|
| 1284 | `.abort'
|
|---|
| 1285 | ========
|
|---|
| 1286 |
|
|---|
| 1287 | This directive stops the assembly immediately. It is for
|
|---|
| 1288 | compatibility with other assemblers. The original idea was that the
|
|---|
| 1289 | assembly language source would be piped into the assembler. If the
|
|---|
| 1290 | sender of the source quit, it could use this directive tells `as' to
|
|---|
| 1291 | quit also. One day `.abort' will not be supported.
|
|---|
| 1292 |
|
|---|
| 1293 |
|
|---|
| 1294 | File: as.info, Node: ABORT, Next: Align, Prev: Abort, Up: Pseudo Ops
|
|---|
| 1295 |
|
|---|
| 1296 | `.ABORT'
|
|---|
| 1297 | ========
|
|---|
| 1298 |
|
|---|
| 1299 | When producing COFF output, `as' accepts this directive as a synonym
|
|---|
| 1300 | for `.abort'.
|
|---|
| 1301 |
|
|---|
| 1302 | When producing `b.out' output, `as' accepts this directive, but
|
|---|
| 1303 | ignores it.
|
|---|
| 1304 |
|
|---|
| 1305 |
|
|---|
| 1306 | File: as.info, Node: Align, Next: Ascii, Prev: ABORT, Up: Pseudo Ops
|
|---|
| 1307 |
|
|---|
| 1308 | `.align ABS-EXPR, ABS-EXPR, ABS-EXPR'
|
|---|
| 1309 | =====================================
|
|---|
| 1310 |
|
|---|
| 1311 | Pad the location counter (in the current subsection) to a particular
|
|---|
| 1312 | storage boundary. The first expression (which must be absolute) is the
|
|---|
| 1313 | alignment required, as described below.
|
|---|
| 1314 |
|
|---|
| 1315 | The second expression (also absolute) gives the fill value to be
|
|---|
| 1316 | stored in the padding bytes. It (and the comma) may be omitted. If it
|
|---|
| 1317 | is omitted, the padding bytes are normally zero. However, on some
|
|---|
| 1318 | systems, if the section is marked as containing code and the fill value
|
|---|
| 1319 | is omitted, the space is filled with no-op instructions.
|
|---|
| 1320 |
|
|---|
| 1321 | The third expression is also absolute, and is also optional. If it
|
|---|
| 1322 | is present, it is the maximum number of bytes that should be skipped by
|
|---|
| 1323 | this alignment directive. If doing the alignment would require
|
|---|
| 1324 | skipping more bytes than the specified maximum, then the alignment is
|
|---|
| 1325 | not done at all. You can omit the fill value (the second argument)
|
|---|
| 1326 | entirely by simply using two commas after the required alignment; this
|
|---|
| 1327 | can be useful if you want the alignment to be filled with no-op
|
|---|
| 1328 | instructions when appropriate.
|
|---|
| 1329 |
|
|---|
| 1330 | The way the required alignment is specified varies from system to
|
|---|
| 1331 | system. For the a29k, hppa, m68k, m88k, w65, sparc, Xtensa, and
|
|---|
| 1332 | Renesas / SuperH SH, and i386 using ELF format, the first expression is
|
|---|
| 1333 | the alignment request in bytes. For example `.align 8' advances the
|
|---|
| 1334 | location counter until it is a multiple of 8. If the location counter
|
|---|
| 1335 | is already a multiple of 8, no change is needed.
|
|---|
| 1336 |
|
|---|
| 1337 | For other systems, including the i386 using a.out format, and the
|
|---|
| 1338 | arm and strongarm, it is the number of low-order zero bits the location
|
|---|
| 1339 | counter must have after advancement. For example `.align 3' advances
|
|---|
| 1340 | the location counter until it a multiple of 8. If the location counter
|
|---|
| 1341 | is already a multiple of 8, no change is needed.
|
|---|
| 1342 |
|
|---|
| 1343 | This inconsistency is due to the different behaviors of the various
|
|---|
| 1344 | native assemblers for these systems which GAS must emulate. GAS also
|
|---|
| 1345 | provides `.balign' and `.p2align' directives, described later, which
|
|---|
| 1346 | have a consistent behavior across all architectures (but are specific
|
|---|
| 1347 | to GAS).
|
|---|
| 1348 |
|
|---|
| 1349 |
|
|---|
| 1350 | File: as.info, Node: Ascii, Next: Asciz, Prev: Align, Up: Pseudo Ops
|
|---|
| 1351 |
|
|---|
| 1352 | `.ascii "STRING"'...
|
|---|
| 1353 | ====================
|
|---|
| 1354 |
|
|---|
| 1355 | `.ascii' expects zero or more string literals (*note Strings::)
|
|---|
| 1356 | separated by commas. It assembles each string (with no automatic
|
|---|
| 1357 | trailing zero byte) into consecutive addresses.
|
|---|
| 1358 |
|
|---|
| 1359 |
|
|---|
| 1360 | File: as.info, Node: Asciz, Next: Balign, Prev: Ascii, Up: Pseudo Ops
|
|---|
| 1361 |
|
|---|
| 1362 | `.asciz "STRING"'...
|
|---|
| 1363 | ====================
|
|---|
| 1364 |
|
|---|
| 1365 | `.asciz' is just like `.ascii', but each string is followed by a
|
|---|
| 1366 | zero byte. The "z" in `.asciz' stands for "zero".
|
|---|
| 1367 |
|
|---|