From ab6bc4697532862a9cec3483ce1e24e268ea3a8f Mon Sep 17 00:00:00 2001
From: renoseven <dev@renoseven.net>
Date: Fri, 6 Sep 2024 22:14:11 +0800
Subject: [PATCH] upatch-helper: fix object upatch id duplicated issue

Signed-off-by: renoseven <dev@renoseven.net>
---
 upatch-helper/Cargo.toml  | 2 +-
 upatch-helper/src/main.rs | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/upatch-helper/Cargo.toml b/upatch-helper/Cargo.toml
index 42f3548..b131b66 100644
--- a/upatch-helper/Cargo.toml
+++ b/upatch-helper/Cargo.toml
@@ -9,5 +9,5 @@ rust-version = "1.60"
 build        = "build.rs"
 
 [dependencies]
-syscare-common = { package = "syscare-common", path = "../syscare-common" }
 anyhow         = { version = "1.0" }
+uuid           = { version = "0.8", features = ["v4"] }
diff --git a/upatch-helper/src/main.rs b/upatch-helper/src/main.rs
index d98b167..303088c 100644
--- a/upatch-helper/src/main.rs
+++ b/upatch-helper/src/main.rs
@@ -15,7 +15,7 @@
 use std::{os::unix::process::CommandExt, path::Path, process::Command};
 
 use anyhow::{bail, Context};
-use syscare_common::os;
+use uuid::Uuid;
 
 const UPATCH_CC_ENV: &str = "UPATCH_HELPER_CC";
 const UPATCH_CXX_ENV: &str = "UPATCH_HELPER_CXX";
@@ -50,9 +50,9 @@ fn main() -> anyhow::Result<()> {
     if exec_args.iter().any(|arg| arg == OUTPUT_FLAG) {
         command.args(APPEND_ARGS);
         command.arg(format!(
-            "-Wa,--defsym,{}0x{:04x}=0",
+            "-Wa,--defsym,{}{}=0",
             UPATCH_ID_PREFIX,
-            os::process::id()
+            Uuid::new_v4(),
         ));
     }
 
-- 
2.34.1

