Skip to content

Commit

Permalink
WebAssembly: remove even more PCRel relocations
Browse files Browse the repository at this point in the history
This removes the PCRel reloc in \01l_type_metadata_table but nowhere else
  • Loading branch information
zhuowei committed May 2, 2019
1 parent a506ca6 commit 7e42e33
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/IRGen/GenDecl.cpp
Expand Up @@ -2814,6 +2814,11 @@ IRGenModule::emitDirectRelativeReference(llvm::Constant *target,
// Convert the target to an integer.
auto targetAddr = llvm::ConstantExpr::getPtrToInt(target, SizeTy);

// WebAssembly hack: WebAssembly doesn't support PC-relative references
if (TargetInfo.OutputObjectFormat == llvm::Triple::Wasm) {
return targetAddr;
}

SmallVector<llvm::Constant*, 4> indices;
indices.push_back(llvm::ConstantInt::get(Int32Ty, 0));
for (unsigned baseIndex : baseIndices) {
Expand Down

0 comments on commit 7e42e33

Please sign in to comment.