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

📄 loadlib.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<html><head><!-- /vobs/wpwr/docs/tornado-api/tgtint/loadlib.html - generated by refgen from loadlib.c --> <title> loadlib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.html"><i>Tornado API Reference :  Target Server Internal Routines</i></a></p></blockquote><h1>loadlib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>loadlib</strong> - host-based object-module loader </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./loadlib.html#loadModule">loadModule</a></i>(&nbsp;)</b>  -  load an object module into memory<br><b><i><a href="./loadlib.html#loadModuleAt">loadModuleAt</a></i>(&nbsp;)</b>  -  load an object module into memory<br><b><i><a href="./loadlib.html#loadModuleAtFromFileName">loadModuleAtFromFileName</a></i>(&nbsp;)</b>  -  load an object module into memory<br><b><i><a href="./loadlib.html#loadBufferFree">loadBufferFree</a></i>(&nbsp;)</b>  -  free a buffer previously allocated<br><b><i><a href="./loadlib.html#loadAlignGet">loadAlignGet</a></i>(&nbsp;)</b>  -  determine the required alignment for an address or a size<br><b><i><a href="./loadlib.html#loadSegmentsAllocate">loadSegmentsAllocate</a></i>(&nbsp;)</b>  -  allocate text, data, and bss segments<br><b><i><a href="./loadlib.html#loadUndefSymAdd">loadUndefSymAdd</a></i>(&nbsp;)</b>  -  record an undefined symbol name<br><b><i><a href="./loadlib.html#loadCommonManage">loadCommonManage</a></i>(&nbsp;)</b>  -  process a common symbol<br><b><i><a href="./loadlib.html#loadCoreFileCheck">loadCoreFileCheck</a></i>(&nbsp;)</b>  -  check whether the core file is up to date<br><b><i><a href="./loadlib.html#loadCoreBuilderSet">loadCoreBuilderSet</a></i>(&nbsp;)</b>  -  record information about the tool chain<br><b><i><a href="./loadlib.html#loadCoreBuilderGet">loadCoreBuilderGet</a></i>(&nbsp;)</b>  -  publish information about the tool chain<br><b><i><a href="./loadlib.html#loadFlagsCheck">loadFlagsCheck</a></i>(&nbsp;)</b>  -  check for illegal combinations of flags<br><b><i><a href="./loadlib.html#loadOutputToFile">loadOutputToFile</a></i>(&nbsp;)</b>  -  write a module's segments in a file<br><b><i><a href="./loadlib.html#loadRelocLink">loadRelocLink</a></i>(&nbsp;)</b>  -  Link the relocator Shared library to the OMF specific loader.<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides a generic object module loading facility.  Anysupported format files may be loaded into memory and relocated properly, theirexternal references resolved, and their external definitions added tothe target symbol table for use by other modules and from the shell.Modules may be loaded from any I/O stream.<p></blockquote><h4>EXAMPLE</h4><blockquote><p>The following code fragment loads the object file <i>objFile</i> into memoryallocated from the target memory pool.  All external and staticdefinitions from the file are added to the target symbol table.<p><pre>    fd = open ("objFile", O_RDONLY);    loadModule (fd, LOAD_ALL_SYMBOLS);    close (fd);</pre></blockquote><h4>INCLUDE FILE</h4><blockquote><p><b>loadlib.h</b><p></blockquote><h4>STRUCTURE OF THE TARGET SERVER LOADER</h4><blockquote><p><p><pre>  File access-------------------Generic level------------Module management                        |  |                |                        |  `----------+-----`Virtual memory                              |             |management-+------------------------------+.|.............|.....       |                              | |             |    :       |  ,---------------------------|-|-+------------------+- Symbol       |  |                           | | |           |    : :  table       |  |  ,--------------------------+.|...........|....:.:...       |  |  |                        | | |           |    : :  :      A.OUT OMF--,                   COFF OMF---------+...Other OMF      management |                  management        |   management          |      |                      |             |          |      `----------------------|-------------+----------,          |                             |                        |   ,----------+..........         ,---------+..........          |   |          |         :         |         |         :          |68K/x86    SPARC     Other      i960      29K      Other         |specific   specific  specific  specific  specific  specific      |   |          |         :         |         |         :          |   `----------+---------+---------+---------+---------+---------- Memory                management</pre>Note the three-layer structure:<dl><dt>1.<dd>the generic level (<b>loadlib.c</b>)<p><dt>2.<dd>the object module format level (<b>loadaout.c</b>, <b>loadcoff.c</b>)<p><dt>3.<dd>the architecture-specific level (<b>aout68k.c</b>, <b>aoutspar.c</b>, <b>coffi960.c</b>,<b>coffa29k.c</b>) </dl><p>Dotted lines indicate functionality that does not yet exist.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./loadlib.html#top">loadlib</a></b>, symlib, tgtmem,  .I" API Programmer's Guide: Object Module Loader"<hr><a name="loadModule"></a><p align=right><a href="rtnIndex.html"><i>Target Server Internal Routines :  Routines</i></a></p></blockquote><h1><i>loadModule</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>loadModule</i>(&nbsp;)</strong> - load an object module into memory</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>MODULE_ID loadModule    (    int fd,      /* fd of file to load */    int loadFlag /* control of loader's behavior */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine loads an object module from the specified file and placesthe text, data, and bss segments into memory allocated from thetarget memory pool.<p>This routine is equivalent to <b><i><a href="./loadlib.html#loadModuleAt">loadModuleAt</a></i>(&nbsp;)</b> with NULL for the addresses oftext, data, and bss segments.  For more details, see the reference entry for<b><i><a href="./loadlib.html#loadModuleAt">loadModuleAt</a></i>(&nbsp;)</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p><p><b>MODULE_ID</b> or NULL if the file cannot be read, there is notenough memory, or the file format is illegal.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./loadlib.html#top">loadlib</a></b>, <b><i><a href="./loadlib.html#loadModuleAt">loadModuleAt</a></i>(&nbsp;)</b>,  <i>API Programmer's Guide: Object Module Loader </i><hr><a name="loadModuleAt"></a><p align=right><a href="rtnIndex.html"><i>Target Server Internal Routines :  Routines</i></a></p></blockquote><h1><i>loadModuleAt</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>loadModuleAt</i>(&nbsp;)</strong> - load an object module into memory</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>MODULE_ID loadModuleAt    (    int                                                                                                                                                                                                                                                                                                                                                                          fd, /* fd */                                                                                                                                                                                                                                                                                                                                                                                     /* from */                                                                                                                                                                                                                                                                                                                                                                                     /* which */                                                                                                                                                                                                                                                                                                                                                                                     /* to */                                                                                                                                                                                                                                                                                                                                                                                     /* read */                                                                                                                                                                                                                                                                                                                                                                                     /* module */    int loadFlag,/* control of loader's behavior */ void * * ppText, /* load text segment at addr. pointed to by this ptr, return load addr. via this ptr */ void * * ppData, /* load data segment at addr. pointed to by this pointer, return load addr. via this ptr */ void * * ppBss /* load BSS segment at addr. pointed to by this pointer, return load addr. via this ptr */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine reads an object module from <i>fd</i>.  All the sections arecoalesced in segments and loaded at the specified load addresses in memoryset aside by the user using <b><i><a href="../../vxworks/ref/memPartLib.html#malloc" >malloc</a></i>(&nbsp;)</b> or in the target memory partition asdescribed below.  A "segment" is defined here as the assembling of severalsections of the same type.  <b><i><a href="./loadlib.html#loadModuleAt">loadModuleAt</a></i>(&nbsp;)</b> follows a three segment model:text, data and bss.  Any literal section is merged in the text segment.The module is properly relocated according to the relocation commands in thefile.  Unresolved externals are linked to symbols found in the target serversymbol table.  Symbols in the module being loaded can optionally be added tothe target server symbol table.<p></blockquote><h4>LINKING UNRESOLVED EXTERNALS</h4><blockquote><p>As the module is loaded, any unresolved external references are resolvedby looking up the missing symbols in the the target server symbol table.If found, those unresolved references are correctly linked to the new module.If unresolved external references cannot be found in the target server symboltable, then the symbol name is added to a list that is returned to thetool that asked for the loading procedure (the shell for instance), butthe loading/linking continues.  Note that loading is continued tofacilitate debugging.  Only code that does not contain undefined symbols canactually be executed.<p></blockquote><h4>ADDING SYMBOLS TO THE SYMBOL TABLE</h4><blockquote><p>The symbols defined in the module being loaded may optionally be addedto the target server symbol table, depending on the value of <i>loadFlag</i>:<dl><dt><b>LOAD_NO_SYMBOLS</b><dd>Add no symbols to the target server symbol table.<p><dt><b>LOAD_GLOBAL_SYMBOLS</b><dd>Add only external symbols to the target server symbol table.<p><dt><b>LOAD_ALL_SYMBOLS</b><dd> Add all symbols to the target server symbol table. </dl><p>The basic value above can be or'ed with each of the following:<dl><dt><b>LOAD_FULLY_LINKED</b><dd>Resolve all addresses in the file; no relocation is required. Download thesegments at the addresses specified in the header of the file.<p><dt><b>LOAD_CORE_FILE</b><dd>Build the target server symbol table from the symbols in the core file.Download nothing to the target.  (This flag should be used only whenthe initial connection with the target agent is made.)<p><dt><b>LOAD_HIDDEN_MODULE</b><dd> Load an invisible module (see <b><i><a href="../../tornado/tools/windsh.html#moduleShow" >moduleShow</a></i>(&nbsp;)</b>). </dl><p></blockquote><h4>RELOCATION</h4><blockquote><p>The relocation commands in the object module are used to relocatethe text, data, and bss segments of the module.  The location of eachsegment can be specified explicitly or left unspecified, in whichcase memory is allocated for the segment from the target memorypartition.  This is determined by the parameters <i>ppText</i>, <i>ppData</i>, and<i>ppBss</i>, each of which can have the following values:<dl><dt>NULL<dd>No load address is specified, none will be returned.<p><dt><b>LOAD_NO_ADDRESS</b><dd>No load address is specified; the return address is referenced by thepointer.<p><dt>A pointer to an address<dd> The load address is specified. </dl><p>

⌨️ 快捷键说明

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