From a9042abdb9533dba04a8e5707d850edcfb83a6ce Mon Sep 17 00:00:00 2001
From: Jeremy Soller <jackpot51@gmail.com>
Date: Thu, 7 Sep 2023 15:42:10 -0600
Subject: [PATCH] Rename both __rg and __rust allocator symbols

---
 renamesyms.sh | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/renamesyms.sh b/renamesyms.sh
index 441404900..8d92176b9 100755
--- a/renamesyms.sh
+++ b/renamesyms.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 target=$1
 deps_dir=$2
 
@@ -8,13 +8,23 @@ if [ -z "$target" ] || [ -z "$deps_dir" ]; then
 fi
 
 symbols_file=`mktemp`
-special_syms="__rg_alloc __rg_dealloc __rg_realloc __rg_alloc_zeroed __rg_oom"
+special_syms=(
+    __rg_alloc
+    __rg_alloc_zeroed
+    __rg_dealloc
+    __rg_oom
+    __rg_realloc
+    __rust_alloc
+    __rust_alloc_zeroed
+    __rust_dealloc
+    __rust_realloc
+)
 
 for dep in `find $deps_dir -type f -name "*.rlib"`; do
     "${TARGET}-nm" --format=posix -g "$dep" 2>/dev/null | sed 's/.*:.*//g' | awk '{if ($2 == "T") print $1}' | sed 's/^\(.*\)$/\1 __relibc_\1/g' >> $symbols_file
 done
 
-for special_sym in $special_syms; do
+for special_sym in "${special_syms[@]}"; do
     echo "$special_sym __relibc_$special_sym" >> $symbols_file
 done
 
-- 
GitLab