summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-01-22 16:38:48 -0500
committerBen Gamari <ben@smart-cactus.org>2022-01-22 16:38:48 -0500
commit2df6419913b7f70ffbfa3004cb025520befe20d4 (patch)
treecfaa94aa712edc4a28abd12d1b826a767330a19c
parent3796d8a4b252d693ce09493c045d38dce094805c (diff)
downloadhaskell-wip/T20983.tar.gz
rts: Refuse to create jump islands for symbols with info tableswip/T20983
When tables-next-to-code is enabled we must not relocate references to info-table symbols using jump islands. Fixes #20983.
-rw-r--r--rts/LinkerInternals.h3
-rw-r--r--rts/linker/PEi386.c7
2 files changed, 10 insertions, 0 deletions
diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h
index 7058ad355b..cf78bd5e11 100644
--- a/rts/LinkerInternals.h
+++ b/rts/LinkerInternals.h
@@ -16,6 +16,9 @@
#include <sys/mman.h>
#endif
+/* See Note [Refuse to generate jump islands for _info symbols] */
+void isTntcSymbol(const char *);
+
void printLoadedObjects(void);
#include "BeginPrivate.h"
diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c
index f186da0af8..8eb046a38e 100644
--- a/rts/linker/PEi386.c
+++ b/rts/linker/PEi386.c
@@ -1947,6 +1947,9 @@ ocResolve_PEi386 ( ObjectCode* oc )
// N.B. in the case of the sign-extended relocations we must ensure that v
// fits in a signed 32-bit value. See #15808.
if (((int64_t) v > (int64_t) INT32_MAX) || ((int64_t) v < (int64_t) INT32_MIN)) {
+ if (isTntcSymbol(symbol)) {
+ barf("Unable relocate symbol '%s' with info table as we would need to produce a jump island", symbol);
+ }
copyName (getSymShortName (info, sym), oc,
symbol, sizeof(symbol)-1);
S = makeSymbolExtra_PEi386(oc, symIndex, S, (char *)symbol);
@@ -1965,6 +1968,10 @@ ocResolve_PEi386 ( ObjectCode* oc )
intptr_t v;
v = S + (int32_t)A - ((intptr_t)pP) - 4;
if ((v > (int64_t) INT32_MAX) || (v < (int64_t) INT32_MIN)) {
+ if (isTntcSymbol(symbol)) {
+ barf("Unable relocate symbol '%s' with info table as we would need to produce a jump island", symbol);
+ }
+
/* Make the trampoline then */
copyName (getSymShortName (info, sym),
oc, symbol, sizeof(symbol)-1);