Skip to content

Commit a32392a

Browse files
committed
Update #641, revert change to OS_SymbolLookup()
This restores the original behavior when using OS_SymbolLookup on POSIX, so it doesn't return OS_ERR_NOT_IMPLEMENTED. This is required for transitional purposes. Will submit a separate bug about use platform-dependent logic here.
1 parent c70936e commit a32392a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/os/portable/os-impl-posix-dl-symtab.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,16 @@
6060
* Otherwise, check if the C library provides an "RTLD_DEFAULT" symbol -
6161
* This symbol is not POSIX standard but many implementations do provide it.
6262
*
63-
* Lastly, if nothing no special handle that indicates the global symbol
64-
* table is defined, then OS_GlobalSymbolLookup_Impl() will return
65-
* OS_ERR_NOT_IMPLEMENTED rather than relying on undefined behavior.
63+
* Lastly, if nothing else works, use NULL. This is technically undefined
64+
* behavior per POSIX, but most implementations do seem to interpret this
65+
* as referring to the complete process (base executable + all loaded modules).
6666
*/
67-
#if !defined(OSAL_DLSYM_GLOBAL_HANDLE) && defined(RTLD_DEFAULT)
68-
#define OSAL_DLSYM_GLOBAL_HANDLE RTLD_DEFAULT
67+
#ifndef OSAL_DLSYM_DEFAULT_HANDLE
68+
#ifdef RTLD_DEFAULT
69+
#define OSAL_DLSYM_DEFAULT_HANDLE RTLD_DEFAULT
70+
#else
71+
#define OSAL_DLSYM_DEFAULT_HANDLE NULL
72+
#endif
6973
#endif
7074

7175
/****************************************************************************************
@@ -139,11 +143,7 @@ int32 OS_GlobalSymbolLookup_Impl(cpuaddr *SymbolAddress, const char *SymbolName)
139143
{
140144
int32 status;
141145

142-
#ifdef OSAL_DLSYM_DEFAULT_HANDLE
143146
status = OS_GenericSymbolLookup_Impl(OSAL_DLSYM_DEFAULT_HANDLE, SymbolAddress, SymbolName);
144-
#else
145-
status = OS_ERR_NOT_IMPLEMENTED;
146-
#endif
147147

148148
return status;
149149

0 commit comments

Comments
 (0)