forked from OSchip/llvm-project
[WebAssmebly] Fix references to weak aliases
Corresponding LLVM change: https://reviews.llvm.org/D41472 Differential Revision: https://reviews.llvm.org/D41473 llvm-svn: 321244
This commit is contained in:
parent
747d1114d6
commit
1cf31bbca5
|
@ -79,7 +79,7 @@ entry:
|
|||
; CHECK-NEXT: - Offset:
|
||||
; CHECK-NEXT: Opcode: I32_CONST
|
||||
; CHECK-NEXT: Value: 1
|
||||
; CHECK-NEXT: Functions: [ 0 ]
|
||||
; CHECK-NEXT: Functions: [ 2 ]
|
||||
; CHECK-NEXT: - Type: CODE
|
||||
; CHECK-NEXT: Functions:
|
||||
; CHECK-NEXT: - Locals:
|
||||
|
@ -89,7 +89,7 @@ entry:
|
|||
; CHECK-NEXT: - Locals:
|
||||
; CHECK-NEXT: Body: 41000B
|
||||
; CHECK-NEXT: - Locals:
|
||||
; CHECK-NEXT: Body: 1080808080000B
|
||||
; CHECK-NEXT: Body: 1082808080000B
|
||||
; CHECK-NEXT: - Locals:
|
||||
; CHECK-NEXT: Body: 1080808080000B
|
||||
; CHECK-NEXT: - Locals:
|
||||
|
@ -97,7 +97,7 @@ entry:
|
|||
; CHECK-NEXT: - Locals:
|
||||
; CHECK-NEXT: - Type: I32
|
||||
; CHECK-NEXT: Count: 2
|
||||
; CHECK-NEXT: Body: 23808080800041106B220024808080800020004181808080003602081080808080002101200041106A24808080800020010B
|
||||
; CHECK-NEXT: Body: 23808080800041106B220024808080800020004181808080003602081082808080002101200041106A24808080800020010B
|
||||
; CHECK-NEXT: - Type: CUSTOM
|
||||
; CHECK-NEXT: Name: linking
|
||||
; CHECK-NEXT: DataSize: 0
|
||||
|
|
|
@ -198,13 +198,22 @@ void ObjFile::initializeSymbols() {
|
|||
DEBUG(dbgs() << "Function: " << WasmSym.ElementIndex << " -> "
|
||||
<< toString(*S) << "\n");
|
||||
FunctionSymbols[WasmSym.ElementIndex] = S;
|
||||
if (WasmSym.HasAltIndex)
|
||||
FunctionSymbols[WasmSym.AltIndex] = S;
|
||||
} else {
|
||||
DEBUG(dbgs() << "Global: " << WasmSym.ElementIndex << " -> "
|
||||
<< toString(*S) << "\n");
|
||||
GlobalSymbols[WasmSym.ElementIndex] = S;
|
||||
if (WasmSym.HasAltIndex)
|
||||
GlobalSymbols[WasmSym.AltIndex] = S;
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG(for (size_t I = 0; I < FunctionSymbols.size(); ++I)
|
||||
assert(FunctionSymbols[I] != nullptr);
|
||||
for (size_t I = 0; I < GlobalSymbols.size(); ++I)
|
||||
assert(GlobalSymbols[I] != nullptr););
|
||||
|
||||
// Populate `TableSymbols` with all symbols that are called indirectly
|
||||
uint32_t SegmentCount = WasmObj->elements().size();
|
||||
if (SegmentCount) {
|
||||
|
|
|
@ -83,15 +83,7 @@ static const WasmSignature *getFunctionSig(const ObjFile &Obj,
|
|||
const WasmSymbol &Sym) {
|
||||
DEBUG(dbgs() << "getFunctionSig: " << Sym.Name << "\n");
|
||||
const WasmObjectFile *WasmObj = Obj.getWasmObj();
|
||||
uint32_t FunctionType;
|
||||
if (Obj.isImportedFunction(Sym.ElementIndex)) {
|
||||
const WasmImport &Import = WasmObj->imports()[Sym.ImportIndex];
|
||||
FunctionType = Import.SigIndex;
|
||||
} else {
|
||||
uint32_t FunctionIndex = Sym.ElementIndex - Obj.NumFunctionImports();
|
||||
FunctionType = WasmObj->functionTypes()[FunctionIndex];
|
||||
}
|
||||
return &WasmObj->types()[FunctionType];
|
||||
return &WasmObj->types()[Sym.FunctionType];
|
||||
}
|
||||
|
||||
// Check the type of new symbol matches that of the symbol is replacing.
|
||||
|
|
Loading…
Reference in New Issue