aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Deitcher <avi@deitcher.net>2025-11-25 22:50:36 +0200
committerChristoph Müllner <christophm30@gmail.com>2025-11-26 11:39:01 +0100
commit75b35f86eb07dff233f088c0c77f8a83209da701 (patch)
treefc6b8c85dcc0b8ee891abc747cdb6aba9587a76c
parentadae1d5312148bc0388e4e60976d82fc97a3decc (diff)
downloadriscv-gnu-toolchain-master.zip
riscv-gnu-toolchain-master.tar.gz
riscv-gnu-toolchain-master.tar.bz2
limit strip option to just ELF filesHEAD2025.11.27master
Signed-off-by: Avi Deitcher <avi@deitcher.net>
-rw-r--r--.github/workflows/build-reusable.yaml13
1 files changed, 12 insertions, 1 deletions
diff --git a/.github/workflows/build-reusable.yaml b/.github/workflows/build-reusable.yaml
index 39d3724..cf8b47d 100644
--- a/.github/workflows/build-reusable.yaml
+++ b/.github/workflows/build-reusable.yaml
@@ -221,7 +221,18 @@ jobs:
mv riscv.tar.xz ${{ steps.toolchain-name-generator.outputs.TOOLCHAIN_NAME }}.tar.xz
- name: strip binaries
run: |
- find /mnt/riscv -type f -exec strip {} \;
+ # Strip all ELF binaries in the toolchain
+ # finds all of the files in /mnt/riscv, checks if they are ELF files, and strips them
+ # strip itself would be fine running on any files, it will just complain if they are
+ # not valid binaries. But that would capture the `.a` archives as well,
+ # which we do not want to strip. Doing so would make linking them later problematic.
+ # The logic:
+ # 1. Find all files under /mnt/riscv
+ # 2. For each file, run `file` command to check its type
+ # 3. If the output of `file` contains "ELF", it is an ELF binary
+ # 4. Strip that file
+ # 5. Ignore others
+ find /mnt/riscv -type f -exec sh -c 'file "$1" | grep -q "ELF" && strip "$1"' _ {} \;
- name: tarball build stripped
if: ${{ inputs.strip == 'stripped' || inputs.strip == 'both' }}
run: |