From 30022aa7f88e5863f10d4b4e0a3e149e53a0f0cc Mon Sep 17 00:00:00 2001 From: Harrison Chin <2943043+harrychin@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:04:38 -0600 Subject: [PATCH] Make link-wrap.sh Linux/macOS cross-platform Replacing `stat -c %z` with `wc -c < ' lets link-wrap.sh work on both Linux and macOS, whereas the stat command works differently between the two platforms. --- ledger_device_sdk/link_wrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger_device_sdk/link_wrap.sh b/ledger_device_sdk/link_wrap.sh index 31f6cb7e..7decd9e3 100755 --- a/ledger_device_sdk/link_wrap.sh +++ b/ledger_device_sdk/link_wrap.sh @@ -28,7 +28,7 @@ llvm-objcopy --dump-section .rel.nvm_data=$OUT-nvm-reloc $OUT /dev/null || true cat $OUT-rodata-reloc $OUT-nvm-reloc $OUT-data-reloc > $OUT-relocs || true reloc_allocated_size="$((0x$(llvm-nm $OUT | grep _reloc_size | cut -d' ' -f1)))" -reloc_real_size="$(stat -c %s $OUT-relocs)" +reloc_real_size="$(wc -c < "$OUT-relocs")" # Check that our relocations _actually_ fit. if [ "$reloc_real_size" -gt "$reloc_allocated_size" ] then