summaryrefslogtreecommitdiff
path: root/Mk/Scripts
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2019-06-11 22:56:32 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2019-06-11 22:56:32 +0000
commit6ced1c7607dc141294574ee73c29db82127b6b47 (patch)
tree71403c8da0f28fd63a95b193c4b2625c957a50f6 /Mk/Scripts
parentUpdate print/fontforge to 20190413 (diff)
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
Notes
Notes: svn path=/head/; revision=503998
Diffstat (limited to 'Mk/Scripts')
-rw-r--r--Mk/Scripts/generate-symbols.sh15
1 files changed, 4 insertions, 11 deletions
diff --git a/Mk/Scripts/generate-symbols.sh b/Mk/Scripts/generate-symbols.sh
index c6074d4203ed..942b1738c31d 100644
--- a/Mk/Scripts/generate-symbols.sh
+++ b/Mk/Scripts/generate-symbols.sh
@@ -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"