Skip to content

Commit 6700ca9

Browse files
fix: use proper host objcopy/readelf
1 parent 86e84d7 commit 6700ca9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

contrib/guix/libexec/build.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ mkdir -p "$DISTSRC"
345345
case "$HOST" in
346346
*linux*)
347347
# Compress DWARF sections in debug files and set proper permissions
348-
find "${DISTNAME}" -name "*.dbg" -type f -print0 | xargs -0 -P"$JOBS" -I{} sh -c "objcopy --compress-debug-sections=zlib \"\$1\" \"\$1.tmp\" && mv \"\$1.tmp\" \"\$1\" && chmod 644 \"\$1\"" _ {}
348+
find "${DISTNAME}" -name "*.dbg" -type f -print0 | xargs -0 -P"$JOBS" -I{} sh -c "${HOST}-objcopy --compress-debug-sections=zlib \"\$1\" \"\$1.tmp\" && mv \"\$1.tmp\" \"\$1\" && chmod 644 \"\$1\"" _ {}
349349

350350
# Create .build-id tree for perf auto-discovery
351351
mkdir -p "${DISTNAME}/usr/lib/debug/.build-id"
@@ -354,7 +354,7 @@ mkdir -p "$DISTSRC"
354354
find "${DISTNAME}/lib" -type f -print0
355355
} | while IFS= read -r -d '' elf; do
356356
if file "$elf" | grep -q "ELF.*executable\|ELF.*shared object"; then
357-
build_id=$(readelf -n "$elf" 2>/dev/null | awk '/Build ID/ {print $3; exit}')
357+
build_id=$(${HOST}-readelf -n "$elf" 2>/dev/null | awk '/Build ID/ {print $3; exit}')
358358
if [ -n "$build_id" ] && [ -f "${elf}.dbg" ]; then
359359
dir="${DISTNAME}/usr/lib/debug/.build-id/${build_id:0:2}"
360360
mkdir -p "$dir"
@@ -374,13 +374,13 @@ mkdir -p "$DISTSRC"
374374
while IFS= read -r -d '' elf; do
375375
if file "$elf" | grep -q "ELF.*executable\|ELF.*shared object"; then
376376
# Check for build-id
377-
if ! readelf -n "$elf" 2>/dev/null | grep -q "Build ID"; then
377+
if ! ${HOST}-readelf -n "$elf" 2>/dev/null | grep -q "Build ID"; then
378378
echo "ERROR: No build-id found in $elf" >&2
379379
verification_failed=1
380380
fi
381381
382382
# Check for .gnu_debuglink
383-
if ! readelf --string-dump=.gnu_debuglink "$elf" >/dev/null 2>&1; then
383+
if ! ${HOST}-readelf --string-dump=.gnu_debuglink "$elf" >/dev/null 2>&1; then
384384
echo "ERROR: No .gnu_debuglink found in $elf" >&2
385385
verification_failed=1
386386
fi

0 commit comments

Comments
 (0)