mirror of
https://github.com/zama-ai/concrete.git
synced 2026-04-17 03:00:54 -04:00
fix: prefix compiled function name to avoid collision w other func
the new wrapper function will make a call to the main compiled function, and we got some problem in the GOT/PLT due to function of the same name. So now we prefiex with `concrete_` to avoid that.
This commit is contained in:
@@ -16,6 +16,9 @@
|
||||
|
||||
namespace concretelang {
|
||||
|
||||
/// prefix function name with `concrete_` to avoid collision with other function
|
||||
std::string prefixFuncName(llvm::StringRef funcName);
|
||||
|
||||
// construct the function name of the wrapper function that unify function calls
|
||||
// of compiled circuit
|
||||
std::string makePackedFunctionName(llvm::StringRef name);
|
||||
|
||||
@@ -27,7 +27,8 @@ using mlir::concretelang::StreamStringError;
|
||||
outcome::checked<ServerLambda, StringError>
|
||||
ServerLambda::loadFromModule(std::shared_ptr<DynamicModule> module,
|
||||
std::string funcName) {
|
||||
auto packedFuncName = ::concretelang::makePackedFunctionName(funcName);
|
||||
auto packedFuncName = ::concretelang::makePackedFunctionName(
|
||||
::concretelang::prefixFuncName(funcName));
|
||||
ServerLambda lambda;
|
||||
lambda.module =
|
||||
module; // prevent module and library handler from being destroyed
|
||||
|
||||
@@ -74,6 +74,9 @@ static void packFunctionArguments(llvm::Module *module) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// prefix to avoid colliding with other functions
|
||||
func.setName(::concretelang::prefixFuncName(func.getName()));
|
||||
|
||||
// Given a function `foo(<...>)`, define the interface function
|
||||
// `mlir_foo(i8**)`.
|
||||
auto *newType = llvm::FunctionType::get(
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
|
||||
namespace concretelang {
|
||||
|
||||
std::string prefixFuncName(llvm::StringRef funcName) {
|
||||
return "concrete_" + funcName.str();
|
||||
}
|
||||
|
||||
std::string makePackedFunctionName(llvm::StringRef name) {
|
||||
return "_mlir_" + name.str();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user