David Eichmann pushed to branch wip/davide/windows-dlls_sysm-test_master at Glasgow Haskell Compiler / GHC Commits: abdcb094 by David Eichmann at 2026-10-13T11:32:07+01:00 RtsSymbols records redirect labels The rts-check-symbols test uses redirect labels when available - - - - - 4 changed files: - rts/RtsSymbols.c - rts/include/rts/RtsSymbols.h - testsuite/tests/ghci/linking/T25155_iserv_main.c - testsuite/tests/rts/symbols/dumpDeclaredSymbols.c Changes: ===================================== rts/RtsSymbols.c ===================================== @@ -1220,13 +1220,13 @@ RTS_SYMBOLS_PRIM /* See Note [Naming Scheme for Symbol Macros] */ #define SymI_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \ - (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_CODE }, + (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_CODE, NULL }, #define SymI_HasDataProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \ - (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_DATA }, + (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_DATA, NULL }, #define SymE_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \ - (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_CODE }, + (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_CODE, NULL }, #define SymE_HasDataProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \ - (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_DATA }, + (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_DATA, NULL }, #define SymI_NeedsProto(vvv) SymI_HasProto(vvv) #define SymI_NeedsDataProto(vvv) SymI_HasDataProto(vvv) @@ -1237,7 +1237,7 @@ RTS_SYMBOLS_PRIM // another symbol. See newCAF/newRetainedCAF/newGCdCAF for an example. #define SymI_HasProto_redirect(vvv,xxx,strength,ty) \ { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \ - (void*)(&(xxx)), strength, ty }, + (void*)(&(xxx)), strength, ty, MAYBE_LEADING_UNDERSCORE_STR(#xxx) }, static RtsSymbolVal * rtsSyms = NULL; @@ -1264,7 +1264,7 @@ RtsSymbolVal const * getRtsSymbols(void) { RTS_ARM_OUTLINE_ATOMIC_SYMBOLS RTS_SYMBOLS_PRIM SymI_HasDataProto(nonmoving_write_barrier_enabled) - { 0, 0, STRENGTH_NORMAL, SYM_TYPE_CODE } /* sentinel */ + { 0, 0, STRENGTH_NORMAL, SYM_TYPE_CODE, NULL } /* sentinel */ }; uint32_t n = 1; @@ -1362,7 +1362,7 @@ RtsSymbolVal const * getRtsSymbols(void) { // CODE_SYM(getauxval) // CODE_SYM(posix_spawn_file_actions_init) // ... -// { 0, 0, STRENGTH_NORMAL, SYM_TYPE_CODE } /* sentinel */ +// { 0, 0, STRENGTH_NORMAL, SYM_TYPE_CODE, NULL } /* sentinel */ // }; // // RtsSymbolVal* rtsExtraSyms() { @@ -1375,7 +1375,7 @@ RtsSymbolVal const * getRtsSymbols(void) { // static RtsSymbolVal default_extra_syms[] = { - { 0, 0, STRENGTH_NORMAL, SYM_TYPE_CODE } /* sentinel */ + { 0, 0, STRENGTH_NORMAL, SYM_TYPE_CODE, NULL } /* sentinel */ }; /* Default empty extra RTS symbols. See Note[Extra RTS symbols] */ ===================================== rts/include/rts/RtsSymbols.h ===================================== @@ -8,6 +8,7 @@ #pragma once +#include <stdbool.h> typedef void SymbolAddr; typedef char SymbolName; @@ -36,6 +37,9 @@ typedef struct _RtsSymbolVal { SymbolAddr* addr; SymStrength strength; SymType type; + // If this is a redirection, then this is the lable of the + // target symbol. Otherwise NULL. + const SymbolName* lbl_redirect_target; } RtsSymbolVal; RtsSymbolVal const * getRtsSymbols(void); ===================================== testsuite/tests/ghci/linking/T25155_iserv_main.c ===================================== @@ -23,7 +23,7 @@ int main (int argc, char *argv[]) // can use the FFI call to foobar in a TH splice. #define SymI_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \ - (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_CODE }, + (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_CODE, NULL }, void foobar(int x) { ===================================== testsuite/tests/rts/symbols/dumpDeclaredSymbols.c ===================================== @@ -19,8 +19,16 @@ void dumpDeclaredSymbols(void) { type = "data"; } + const char * lbl = NULL; + if (sym->lbl_redirect_target) { + // In the case of redirects, the true symbol name is lbl_redirect_target + lbl = sym->lbl_redirect_target; + } else { + lbl = sym->lbl; + } + if (type) { - printf("%s %s\n", sym->lbl, type); + printf("%s %s\n", lbl, type); } } } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/abdcb094eddd82e62ca62ce6f7d99f21... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/abdcb094eddd82e62ca62ce6f7d99f21... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
David Eichmann (@DavidEichmann)