From 9f449569df9c94670f51fd8cd5558b66884cd877 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 7 Dec 2023 22:51:52 +0100 Subject: Improve portability MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- linux/symbols.mk | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'linux/symbols.mk') diff --git a/linux/symbols.mk b/linux/symbols.mk index 97db4ab..ffdad11 100644 --- a/linux/symbols.mk +++ b/linux/symbols.mk @@ -1,6 +1,6 @@ # See LICENSE file for copyright and license details. -LINUX_SYMBOL_TABLES != sed -n 's/^.*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\+\)\b.*\$$\$$\$$.*\$$\$$\$$.*$$/\1/p' < linux/syscalls.h +LINUX_SYMBOL_TABLES != sed -n 's/^.*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\{1,\}\)\([^A-Za-z0-9_].*\)*\$$\$$\$$.*\$$\$$\$$.*$$/\1/p' < linux/syscalls.h LINUX_SYMBOL_TABLE_FILES != printf 'linux-src/symbols-$(LINUX_VERSION)/%s\n' $(LINUX_SYMBOL_TABLES) @@ -28,7 +28,7 @@ libsyscalls_get_syscall_display_info.lo: generated/linux-symbol-extractors.h lin $(LINUX_SYMBOL_TABLE_FILES): $(LINUX_SYMBOL_TABLE_DEPS) mkdir -p -- linux-src/symbols-$(LINUX_VERSION) table="$$(printf '%s\n' "$@" | tr / '\n' | sed -n '$$p')" && \ - command="$$(sed -n 's/^.*LINUX_SYMBOL_PRINTER_'"$$table"'\b.*\$$\$$\$$\s*\(.*\)\s*\$$\$$\$$.*$$/\1/p' < linux/syscalls.h)" && \ + command="$$(sed -n 's/^.*LINUX_SYMBOL_PRINTER_'"$$table"'\([^A-Za-z0-9_].*\)*\$$\$$\$$$(s)*\(.*\)$(s)*\$$\$$\$$.*$$/\2/p' < linux/syscalls.h)" && \ test -n "$$command" && \ printf '%s\n' "$$command" && \ (cd -- linux-src/linux-$(LINUX_VERSION) && env PATH="../../util:$${PATH}" sh -e -c "$$command") > $@ @@ -39,30 +39,30 @@ generated/linux-symbol-extractors.h: $(LINUX_SYMBOL_EXTRACTOR_DEPS) for tablefile in $(LINUX_SYMBOL_TABLE_FILES); do \ tablename="$$(printf '%s\n' "$$tablefile" | cut -d / -f 3)"; \ how="$$(sed -n < linux/syscalls.h \ - 's/^.*LINUX_SYMBOL_PRINTER_'"$$tablename"'\b.*\/\*\s*\(.*\)\s*\$$\$$\$$.*\$$\$$\$$.*$$/\1/p')"; \ + 's/^.*LINUX_SYMBOL_PRINTER_'"$$tablename"'\([^A-Za-z0-9_].*\)*\/\*$(s)*\(.*\)$(s)*\$$\$$\$$.*\$$\$$\$$.*$$/\2/p')"; \ printf '\n'; \ util/make-sym-extractor "$$tablename" "$$how" < "$$tablefile"; \ done > $@.tmp set -e; \ - pattern='\s\+LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\+\)\s*'; \ + pattern='$(s)\{1,\}LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\{1,\}\)$(s)*'; \ funcprefix='extract_linux_symbol_'; \ - sed -n 's/^\s*\x23\s*define'"$$pattern$$pattern"'\(\/.*\)\?$$/\x23define '$$funcprefix'\1 '$$funcprefix'\2/p' \ + sed -n 's/^$(s)*$(h)$(s)*define'"$$pattern$$pattern"'\(\/.*\)\{0,1\}$$/$(h)define '$$funcprefix'\1 '$$funcprefix'\2/p' \ < linux/syscalls.h | tr '[A-Z]' '[a-z]' > $@ storage_and_rettype="$$(sed '/^$$/d' < $@.tmp | sed 1q | sed 's/\*/\\\*/g' | sed 's/[^\*]$$/& /')"; \ sed -n 's/^extract_symbol_.*/'"$${storage_and_rettype}"'&;/p' < $@.tmp | cat - $@.tmp >> $@ -rm -f -- $@.tmp set -e; \ sed 's/, */ /g' < linux/syscalls.h \ - | sed -n 's/^.*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\+\)\b.*[^$$]\$$\$$\s*SYMBOLS(\(.*\))\s*\$$\$$[^$$].*$$/\1 \2/p' \ + | sed -n 's/^.*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\{1,\}\)\([^A-Za-z0-9_].*[^$$]\|[^A-Za-z0-9_$$]\)\$$\$$$(s)*SYMBOLS(\(.*\))$(s)*\$$\$$[^$$].*$$/\1 \3/p' \ | while read line; do \ printf '\n'; \ util/make-multiextractor $$line; \ done >> $@ printf '\n\43define LIST_LINUX_EXTRACTORS(X, D)\\\n' >> $@ set -e; \ - phonies="$$(sed -n '/\$$\$$\$$\s*BEGIN\s\+PHONIES\s*\$$\$$\$$/,/\$$\$$\$$\s*END\s\+PHONIES\s*\$$\$$\$$/p' < linux/syscalls.h \ - | sed -n 's/^\s*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\+\)\b.*$$/\1/p')"; \ - sed -n 's/^extract_symbol_\([^)]*\)(.*)\s*\/\*\s*\([0-9]\+\)\s*\*\/\s*$$/\1 \2/p' < $@ \ + phonies="$$(sed -n '/\$$\$$\$$$(s)*BEGIN$(s)\{1,\}PHONIES$(s)*\$$\$$\$$/,/\$$\$$\$$$(s)*END$(s)\{1,\}PHONIES$(s)*\$$\$$\$$/p' < linux/syscalls.h \ + | sed -n 's/^$(s)*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\{1,\}\)\([^A-Za-z0-9_].*\)*$$/\1/p')"; \ + sed -n 's/^extract_symbol_\([^)]*\)(.*)$(s)*\/\*$(s)*\([0-9]\{1,\}\)$(s)*\*\/$(s)*$$/\1 \2/p' < $@ \ | while read name n; do \ if ! printf '%s\n' "$$phonies" | grep -i \^"$$name"\$$ > /dev/null; then \ printf '\tX(LINUX_SYMBOL_PRINTER_%s, extract_symbol_%s, %i) D\\\n' \ -- cgit v1.2.3-70-g09d2