Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace zstd-related symbol to avoid duplication #22

Merged
merged 11 commits into from
Aug 2, 2024
29 changes: 29 additions & 0 deletions encoding/codecv2/add_scroll_prefix_in_zstd_related_symbols.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generate redefine.syms for linux_amd64
/opt/homebrew/opt/llvm/bin/llvm-nm libscroll_zstd_linux_amd64.a | awk '/ZSTD|HUF|FSE|ZBUFF/ {if ($3 != "") print $3 " scroll_" $3}' | sort | uniq > redefine_linux_amd64.syms

# Use llvm-objcopy to modify symbols for linux_amd64
llvm-objcopy --redefine-syms=redefine_linux_amd64.syms libscroll_zstd_linux_amd64.a libscroll_zstd_linux_amd64_new.a

# Move the new file to replace the original and clean up
mv libscroll_zstd_linux_amd64_new.a libscroll_zstd_linux_amd64.a
rm redefine_linux_amd64.syms

# Generate redefine.syms for linux_arm64
/opt/homebrew/opt/llvm/bin/llvm-nm libscroll_zstd_linux_arm64.a | awk '/ZSTD|HUF|FSE|ZBUFF/ {if ($3 != "") print $3 " scroll_" $3}' | sort | uniq > redefine_linux_arm64.syms

# Use llvm-objcopy to modify symbols for linux_arm64
llvm-objcopy --redefine-syms=redefine_linux_arm64.syms libscroll_zstd_linux_arm64.a libscroll_zstd_linux_arm64_new.a

# Move the new file to replace the original and clean up
mv libscroll_zstd_linux_arm64_new.a libscroll_zstd_linux_arm64.a
rm redefine_linux_arm64.syms

# Generate redefine.syms for darwin_arm64
/opt/homebrew/opt/llvm/bin/llvm-nm libscroll_zstd_darwin_arm64.a | awk '/ZSTD|HUF|FSE|ZBUFF/ {if ($3 != "") print $3 " scroll_" $3}' | sort | uniq > redefine_darwin_arm64.syms

# Use llvm-objcopy to modify symbols for darwin_arm64
llvm-objcopy --redefine-syms=redefine_darwin_arm64.syms libscroll_zstd_darwin_arm64.a libscroll_zstd_darwin_arm64_new.a

# Move the new file to replace the original and clean up
mv libscroll_zstd_darwin_arm64_new.a libscroll_zstd_darwin_arm64.a
rm redefine_darwin_arm64.syms
Binary file modified encoding/codecv2/libscroll_zstd_darwin_arm64.a
Binary file not shown.
Binary file modified encoding/codecv2/libscroll_zstd_linux_amd64.a
Binary file not shown.
Binary file modified encoding/codecv2/libscroll_zstd_linux_arm64.a
Binary file not shown.
Loading