⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ack.out.man

📁 坦尼保姆
💻 MAN
字号:
ACK.OUT(5)           Amsterdam Compiler Kit            ACK.OUT(5)NAME     ack.out - ACK-assembler and link editor outputSYNOPSIS     #include <out.h>DESCRIPTION     This manual page discusses the format of  object  files,  as     generated  by  ACK  assemblers and the link editor LED.  The     format is designed to be compact, machine  independent,  and     portable from one machine to another, so that an object file     can be produced on one machine,  and  further  processed  on     another.     In the following discussion,  some  structures  are  defined     using  long and short as type indicators. It is assumed that     the size of a short is 2 bytes (chars) and that the size  of     a  long  is  4  bytes.   However, these types have a machine     dependent  byte  and  word  order.   Therefore,  a   machine     independent  representation is chosen for the object format:     a long consists of two shorts, of which the  least  signifi-     cant  one comes first, and a short consists of two bytes, of     which the least significant one comes first.   There  is  no     alignment between various parts and structures in the object     file.     In general, an object file consists of the following parts:     - a file header     - a number of section headers     - the sections themselves     - a number of relocation structures     - a symbol table     - a string area containing the names from the symbol table     The header.     The header of an object file has the following structure:     struct outhead {              unsigned short     oh_magic;/* magic number */              unsigned short     oh_stamp;/* version stamp */              unsigned short     oh_flags;/* several format flags */              unsigned short     oh_nsect;/* number of outsect structures */              unsigned short     oh_nrelo;/* number of outrelo structures */              unsigned short     oh_nname;/* number of outname structures */              long    oh_nemit;  /* length of sections */              long    oh_nchar;  /* size of string area */     };     #define HF_LINK  0x0004     /* unresolved references left */5th ACK distribution    $Revision: 1.7 $                        1ACK.OUT(5)           Amsterdam Compiler Kit            ACK.OUT(5)     The fields of this structure have the following purpose:     oh_magic   A magic number, indicating that this is an object                file.     oh_stamp   A version stamp, used to detect obsolete versions                of object files.     oh_flags   Currently only used for the  HF_LINK  flag.  When                this  flag  is  set,  the  object  file  contains                unresolved references.     oh_nsect   The number of sections  and  section  description                structures,  later  on  referred  to  as  _o_u_t_s_e_c_t                structures.  Usually, there are only a  few  sec-                tions, f.i. a TEXT section, a ROM section, a DATA                section and a BSS section.  Notice  that  neither                the  assemblers nor LED know more about them than                their names.     oh_nrelo   The number of  relocation  structures,  later  on                referred to as _o_u_t_r_e_l_o structures.     oh_nname   The number of symbol table structures,  later  on                referred to as _o_u_t_n_a_m_e structures.     oh_nemit   The total number of bytes  in  this  object  file                used  for the sections themselves.  This field is                used to find  the  relocation  and  symbol  table                structures fast.     oh_nchar   The size  of  the  string  area  (the  number  of                bytes).     The section descriptions.     The next part  of  an  object  file  contains  the  outsect-     structures.  An outsect structure has the following layout:     struct outsect {              long    os_base;   /* start address in machine */              long    os_size;   /* section size in machine */              long    os_foff;   /* start address in file */              long    os_flen;   /* section size in file */              long    os_lign;   /* section alignment */     };     The fields in this structure have the following purpose:     os_base    The start address of this section in  the  target                machine.  This address is determined by LED, when                producing a non-relocatable object file.   It  is                ignored for relocatable object files.5th ACK distribution    $Revision: 1.7 $                        2ACK.OUT(5)           Amsterdam Compiler Kit            ACK.OUT(5)     os_size    The size of this section on the target machine.     os_foff    The start address of this section in this file.     os_flen    The size of this  section  in  this  file.   This                field does not have to have the same value as the                _o_s__s_i_z_e field!  For  instance,  an  uninitialized                data  section  probably  has  _o_s__f_l_e_n  set  to 0.                Notice that the _o_h__n_e_m_i_t field of the header con-                tains the sum of all the _o_s__f_l_e_n fields.     os_lign    The alignment requirement for this  section.  The                requirement is that the loader must leave                       _o_s__b_a_s_e mod _o_s__l_i_g_n = 0                in tact.     The sections.     The next part of an object file contains the sections  them-     selves.   Usually, the LED program places the sections right     behind one another in the target machine, taking the  align-     ment requirements into account. However, the user is allowed     to give the start addresses of each section. But if the user     gave  a start address for say section 2, but not for section     3, section 3 will be put right behind section 2.     The relocation structures.     Relocation information is information that allows a  program     like LED to combine several object files and produce an exe-     cutable binary if there are no  unresolved  references.   If     relocation information is present, it amounts to 8 bytes per     relocatable datum. The information has the following  struc-     ture:     struct outrelo {              char    or_type;   /* type of reference */              char    or_sect;   /* referencing section */              unsigned short     or_nami;/* referenced symbol index */              long    or_addr;   /* referencing address */     };     /*      * relocation type bits      */     #define RELSZ    0x07       /* relocation length */     #define RELO1    0x01       /* 1 byte */     #define RELO2    0x02       /* 2 bytes */     #define RELO4    0x04       /* 4 bytes */     #define RELPC    0x08       /* pc relative */     #define RELBR    0x10       /* High order byte lowest address. */     #define RELWR    0x20       /* High order word lowest address. */5th ACK distribution    $Revision: 1.7 $                        3ACK.OUT(5)           Amsterdam Compiler Kit            ACK.OUT(5)     /*      * section type bits and fields      */     #define S_TYP    0x007F     /* undefined, absolute or relative */     #define S_EXT    0x0080     /* external flag */     #define S_ETC    0x7F00     /* for symbolic debug, bypassing 'as' */     /*      * S_TYP field values      */     #define S_UND    0x0000     /* undefined item */     #define S_ABS    0x0001     /* absolute item */     #define S_MIN    0x0002     /* first user section */     #define S_MAX    (S_TYP-1)  /* last user section */     #define S_CRS    S_TYP      /* reference to other namelist item */     The fields of this structure have the following purpose:     or_type    Contains several flags: One of RELO1,  RELO2  and                RELO4 is set, indicating the size of the relocat-                able datum, RELPC is set when the datum is  relo-                cated  pc relative, RELBR and RELWR indicate byte                and word order of the  relocatable  datum.  RELBR                and  RELWR  are needed here. It is not sufficient                to have flags for  them  in  the  header  of  the                object file, because some machines (NS 32016) use                several of the  possible  combinations  in  their                instruction encoding.     or_sect    Contains the section number  of  the  referenc_i_n_g                section. This is a number that lies between S_MIN                and S_MAX.  The  section  indicated  with  number                S_MIN  is  the  first  section  in  the sections-                section, etc.     or_addr    Contains the address of the relocatable datum, in                the  form  of an offset from the base of the sec-                tion indicated in the _o_r__s_e_c_t field.     or_nami    Usually contains the index of the referenced sym-                bol  in the symbol table, starting at 0.  In this                case, the reference is to an  undefined  external                symbol,  a  common symbol, or a section name. The                relocatable datum then contains  an  offset  from                the  indicated  symbol  or the start of the indi-                cated section.  It may, however,  also  have  the                same  value  as the _o_h__n_n_a_m_e field of the header.                In this case the relocatable datum is an absolute                number,  and  the datum is relocated pc relative.                The relocatable datum must then be relocated with                respect to the base address of its section.5th ACK distribution    $Revision: 1.7 $                        4ACK.OUT(5)           Amsterdam Compiler Kit            ACK.OUT(5)     The symbol table.     This table contains definitions of symbols. It  is  referred     to  by  outrelo-structures,  and  can  be used by debuggers.     Entries in this table have the following structure:     struct outname {              union {                char  *on_ptr;   /* symbol name (in core) */                long  on_off;    /* symbol name (in file) */              }       on_u;     #define on_mptr  on_u.on_ptr     #define on_foff  on_u.on_off              unsigned short     on_type;/* symbol type */              unsigned short     on_desc;/* debug info */              long    on_valu;   /* symbol value */     };     /*      * S_ETC field values      */     #define S_SCT    0x0100     /* section names */     #define S_LIN    0x0200     /* hll source line item */     #define S_FIL    0x0300     /* hll source file item */     #define S_MOD    0x0400     /* ass source file item */     #define S_COM    0x1000     /* Common name */     The members of this structure have the following purpose:     on_foff    Contains the offset of the name from  the  begin-                ning  of  the  file.  The  name  extends from the                offset to the next null byte.     on_type    The S_TYP field of this member contains the  sec-                tion number of the symbol.  Here, this number may                be S_ABS for an absolute item, or S_UND,  for  an                undefined  item.  The  S_EXT  flag is set in this                member if the  symbol  is  external.   The  S_ETC                field  has  the following flags:  S_SCT is set if                the symbol represents a section  name,  S_COM  is                set if the symbol represents a common name, S_LIN                is set if the  symbol  refers  to  a  high  level                language  source  line  item, S_FIL is set if the                symbol refers to a  high  level  language  source                file  item, and S_MOD is set if the symbol refers                to an assembler source file item.     on_desc    Currently not used.     on_valu    Is not used if the symbol refers to an  undefined                item.  For  absolute items it contains the value,                for common names it contains the  size,  and  for                anything  else  it  contains  the offset from the5th ACK distribution    $Revision: 1.7 $                        5ACK.OUT(5)           Amsterdam Compiler Kit            ACK.OUT(5)                beginning of the  section.   In  a  fully  linked                binary, the beginning of the section is added.     The string area.     The last part of an object file contains the name list. This     is just a sequence of null-terminated strings.     The relocation information, the symbol table, and  the  name     list do not have to be present, but then of course we do not     have a relocatable object file.     Miscellaneous defines     The following miscellaneous defines might come in handy when     reading object files:     /*      * structure format strings      */     #define SF_HEAD  "22222244"     #define SF_SECT  "44444"     #define SF_RELO "1124"     #define SF_NAME "4224"     /*      * structure sizes (bytes in file; add digits in SF_*)      */     #define SZ_HEAD  20     #define SZ_SECT  20     #define SZ_RELO  8     #define SZ_NAME  12     /*      * file access macros      */     #define BADMAGIC(x)         ((x).oh_magic!=O_MAGIC)     #define OFF_SECT(x)         SZ_HEAD     #define OFF_EMIT(x)         (OFF_SECT(x) + ((long)(x).oh_nsect * SZ_SECT))     #define OFF_RELO(x)         (OFF_EMIT(x) + (x).oh_nemit)     #define OFF_NAME(x)         (OFF_RELO(x) + ((long)(x).oh_nrelo * SZ_RELO))     #define OFF_CHAR(x)         (OFF_NAME(x) + ((long)(x).oh_nname * SZ_NAME))SEE ALSO     led(6), object(3)5th ACK distribution    $Revision: 1.7 $                        6

⌨️ 快捷键说明

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