diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-02-04 08:44:49 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2022-04-06 16:25:25 -0400 |
commit | d286a55caebca8a4e5e73bbfeeb766e333271a09 (patch) | |
tree | d1c9c1dd3e34e2bd3661aae9719f094015799388 /rts/RtsSymbols.c | |
parent | 42bf7528559fb518092fef3902afb73af5de146e (diff) | |
download | haskell-d286a55caebca8a4e5e73bbfeeb766e333271a09.tar.gz |
rts/linker: Preserve information about symbol types
As noted in #20978, the linker would previously handle overflowed
relocations by creating a jump island. While this is fine in the case of
code symbols, it's very much not okay in the case of data symbols. To
fix this we must keep track of whether each symbol is code or data and
relocate them appropriately. This patch takes the first step in this
direction, adding a symbol type field to the linker's symbol table. It
doesn't yet change relocation behavior to take advantage of this
knowledge.
Fixes #20978.
Diffstat (limited to 'rts/RtsSymbols.c')
-rw-r--r-- | rts/RtsSymbols.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c index 5f97568b62..400e3122bc 100644 --- a/rts/RtsSymbols.c +++ b/rts/RtsSymbols.c @@ -1127,11 +1127,11 @@ RTS_LIBFFI_SYMBOLS #undef SymE_NeedsDataProto #define SymI_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \ - (void*)(&(vvv)), STRENGTH_NORMAL }, + (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_CODE }, #define SymI_HasDataProto(vvv) \ SymI_HasProto(vvv) #define SymE_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \ - (void*)DLL_IMPORT_DATA_REF(vvv), STRENGTH_NORMAL }, + (void*)DLL_IMPORT_DATA_REF(vvv), STRENGTH_NORMAL, SYM_TYPE_CODE }, #define SymE_HasDataProto(vvv) \ SymE_HasProto(vvv) @@ -1144,7 +1144,7 @@ RTS_LIBFFI_SYMBOLS // another symbol. See newCAF/newRetainedCAF/newGCdCAF for an example. #define SymI_HasProto_redirect(vvv,xxx,strength) \ { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \ - (void*)(&(xxx)), strength }, + (void*)(&(xxx)), strength, SYM_TYPE_CODE }, // SymI_HasProto_deprecated allows us to redirect references from their deprecated // names to the undeprecated ones. e.g. access -> _access. @@ -1154,7 +1154,7 @@ RTS_LIBFFI_SYMBOLS // define them, since on Windows these functions shouldn't be in the top level // namespace, but we have them for POSIX compatibility. #define SymI_HasProto_deprecated(vvv) \ - { #vvv, (void*)0xBAADF00D, STRENGTH_WEAK }, + { #vvv, (void*)0xBAADF00D, STRENGTH_WEAK, SYM_TYPE_CODE }, RtsSymbolVal rtsSyms[] = { RTS_SYMBOLS @@ -1174,5 +1174,5 @@ RtsSymbolVal rtsSyms[] = { // lazy pointers as nonlazy. { "dyld_stub_binding_helper", (void*)0xDEADBEEF, STRENGTH_NORMAL }, #endif - { 0, 0, STRENGTH_NORMAL } /* sentinel */ + { 0, 0, STRENGTH_NORMAL, SYM_TYPE_CODE } /* sentinel */ }; |