From 3701ea3be70dd420efd93e61758cf0759ca18071 Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Tue, 12 Jul 2022 14:38:46 +0200 Subject: [PATCH] Conflict-proof #[global_allocator] symbols too. The #[global_allocator] used by relibc is only relibc's business. Symbols should therefore not leak if another applications for example wants to override the system allocator (and for bootstrap, which links to relibc but uses its own #[global_allocator] based on libc functions). --- renamesyms.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/renamesyms.sh b/renamesyms.sh index 0b534cf5..a6036064 100755 --- a/renamesyms.sh +++ b/renamesyms.sh @@ -8,11 +8,16 @@ if [ -z "$target" ] || [ -z "$deps_dir" ]; then fi symbols_file=`mktemp` +special_syms="__rg_alloc __rg_dealloc __rg_realloc __rg_alloc_zeroed" for dep in `find $deps_dir -type f -name "*.rlib"`; do 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 + echo "$special_sym __relibc_$special_sym" >> $symbols_file +done + sorted_file=`mktemp` sort -u "$symbols_file" > "$sorted_file" rm -f "$symbols_file" -- GitLab