aout.htm

来自「刚刚看到本站有Visual C++数字图象处理(人民邮电出版社)的电子书」· HTM 代码 · 共 1,084 行 · 第 1/5 页

HTM
1,084
字号
           extension records follow symbols that define and reference procedure

           entry points and global variables.  the first extension record, the

           symbol extension record, defines the type of the return value or

           global variable, and (if a procedure or function) the number of

           parameters and the types of the first three parameters.  if more

           parameter type descriptors are needed, one or more argument extension

           records follow, each containing four more descriptors.  a check level

           of 0 specifies no type checking; no extension records follow.  a check

           level of 1 or more specifies checking of the return value or global

           variable type.  a check level of 2 or more specifies checking of the

           number of parameters, and a check level of 3 specifies checking the

           types of each individual parameter.  the linker performs the requested

           level of type checking between unsatisfied symbols and local or

           universal symbols as it resolves symbol references.

     

              union arg_descriptor \{

                  struct \{

                  unsigned int    reserved: 3;    /* not used */

                  unsigned int    packing: 1;     /* reserved */

                  unsigned int    alignment: 4;   /* byte alignment */

                  unsigned int    reserved2: 1;   /* not used */

                  unsigned int    mode: 3;             /* use of symbol */

                  unsigned int    structure: 4;   /* structure of symbol */

                  unsigned int    hash: 1;             /* set if arg_type is hashed */

                  int             arg_type: 15;   /* data type */

                  \}             arg_desc;

                  unsigned int    word;

              \};

     

              struct symbol_extension_record \{

                  unsigned int    type:           8;             /* always st_sym_ext */

                  unsigned int    max_num_args: 8;             /* max # of parameters */

                  unsigned int    min_num_args: 8;             /* min # of parameters */

                  unsigned int    num_args:     8;             /* actual # of parameters */

                  union arg_descriptor symbol_desc;       /* symbol type desc. */

                  union arg_descriptor argument_desc[3];  /* first 3 parameters */

              \};

     

              struct argument_desc_array \{

                  unsigned int    type:        8;             /* always st_arg_ext */

                  unsigned int    reserved: 24;             /* not used */

                  union arg_descriptor argument_desc[4];  /* next 4 parameters */

              \};

           the values for the alignment, mode, structure, and arg_type (when the

           data type is not hashed) fields are given in the following table.

     

          value   alignment       mode               structure         arg_type

          _______________________________________________________________________

            0     byte       any               any               any

            1     half-word       value parm         scalar         void

            2     word       reference parm         array         signed byte

            3     dbl word       value-result         struct         unsigned byte

            4             name               pointer         signed short

            5             variable         long ptr         unsigned short

            6     64-byte       function return   c string         signed long

            7             procedure         pascal string   unsigned long

            8             long ref parm         procedure         signed dbl word

            9                           function         unsigned dbl word

           10                           label         short real

           11     page                                 real

           12                                       long real

           13                                       short complex

           14                                       complex

           15                                       long complex

           16                                       packed decimal

           17                                       struct/array

     

           for procedure entry points, the parameter relocation bits define the

           locations of the formal parameters and the return value.      normally,

           the first four words of the parameter list are passed in general

           registers (r26-r23) instead of on the stack, and the return value is

           returned in r29.      floating-point parameters in this range are passed

           instead in floating-point registers (fr4-fr7) and a floating-point

           value is returned in fr4.       the parameter relocation bits consist of

           five pairs of bits that describe the first four words of the parameter

           list and the return value.  the leftmost pair of bits describes the

           first parameter word, and the rightmost pair of bits describes the

           return value.  the meanings of these bits are shown in the following

           table.

     

     

              bits | meaning

              _____|_____________________________________________________

               00      | no parameter or return value

               01      | parameter or return value in general register

               10      | parameter or return value in floating-point register

               11      | double-precision floating-point value

     

           for double-precision floating-point parameters, the odd-numbered

           parameter word should be marked 11 and the even-numbered parameter

           word should be marked 10.       double-precision return values are simply

           marked 11.

           every procedure call is tagged with a similar set of bits (see

           relocation information, below), so that the linker can match each call

           with the expectations of the procedure entry point.  if the call and

           entry point mismatch, the linker creates a stub that relocates the

           parameters and return value as appropriate.

     

         relocation information

           each initialized subspace defines a range of fixups that apply to the

           data in that subspace.  a fixup request is associated with every word

           that requires relocation or that contains a reference to an

           unsatisfied symbol.  in relocatable object files created prior to hp-

           ux release 3.0 on series 800 systems each fixup request is a five-word

           structure describing a code or data word to be patched at link time.

           object files created on release 3.0 or later contain variable-length

           fixup requests that describe every byte of the subspace.      the

           version_id field in the file header distinguishes these two formats;

           the constant version_id is found in older object files, and the

           constant new_version_id is found in newer ones.

     

           in older object files, fixups can compute an expression involving

           zero, one, or two symbols and a constant, then extract a field of bits

           from that result and deposit those bits in any of several different

           formats (corresponding to the precision architecture instruction set).

           the fixup_request_index field in the subspace dictionary entry indexes

           into the fixup request area defined by the file header, and the

           fixup_request_quantity field refers to the number of fixup requests

           used for that subspace.  the structure of a fixup request is contained

           in <reloc.h>.

     

              struct fixup_request_record \{

                  unsigned int    need_data_ref:      1;     /* reserved */

                  unsigned int    arg_reloc:      10;     /* parameter relocation bits */

                  unsigned int    expression_type: 5;     /* how to compute value */

                  unsigned int    exec_level:      2;     /* reserved */

                  unsigned int    fixup_format:      6;     /* how to deposit bits */

                  unsigned int    fixup_field:      8;     /* field to extract */

                  unsigned int    subspace_offset;             /* subspace offset of word */

                  unsigned int    symbol_index_one;       /* index of first symbol */

                  unsigned int    symbol_index_two;       /* index of second symbol */

                  int             fixup_constant;             /* constant */

              \};

     

              /* values for expression_type */

              #define e_one      0       /* symbol1 + constant */

              #define e_two      1       /* symbol1 - symbol2 + constant */

              #define e_pcrel    2       /* symbol1 - pc + constant */

              #define e_con      3       /* constant */

              #define e_plabel   7       /* symbol1 + constant */

              #define e_abs     18       /* reserved */

              /* values for fixup_field (assembler mnemonics shown) */

              #define e_fsel     0       /* f': no change */

              #define e_lssel    1       /* ls': inverse of rs' */

              #define e_rssel    2       /* rs': rightmost 11 bits, signed */

              #define e_lsel     3       /* l': leftmost 21 bits */

              #define e_rsel     4       /* r': rightmost 11 bits */

              #define e_ldsel    5       /* ld': inverse of rd' */

              #define e_rdsel    6       /* rd': rightmost 11 bits, filled left with ones */

              #define e_lrsel    7       /* lr': l' with  rounded" constant */"

              #define e_rrsel    8       /* rr': r' with  rounded" constant */"

     

              /* values for fixup_format (typical instructions shown) */"

              #define i_exp14    0       /* 14-bit immediate (ldw, stw) */

              #define i_exp21    1       /* 21-bit immediate (ldil, addil) */

              #define i_exp11    2       /* 11-bit immediate (addi, subi) */

              #define i_rel17    3       /* 17-bit pc-relative (bl) */

              #define i_rel12    4       /* 12 bit pc-relative (combt, combf, etc.) */

              #define i_data     5       /* whole word */

              #define i_none     6       /* not used */

              #define i_abs17    7       /* 17-bit absolute (be, ble) */

              #define i_milli    8       /* 17-bit millicode call (ble) */

              #define i_break    9       /* reserved (no effect on hp-ux) */

     

           in newer object files, relocation entries consist of a stream of

           bytes.  the fixup_request_index field in the subspace dictionary entry

           is a byte offset into the fixup dictionary defined by the file header,

           and the fixup_request_quantity field defines the length of the fixup

           request stream, in bytes, for that subspace.  the first byte of each

           fixup request (the opcode) identifies the request and determines the

           length of the request.

     

           in general, the fixup stream is a series of linker instructions that

           governs how the linker places data in the a.out file.  certain fixup

           requests cause the linker to copy one or more bytes from the input

           subspace to the output subspace without change, while others direct

           the linker to relocate words or resolve external references.  still

           others direct the linker to insert zeroes in the output subspace or to

           leave areas uninitialized without copying any data from the input

           subspace, and others describe points in the code without contributing

           any new data to the output file.

     

           the include file <reloc.h> defines constants for each major opcode.

           many fixup requests use a range of opcodes; only a constant for the

           beginning of the range is defined.  the meaning of each fixup request

           is described below.  the opcode ranges and parameters for each fixup

           are described in the table further below.

     

           r_no_relocation

                      copy l bytes with no relocation.

           r_zeroes           insert l zero bytes into the output subspace.

     

           r_uninit           skip l bytes in the output subspace.

     

           r_relocation   copy one data word with relocation.  the word is

                      assumed to contain a 32-bit pointer relative to its own

                      subspace.

     

           r_data_one_symbol

                      copy one data word with relocation relative to an

                      external symbol whose symbol index is s.

     

           r_data_plabel  copy one data word as a 32-bit procedure label,

                      referring to the symbol s.       the original contents of

                      the word should be 0 (no static link) or 2 (static link

                      required).

     

           r_space_ref    copy one data word as a space reference.  this fixup

                      request is not currently supported.

     

           r_repeated_init

                      copy l bytes from the input subspace, replicating the

                      data to fill m bytes in the output subspace.

     

           r_pcrel_call   copy one instruction word with relocation.       the word is

                      assumed to be a pc-relative procedure call instruction

                      (for example, bl).       the target procedure is identified

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?