Skip to content

Commit 75b35f8

Browse files
deitchcmuellner
authored andcommitted
limit strip option to just ELF files
Signed-off-by: Avi Deitcher <[email protected]>
1 parent adae1d5 commit 75b35f8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/workflows/build-reusable.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,18 @@ jobs:
221221
mv riscv.tar.xz ${{ steps.toolchain-name-generator.outputs.TOOLCHAIN_NAME }}.tar.xz
222222
- name: strip binaries
223223
run: |
224-
find /mnt/riscv -type f -exec strip {} \;
224+
# Strip all ELF binaries in the toolchain
225+
# finds all of the files in /mnt/riscv, checks if they are ELF files, and strips them
226+
# strip itself would be fine running on any files, it will just complain if they are
227+
# not valid binaries. But that would capture the `.a` archives as well,
228+
# which we do not want to strip. Doing so would make linking them later problematic.
229+
# The logic:
230+
# 1. Find all files under /mnt/riscv
231+
# 2. For each file, run `file` command to check its type
232+
# 3. If the output of `file` contains "ELF", it is an ELF binary
233+
# 4. Strip that file
234+
# 5. Ignore others
235+
find /mnt/riscv -type f -exec sh -c 'file "$1" | grep -q "ELF" && strip "$1"' _ {} \;
225236
- name: tarball build stripped
226237
if: ${{ inputs.strip == 'stripped' || inputs.strip == 'both' }}
227238
run: |

0 commit comments

Comments
 (0)