Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jun 2019 22:56:32 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r503998 - head/Mk/Scripts
Message-ID:  <201906112256.x5BMuWdW086601@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906112256.x5BMuWdW086601>