[artiq] Set private linkage for constants #499

Merged
sb10q merged 1 commits from fix/issue-498 into master 2024-08-19 14:41:43 +08:00
1 changed files with 4 additions and 2 deletions
Showing only changes of commit c62e944555 - Show all commits

View File

@ -1,4 +1,6 @@
use crate::PrimitivePythonId;
use inkwell::{
module::Linkage,
types::{BasicType, BasicTypeEnum},
values::BasicValueEnum,
AddressSpace,
@ -34,8 +36,6 @@ use std::{
},
};
use crate::PrimitivePythonId;
pub enum PrimitiveValue {
I32(i32),
I64(i64),
@ -133,6 +133,8 @@ impl StaticValue for PythonValue {
format!("{}_const", self.id).as_str(),
);
global.set_constant(true);
// Set linkage of global to private to avoid name collisions
global.set_linkage(Linkage::Private);
global.set_initializer(&ctx.ctx.const_struct(
&[ctx.ctx.i32_type().const_int(u64::from(id), false).into()],
false,