Skip to content

Commit

Permalink
feat: replace zstd-related symbol to avoid duplication (#22)
Browse files Browse the repository at this point in the history
* use upstream as a dependency

* change linux arm64 by objcopy

* update libscroll_zstd_linux_arm64.a

* update libscroll_zstd_darwin_arm64.a

* update libscroll_zstd_darwin_arm64.a

* update encoding/codecv2/libscroll_zstd_darwin_arm64.a

* update .a files

* update

* revert some changes

* revert go.mod and go.sum
  • Loading branch information
colinlyguo authored Aug 2, 2024
1 parent 1b73615 commit e99a0c8
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
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.

0 comments on commit e99a0c8

Please sign in to comment.