|
| 1 | +diff --git a/rts/Linker.c b/rts/Linker.c |
| 2 | +index 5b3421d..7a6e3b6 100644 |
| 3 | +--- a/rts/Linker.c |
| 4 | ++++ b/rts/Linker.c |
| 5 | +@@ -267,10 +267,12 @@ int ghciInsertSymbolTable( |
| 6 | + HashTable *table, |
| 7 | + const SymbolName* key, |
| 8 | + SymbolAddr* data, |
| 9 | +- HsBool weak, |
| 10 | +- HsBool hidden, |
| 11 | ++ int flags, |
| 12 | + ObjectCode *owner) |
| 13 | + { |
| 14 | ++ HsBool weak = flags & 1; |
| 15 | ++ HsBool hidden = flags & 2; |
| 16 | ++ |
| 17 | + RtsSymbolInfo *pinfo = lookupStrHashTable(table, key); |
| 18 | + if (!pinfo) /* new entry */ |
| 19 | + { |
| 20 | +@@ -352,7 +354,6 @@ int ghciInsertSymbolTable( |
| 21 | + pinfo->hidden = hidden; |
| 22 | + return 1; |
| 23 | + } |
| 24 | +- |
| 25 | + pathchar* archiveName = NULL; |
| 26 | + debugBelch( |
| 27 | + "GHC runtime linker: fatal error: I found a duplicate definition for symbol\n" |
| 28 | +@@ -467,7 +468,7 @@ initLinker_ (int retain_cafs) |
| 29 | + for (sym = rtsSyms; sym->lbl != NULL; sym++) { |
| 30 | + if (! ghciInsertSymbolTable(WSTR("(GHCi built-in symbols)"), |
| 31 | + symhash, sym->lbl, sym->addr, |
| 32 | +- sym->weak, HS_BOOL_FALSE, NULL)) { |
| 33 | ++ sym->weak | (HS_BOOL_FALSE << 1), NULL)) { |
| 34 | + barf("ghciInsertSymbolTable failed"); |
| 35 | + } |
| 36 | + IF_DEBUG(linker, debugBelch("initLinker: inserting rts symbol %s, %p\n", sym->lbl, sym->addr)); |
| 37 | +@@ -479,7 +480,7 @@ initLinker_ (int retain_cafs) |
| 38 | + use an arbitrary (hopefully unique) address here. |
| 39 | + */ |
| 40 | + if (! ghciInsertSymbolTable(WSTR("(GHCi special symbols)"), |
| 41 | +- symhash, "__dso_handle", (void *)0x12345687, HS_BOOL_FALSE, HS_BOOL_FALSE, NULL)) { |
| 42 | ++ symhash, "__dso_handle", (void *)0x12345687, HS_BOOL_FALSE | (HS_BOOL_FALSE << 1), NULL)) { |
| 43 | + barf("ghciInsertSymbolTable failed"); |
| 44 | + } |
| 45 | + |
| 46 | +@@ -487,7 +488,7 @@ initLinker_ (int retain_cafs) |
| 47 | + if (! ghciInsertSymbolTable(WSTR("(GHCi built-in symbols)"), symhash, |
| 48 | + MAYBE_LEADING_UNDERSCORE_STR("newCAF"), |
| 49 | + retain_cafs ? newRetainedCAF : newGCdCAF, |
| 50 | +- HS_BOOL_FALSE, HS_BOOL_FALSE, NULL)) { |
| 51 | ++ HS_BOOL_FALSE | (HS_BOOL_FALSE << 1), NULL)) { |
| 52 | + barf("ghciInsertSymbolTable failed"); |
| 53 | + } |
| 54 | + |
| 55 | +@@ -860,8 +861,8 @@ HsBool removeLibrarySearchPath(HsPtr dll_path_index) |
| 56 | + */ |
| 57 | + HsInt insertSymbol(pathchar* obj_name, SymbolName* key, SymbolAddr* data) |
| 58 | + { |
| 59 | +- return ghciInsertSymbolTable(obj_name, symhash, key, data, HS_BOOL_FALSE, |
| 60 | +- HS_BOOL_FALSE, NULL); |
| 61 | ++ return ghciInsertSymbolTable(obj_name, symhash, key, data, |
| 62 | ++ HS_BOOL_FALSE | (HS_BOOL_FALSE << 1), NULL); |
| 63 | + } |
| 64 | + |
| 65 | + /* ----------------------------------------------------------------------------- |
| 66 | +@@ -1715,8 +1716,8 @@ int ocTryLoad (ObjectCode* oc) { |
| 67 | + if ( symbol.name |
| 68 | + && !ghciInsertSymbolTable(oc->fileName, symhash, symbol.name, |
| 69 | + symbol.addr, |
| 70 | +- isSymbolWeak(oc, symbol.name), |
| 71 | +- HS_BOOL_FALSE, oc)) { |
| 72 | ++ isSymbolWeak(oc, symbol.name) | (HS_BOOL_FALSE << 1), |
| 73 | ++ oc)) { |
| 74 | + return 0; |
| 75 | + } |
| 76 | + } |
| 77 | +diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h |
| 78 | +index 1bc082c..b40d14e 100644 |
| 79 | +--- a/rts/LinkerInternals.h |
| 80 | ++++ b/rts/LinkerInternals.h |
| 81 | +@@ -334,8 +334,7 @@ int ghciInsertSymbolTable( |
| 82 | + HashTable *table, |
| 83 | + const SymbolName* key, |
| 84 | + SymbolAddr* data, |
| 85 | +- HsBool weak, |
| 86 | +- HsBool hidden, |
| 87 | ++ int flags, |
| 88 | + ObjectCode *owner); |
| 89 | + |
| 90 | + /* Lock-free version of lookupSymbol. When 'dependent' is not NULL, adds it as a |
| 91 | +diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c |
| 92 | +index 4a53687..e166e20 100644 |
| 93 | +--- a/rts/linker/Elf.c |
| 94 | ++++ b/rts/linker/Elf.c |
| 95 | +@@ -976,8 +976,8 @@ ocGetNames_ELF ( ObjectCode* oc ) |
| 96 | + setWeakSymbol(oc, nm); |
| 97 | + } |
| 98 | + if (!ghciInsertSymbolTable(oc->fileName, symhash, |
| 99 | +- nm, symbol->addr, isWeak, |
| 100 | +- ELF_ST_VISIBILITY(symbol->elf_sym->st_other) == STV_HIDDEN, |
| 101 | ++ nm, symbol->addr, |
| 102 | ++ isWeak | ((ELF_ST_VISIBILITY(symbol->elf_sym->st_other) == STV_HIDDEN) << 1), |
| 103 | + oc) |
| 104 | + ) { |
| 105 | + goto fail; |
| 106 | +diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c |
| 107 | +index 00b0dce..d633699 100644 |
| 108 | +--- a/rts/linker/MachO.c |
| 109 | ++++ b/rts/linker/MachO.c |
| 110 | +@@ -1336,7 +1336,7 @@ ocGetNames_MachO(ObjectCode* oc) |
| 111 | + , symhash |
| 112 | + , nm |
| 113 | + , addr |
| 114 | +- , HS_BOOL_FALSE |
| 115 | ++ , HS_BOOL_FALSE | (HS_BOOL_FALSE << 1) |
| 116 | + , oc); |
| 117 | + |
| 118 | + oc->symbols[curSymbol].name = nm; |
| 119 | +@@ -1376,7 +1376,7 @@ ocGetNames_MachO(ObjectCode* oc) |
| 120 | + |
| 121 | + IF_DEBUG(linker, debugBelch("ocGetNames_MachO: inserting common symbol: %s\n", nm)); |
| 122 | + ghciInsertSymbolTable(oc->fileName, symhash, nm, |
| 123 | +- (void*)commonCounter, HS_BOOL_FALSE, oc); |
| 124 | ++ (void*)commonCounter, HS_BOOL_FALSE | (HS_BOOL_FALSE << 1), oc); |
| 125 | + oc->symbols[curSymbol].name = nm; |
| 126 | + oc->symbols[curSymbol].addr = oc->info->macho_symbols[i].addr; |
| 127 | + curSymbol++; |
| 128 | +diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c |
| 129 | +index 841faa8..d847d13 100644 |
| 130 | +--- a/rts/linker/PEi386.c |
| 131 | ++++ b/rts/linker/PEi386.c |
| 132 | +@@ -292,7 +292,7 @@ const void* __rts_iob_func = (void*)&__acrt_iob_func; |
| 133 | + void initLinker_PEi386() |
| 134 | + { |
| 135 | + if (!ghciInsertSymbolTable(WSTR("(GHCi/Ld special symbols)"), |
| 136 | +- symhash, "__image_base__", __image_base, HS_BOOL_TRUE, HS_BOOL_FALSE, NULL)) { |
| 137 | ++ symhash, "__image_base__", __image_base, HS_BOOL_TRUE | (HS_BOOL_FALSE << 1), NULL)) { |
| 138 | + barf("ghciInsertSymbolTable failed"); |
| 139 | + } |
| 140 | + |
| 141 | +@@ -1093,7 +1093,7 @@ lookupSymbolInDLLs ( const SymbolName* lbl ) |
| 142 | + /* debugBelch("look in %ls for %s\n", o_dll->name, lbl); */ |
| 143 | + |
| 144 | + if (wcsncmp(o_dll->name,WSTR("ucrtbase.dll"),wcslen(WSTR("ucrtbase.dll"))) == 0) { |
| 145 | +- IF_DEBUG(linker, debugBelch("warning: ignoring %s\n", o_dll->name)); |
| 146 | ++ IF_DEBUG(linker, debugBelch("warning: ignoring %" PATH_FMT "\n", o_dll->name)); |
| 147 | + continue; |
| 148 | + } |
| 149 | + |
| 150 | +@@ -1541,7 +1541,7 @@ ocGetNames_PEi386 ( ObjectCode* oc ) |
| 151 | + sname = strdup (sname); |
| 152 | + addr = strdup (addr); |
| 153 | + if (!ghciInsertSymbolTable(oc->fileName, symhash, sname, |
| 154 | +- addr, false, HS_BOOL_FALSE, oc)) { |
| 155 | ++ addr, HS_BOOL_FALSE | (HS_BOOL_FALSE << 1), oc)) { |
| 156 | + releaseOcInfo (oc); |
| 157 | + stgFree (oc->image); |
| 158 | + oc->image = NULL; |
| 159 | +@@ -1759,8 +1759,8 @@ ocGetNames_PEi386 ( ObjectCode* oc ) |
| 160 | + stgFree(tmp); |
| 161 | + sname = strdup (sname); |
| 162 | + if (!ghciInsertSymbolTable(oc->fileName, symhash, sname, |
| 163 | +- addr, false, |
| 164 | +- section->info->props & IMAGE_SCN_LNK_COMDAT, |
| 165 | ++ addr, |
| 166 | ++ HS_BOOL_FALSE | ((secNumber == IMAGE_SYM_UNDEFINED) << 1), |
| 167 | + oc)) |
| 168 | + return false; |
| 169 | + |
| 170 | +@@ -1779,8 +1779,7 @@ ocGetNames_PEi386 ( ObjectCode* oc ) |
| 171 | + setWeakSymbol(oc, sname); |
| 172 | + } |
| 173 | + if (! ghciInsertSymbolTable(oc->fileName, symhash, sname, addr, |
| 174 | +- isWeak, |
| 175 | +- section->info->props & IMAGE_SCN_LNK_COMDAT, |
| 176 | ++ isWeak | ((secNumber == IMAGE_SYM_UNDEFINED) << 1), |
| 177 | + oc)) |
| 178 | + return false; |
| 179 | + } else { |
0 commit comments