From c62e944555697219e2e454ed33876285b0d1de30 Mon Sep 17 00:00:00 2001 From: David Mak Date: Mon, 19 Aug 2024 14:17:31 +0800 Subject: [PATCH] [artiq] symbol_resolver: Set private linkage for constants --- nac3artiq/src/symbol_resolver.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nac3artiq/src/symbol_resolver.rs b/nac3artiq/src/symbol_resolver.rs index d38c460d..9470ee71 100644 --- a/nac3artiq/src/symbol_resolver.rs +++ b/nac3artiq/src/symbol_resolver.rs @@ -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, -- 2.44.2