svn commit: r503998 - head/Mk/Scripts
Bryan Drewery
bdrewery at FreeBSD.org
Tue Jun 11 22:56:33 UTC 2019
Author: bdrewery
Date: Tue Jun 11 22:56:32 2019
New Revision: 503998
URL: https://svnweb.freebsd.org/changeset/ports/503998
Log:
Speedup ELF file detection almost 100%.
This uses the same pattern we have in qa.sh. Rather than using file(1),
which reads the whole file and does too much magic, use readelf(1) which
bails out if the file lacks the proper ELF headers.
(This file is not yet used by anything)
Sponsored by: DellEMC
Modified:
head/Mk/Scripts/generate-symbols.sh
Modified: head/Mk/Scripts/generate-symbols.sh
==============================================================================
--- head/Mk/Scripts/generate-symbols.sh Tue Jun 11 22:30:14 2019 (r503997)
+++ head/Mk/Scripts/generate-symbols.sh Tue Jun 11 22:56:32 2019 (r503998)
@@ -10,18 +10,11 @@ msg "Finding symbols"
# Find all ELF files, strip them, and move symbols to PREFIX/usr/lib/debug/ORIG_PATH
ELF_FILES=$(mktemp -t elf_files)
-LF=$(printf '\nX')
-LF=${LF%X}
find ${STAGEDIR} -type f \
- -exec /usr/bin/file -nNF "${LF}" {} + | while read -r f; do
- read -r output
- case "${output}" in
- ELF\ *\ executable,\ *FreeBSD*,\ not\ stripped*|\
- ELF\ *\ shared\ object,\ *FreeBSD*,\ not\ stripped*)
- echo "${f}"
- ;;
- esac
-done > ${ELF_FILES}
+ -exec /usr/bin/readelf -S {} + 2>/dev/null | awk ' \
+ /File:/ {sub(/File: /, "", $0); file=$0}
+ /[[:space:]]\.debug_info[[:space:]]*PROGBITS/ {print file}' \
+ > ${ELF_FILES}
# Create all of the /usr/local/lib/* dirs
lib_dir="${STAGEDIR}.debug${PREFIX}/lib/debug"
More information about the svn-ports-head
mailing list