Skip to content

Commit

Permalink
Use PIC_ reloc model when link_shared is set in cookie target
Browse files Browse the repository at this point in the history
For using a cpu model based on dlopen we need to set the PIC_ relocation
model when we create the target machine. This is based off the link_shared
cookie option.
  • Loading branch information
coldav committed Mar 5, 2024
1 parent ded1fb1 commit 05db4ab
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ static llvm::TargetMachine *createTargetMachine(const {{cookiecutter.target_name

return llvm_target->createTargetMachine(
target.llvm_triple, target.llvm_cpu, target.llvm_features, options,
llvm::Reloc::Model::Static, llvm::CodeModel::Small,
{{cookiecutter.link_shared}} ? llvm::Reloc::Model::PIC_ : llvm::Reloc::Model::Static,
llvm::CodeModel::Small,
multi_llvm::CodeGenOptLevel::Aggressive);
}

Expand Down

0 comments on commit 05db4ab

Please sign in to comment.