File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -919,7 +919,8 @@ static void createSyntheticSymbols() {
919919 }
920920
921921 if (ctx.isPic ||
922- config->unresolvedSymbols == UnresolvedPolicy::ImportDynamic) {
922+ config->unresolvedSymbols == UnresolvedPolicy::ImportDynamic ||
923+ !config->isStatic ) {
923924 // For PIC code, or when dynamically importing addresses, we create
924925 // synthetic functions that apply relocations. These get called from
925926 // __wasm_call_ctors before the user-level constructors.
Original file line number Diff line number Diff line change @@ -378,7 +378,7 @@ void InputChunk::generateRelocationCode(raw_ostream &os) const {
378378 uint64_t offset = getVA (rel.Offset ) - getInputSectionOffset ();
379379
380380 Symbol *sym = file->getSymbol (rel);
381- if (!ctx.isPic && sym->isDefined ())
381+ if (!ctx.isPic && sym->isDefined () && !sym-> hasGOTIndex () )
382382 continue ;
383383
384384 LLVM_DEBUG (dbgs () << " gen reloc: type=" << relocTypeToString (rel.Type )
Original file line number Diff line number Diff line change @@ -146,7 +146,8 @@ void scanRelocations(InputChunk *chunk) {
146146
147147 if (ctx.isPic ||
148148 (sym->isUndefined () &&
149- config->unresolvedSymbols == UnresolvedPolicy::ImportDynamic)) {
149+ config->unresolvedSymbols == UnresolvedPolicy::ImportDynamic) ||
150+ sym->isShared ()) {
150151 switch (reloc.Type ) {
151152 case R_WASM_TABLE_INDEX_SLEB:
152153 case R_WASM_TABLE_INDEX_SLEB64:
You can’t perform that action at this time.
0 commit comments