|
34 | 34 | ** Defines |
35 | 35 | */ |
36 | 36 |
|
| 37 | +/** |
| 38 | + * @brief Requests OS_ModuleLoad() to add the symbols to the global symbol table |
| 39 | + * |
| 40 | + * When supplied as the "flags" argument to OS_ModuleLoad(), this indicates |
| 41 | + * that the symbols in the loaded module should be added to the global symbol |
| 42 | + * table. This will make symbols in this library available for use when |
| 43 | + * resolving symbols in future module loads. |
| 44 | + * |
| 45 | + * This is the default mode of operation for OS_ModuleLoad(). |
| 46 | + * |
| 47 | + * @note On some operating systems, use of this option may make it difficult |
| 48 | + * to unload the module in the future, if the symbols are in use by other entities. |
| 49 | + * |
| 50 | + */ |
| 51 | +#define OS_MODULE_FLAG_GLOBAL_SYMBOLS 0x00 |
| 52 | + |
| 53 | +/** |
| 54 | + * @brief Requests OS_ModuleLoad() to keep the symbols local/private to this module |
| 55 | + * |
| 56 | + * When supplied as the "flags" argument to OS_ModuleLoad(), this indicates |
| 57 | + * that the symbols in the loaded module should NOT be added to the global |
| 58 | + * symbol table. This means the symbols in the loaded library will not available |
| 59 | + * to for use by other modules. |
| 60 | + * |
| 61 | + * Use this option is recommended for cases where no other entities will need |
| 62 | + * to reference symbols within this module. This helps ensure that the module |
| 63 | + * can be more safely unloaded in the future, by preventing other modules from |
| 64 | + * binding to it. It also helps reduce the likelihood of symbol name conflicts |
| 65 | + * among modules. |
| 66 | + * |
| 67 | + * @note To look up symbols within a module loaded with this flag, use |
| 68 | + * OS_SymbolLookupInModule() instead of OS_SymbolLookup(). Also note that |
| 69 | + * references obtained using this method are not tracked by the OS; the |
| 70 | + * application must ensure that all references obtained in this manner have |
| 71 | + * been cleaned up/released before unloading the module. |
| 72 | + */ |
| 73 | +#define OS_MODULE_FLAG_LOCAL_SYMBOLS 0x01 |
| 74 | + |
37 | 75 | /* |
38 | 76 | ** Typedefs |
39 | 77 | */ |
@@ -105,6 +143,25 @@ typedef const struct |
105 | 143 | */ |
106 | 144 | int32 OS_SymbolLookup(cpuaddr *symbol_address, const char *symbol_name); |
107 | 145 |
|
| 146 | +/*-------------------------------------------------------------------------------------*/ |
| 147 | +/** |
| 148 | + * @brief Find the Address of a Symbol within a module |
| 149 | + * |
| 150 | + * This is similar to OS_SymbolLookup() but for a specific module ID. |
| 151 | + * This should be used to look up a symbol in a module that has been |
| 152 | + * loaded with the #OS_MODULE_FLAG_LOCAL_SYMBOLS flag. |
| 153 | + * |
| 154 | + * @param[in] module_id Module ID that should contain the symbol |
| 155 | + * @param[out] symbol_address Set to the address of the symbol |
| 156 | + * @param[in] symbol_name Name of the symbol to look up |
| 157 | + * |
| 158 | + * @return Execution status, see @ref OSReturnCodes |
| 159 | + * @retval #OS_SUCCESS @copybrief OS_SUCCESS |
| 160 | + * @retval #OS_ERROR if the symbol could not be found |
| 161 | + * @retval #OS_INVALID_POINTER if one of the pointers passed in are NULL |
| 162 | + */ |
| 163 | +int32 OS_ModuleSymbolLookup(osal_id_t module_id, cpuaddr *SymbolAddress, const char *SymbolName); |
| 164 | + |
108 | 165 | /*-------------------------------------------------------------------------------------*/ |
109 | 166 | /** |
110 | 167 | * @brief Dumps the system symbol table to a file |
@@ -138,7 +195,7 @@ int32 OS_SymbolTableDump(const char *filename, uint32 size_limit); |
138 | 195 | * @retval #OS_ERR_NO_FREE_IDS if the module table is full |
139 | 196 | * @retval #OS_ERR_NAME_TAKEN if the name is in use |
140 | 197 | */ |
141 | | -int32 OS_ModuleLoad(osal_id_t *module_id, const char *module_name, const char *filename); |
| 198 | +int32 OS_ModuleLoad(osal_id_t *module_id, const char *module_name, const char *filename, uint32 flags); |
142 | 199 |
|
143 | 200 | /*-------------------------------------------------------------------------------------*/ |
144 | 201 | /** |
|
0 commit comments