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

📄 loadlib.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 3 页
字号:
The <i>ppText</i>, <i>ppData</i>, and <i>ppBss</i> parameters can be difficult tounderstand.  For each one, if the pointer is NULL, the module is notaffected by where the segment gets loaded.  If the pointer is not NULL,then the pointer points to a second pointer, which points to where thesegment should be loaded.  If that second pointer has the value<b>LOAD_NO_ADDRESS</b>, then the module is not affected by where the segment getsloaded, but needs the address of the loaded segment.  In that case, the<b>LOAD_NO_ADDRESS</b> gets replaced with a pointer to where the segment gotloaded (<b>LOAD_NO_ADDRESS</b> is used, rather than NULL, so that a segment maybe loaded at the beginning of memory).<p>When either loading method is used, the corresponding segment is placedfollowing the preceding segment (where the ordering of segments is text,data, bss).  Thus, if <i>ppText</i> is "don't care", <i>ppData</i> indicates an actualaddress.  If <i>ppBss</i> is "don't care", then space will be allocated for text,and bss will be placed following data.  The object module is responsible forensuring that the area indicated by <i>ppData</i> is large enough to containboth data and bss segments.<p>Note that <b><i><a href="./loadlib.html#loadModule">loadModule</a></i>(&nbsp;)</b> is equivalent to this routine if all three of thesegment-address parameters are set to NULL.<p>If addresses are unspecified, the loader tries to allocate a single blockof memory for the whole object.  If there is no contiguous free block largeenough, memory for each segment is allocated separately.<p></blockquote><h4>COMMON</h4><blockquote><p>Some host compiler/linker combinations use another storage class internallycalled "common".  In the C language, uninitialized global variables areeventually put in the bss segment.  However, in partially linked objectmodules they are flagged internally as "common" and the UNIX linkerresolves these and places them in bss as a final step in creating afully linked object module.  However, the target server loader is most oftenused to load partially linked object modules.  When the target server loaderencounters a variable labeled "common", its behavior depends on the following flags :<dl><dt><b>LOAD_COMMON_MATCH_NONE</b><dd>Allocate memory for the variable with <b><i><a href="../../vxworks/ref/memPartLib.html#malloc" >malloc</a></i>(&nbsp;)</b> and enter the variablein the target server symbol table (if specified) at that address. This isthe default.<p><dt><b>LOAD_COMMON_MATCH_USER</b><dd>Search for the symbol in the target server symbol table, excluding thecore-file symbols. If several symbols exist, then the order of matchingis:  (1) bss, (2) data, (3) text. If no symbol is found, act like thedefault.<p><dt><b>LOAD_COMMON_MATCH_ALL</b><dd> Search for the symbol in the target server symbol table, including thecore-file symbols. If several symbols exist, then the order of matching is:  (1) bss, (2) data, (3) text. If no symbol is found, act like the default. </dl><p>Note that most UNIX loaders have an option that forces resolution of thecommon storage while leaving the module relocatable (for example, withtypical BSD UNIX loaders, use options "-rd").<p></blockquote><h4>EXAMPLE</h4><blockquote><p>Load a module into allocated memory; do not return segment addresses:<pre>    module_id = loadModuleAt (fd, LOAD_GLOBAL_SYMBOLS, NULL, NULL, NULL);</pre>Load a module into allocated memory; return segment addresses:<pre>    pText = pData = pBss = LOAD_NO_ADDRESS;    module_id = loadModuleAt (fd, LOAD_GLOBAL_SYMBOLS, &amp;pText, &amp;pData,                              &amp;pBss);</pre>Load a module to off-board memory at a specified address:<pre>    pText = 0x800000;          /* address of text segment          */    pData = pBss = LOAD_NO_ADDRESS  /* other segments follow by default */    module_id = loadModuleAt (fd, LOAD_GLOBAL_SYMBOLS, &amp;pText, &amp;pData,                              &amp;pBss);</pre></blockquote><h4>RETURNS</h4><blockquote><p><p><b>MODULE_ID</b> or NULL if the file cannot be read, there is not enough memory,or the file format is illegal.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./loadlib.html#top">loadlib</a></b>, UNIX manual for object file format,  <i>API Programmer's Guide: Object Module Loader </i><hr><a name="loadModuleAtFromFileName"></a><p align=right><a href="rtnIndex.html"><i>Target Server Internal Routines :  Routines</i></a></p></blockquote><h1><i>loadModuleAtFromFileName</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>loadModuleAtFromFileName</i>(&nbsp;)</strong> - load an object module into memory</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>MODULE_ID loadModuleAtFromFileName    (    char *   filename,       /* Name of the file! */    char *   fileBufferBase, /* Base of file buffer */    int      loadFlag,       /* Control of loader's behavior */    void * * ppText,         /* Load text segment at addr. pointed to by */                             /* Ptr, return load addr. via this ptr */    void * * ppData,         /* Load data segment at addr. pointed to by */                             /* Pointer, return load addr. via this ptr */    void * * ppBss           /* Load BSS segment at addr. pointed to by this */                             /* return load addr. via this ptr */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine reads an object module from a buffer. 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>RETURNS</h4><blockquote><p><p><b>MODULE_ID</b> or NULL if the file cannot be read, there is not enough memory,or the file format is illegal.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./loadlib.html#top">loadlib</a></b>, loadModuleAt<hr><a name="loadBufferFree"></a><p align=right><a href="rtnIndex.html"><i>Target Server Internal Routines :  Routines</i></a></p></blockquote><h1><i>loadBufferFree</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>loadBufferFree</i>(&nbsp;)</strong> - free a buffer previously allocated</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void loadBufferFree    (    void * * ppBuf    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine frees the memory used by a buffer. The buffer pointer is set to NULL.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./loadlib.html#top">loadlib</a></b><hr><a name="loadAlignGet"></a><p align=right><a href="rtnIndex.html"><i>Target Server Internal Routines :  Routines</i></a></p></blockquote><h1><i>loadAlignGet</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>loadAlignGet</i>(&nbsp;)</strong> - determine the required alignment for an address or a size</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>UINT32 loadAlignGet    (    UINT32 alignment,  /* value of alignment */    void * pAddrOrSize /* address or size to check */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine determines, given a proposed address or size, how many bytesmust be added to obtain an address or size correctly aligned for thespecified target.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>The number of bytes to be added to the address or to the size to obtain thecorrect alignment.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./loadlib.html#top">loadlib</a></b>, <i>API Programmer's Guide: Object Module Loader </i><hr><a name="loadSegmentsAllocate"></a><p align=right><a href="rtnIndex.html"><i>Target Server Internal Routines :  Routines</i></a></p></blockquote><h1><i>loadSegmentsAllocate</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>loadSegmentsAllocate</i>(&nbsp;)</strong> - allocate text, data, and bss segments</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS loadSegmentsAllocate    (    SEG_INFO * pSeg /* pointer to segment information */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine allocates memory for the text, data, and bss segments ofa relocatable object module.  Before calling this routine, set up the fieldsof the <b>SEG_INFO</b> structure to specify the location and size of each segment.Only segments with an address of <b>LOAD_NO_ADDRESS</b> and non-NULL size areallocated.<p>If text segment protection is selected, then this routine allocates the textsegment separately on a page boundary.<p>Note that when all three segments have to be allocated and text protection isnot applied, this routine allocates one large block of memory in which eachsegment is installed immediately at the end of its predecessor. Consequently,if the target system has specific alignment requirements, the segment sizesmust be set so that each segment begins on the appropriate boundary.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>OK or ERROR if memory cannot be allocated. (In case of ERROR, all memory is freed.)<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./loadlib.html#top">loadlib</a></b>, <i>Programmer's API Guide: Object Module Loader </i><hr><a name="loadUndefSymAdd"></a><p align=right><a href="rtnIndex.html"><i>Target Server Internal Routines :  Routines</i></a></p></blockquote><h1><i>loadUndefSymAdd</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>loadUndefSymAdd</i>(&nbsp;)</strong> - record an undefined symbol name</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS loadUndefSymAdd    (    MODULE_ID moduleId, /* module id */    char *    symName   /* undefined symbol name */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine stores the name of any undefined symbol in the module beingloaded so that a list of these symbols can be consulted by an external tool,such the shell.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>OK or ERROR if the name cannot be added.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./loadlib.html#top">loadlib</a></b>, <i>API Programmer's Guide: Object Module Loader </i><hr><a name="loadCommonManage"></a><p align=right><a href="rtnIndex.html"><i>Target Server Internal Routines :  Routines</i></a></p></blockquote><h1><i>loadCommonManage</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>loadCommonManage</i>(&nbsp;)</strong> - process a common symbol</p>

⌨️ 快捷键说明

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