diff options
author | Mattias Andrée <maandree@kth.se> | 2023-12-07 22:51:52 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2023-12-07 22:51:52 +0100 |
commit | 9f449569df9c94670f51fd8cd5558b66884cd877 (patch) | |
tree | 21d3c31e22b2cd0544351584c8614e70b66826e4 /linux/symbols.mk | |
parent | Fourth commit (diff) | |
download | libsyscalls-9f449569df9c94670f51fd8cd5558b66884cd877.tar.gz libsyscalls-9f449569df9c94670f51fd8cd5558b66884cd877.tar.bz2 libsyscalls-9f449569df9c94670f51fd8cd5558b66884cd877.tar.xz |
Improve portability
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | linux/symbols.mk | 18 |
1 files changed, 9 insertions, 9 deletions
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' \ |