Skip to content

Commit

Permalink
[MIPS] Fix CALL16 reloc at 0x290 not against global symbol (#7634)
Browse files Browse the repository at this point in the history
  • Loading branch information
apivovarov authored Mar 11, 2021
1 parent c519863 commit df6fb69
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/target/llvm/codegen_cpu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,14 @@ void CodeGenCPU::CreateComputeScope(const AttrStmtNode* op) {
arg_types.push_back(value->getType());
}
llvm::FunctionType* ftype = llvm::FunctionType::get(t_int_, arg_types, false);
// $xxx_compute_ functions are not global. They should be marked as static (via InternalLinkage)
// to call them correctly on MIPS platform (CALL16 issue)
// Linkage ld Error: CALL16 reloc at 0x290 not against global symbol
llvm::Function* fcompute = llvm::Function::Create(
ftype, llvm::Function::PrivateLinkage,
ftype, llvm::Function::InternalLinkage,
op->value.as<StringImmNode>()->value.operator llvm::StringRef(), module_.get());
BasicBlock* compute_call_end = CheckCallSuccess(builder_->CreateCall(fcompute, arg_values));
// setup compute fuinction.
// setup compute function.
std::unordered_map<const VarNode*, llvm::Value*> new_vmap;
size_t idx = 0;
for (auto it = fcompute->arg_begin(); it != fcompute->arg_end(); ++it, ++idx) {
Expand Down
2 changes: 1 addition & 1 deletion src/tir/transforms/make_packed_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ PrimFunc MakePackedAPI(PrimFunc&& func, int num_unpacked_args) {
//
// For example, for auto broadcasting, checks are required to guarantee that
// either 0 or the original stride will be correctly used. Checks here have
// to use the args that may have no let bining yet. Therefore, hoisting let
// to use the args that may have no let binding yet. Therefore, hoisting let
// binding for args before buffer declaration is needed.
for (const auto& kv : var_def) {
binder.Bind(kv.second, kv.first, kv.first->name_hint, true);
Expand Down

0 comments on commit df6fb69

Please sign in to comment.