Hello, please find attached the patch to (hopefully) improve self-surgery script that uses gcc-specific -aux-info now. Should help clang, icc and the like (in my case there's no proper gcc port for the target platform just yet). -- ---- WBR, Michael Shigorin / http://altlinux.org ------ http://opennet.ru / http://anna-news.info
>From ccfa41adf46367e132ba7556fad53dfce9ddffaf Mon Sep 17 00:00:00 2001 From: Michael Shigorin <mike@xxxxxxxxxxxx> Date: Mon, 7 Oct 2019 16:00:39 +0300 Subject: [PATCH] exception.sh: fixed to work with non-gcc -aux-info is a gccism absent in clang, icc and the like; let's reimplement this in a slightly cleaner way with -E. Suggested-by: Evgeny Mareev --- libselinux/src/exception.sh | 12 +++++------- libsemanage/src/exception.sh | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/libselinux/src/exception.sh b/libselinux/src/exception.sh index d6c8c71..459295c 100755 --- a/libselinux/src/exception.sh +++ b/libselinux/src/exception.sh @@ -15,10 +15,8 @@ echo " ;; esac } -if ! ${CC:-gcc} -x c -c -I../include - -aux-info temp.aux < ../include/selinux/selinux.h -then - # clang does not support -aux-info so fall back to gcc - gcc -x c -c -I../include - -aux-info temp.aux < ../include/selinux/selinux.h -fi -for i in `awk '/<stdin>.*extern int/ { print $6 }' temp.aux`; do except $i ; done -rm -f -- temp.aux -.o + +# equivalent of gcc-specific -aux-info +${CC:-gcc} -E -I../include -xc ../include/selinux/selinux.h | + sed -n 's/^extern * int *\(\w*\) *(.*$/\1/p' | + while read f; do except $f; done diff --git a/libsemanage/src/exception.sh b/libsemanage/src/exception.sh index 97bc2ae..11586a1 100644 --- a/libsemanage/src/exception.sh +++ b/libsemanage/src/exception.sh @@ -9,10 +9,8 @@ echo " } " } -if ! ${CC:-gcc} -x c -c -I../include - -aux-info temp.aux < ../include/semanage/semanage.h -then - # clang does not support -aux-info so fall back to gcc - gcc -x c -c -I../include - -aux-info temp.aux < ../include/semanage/semanage.h -fi -for i in `awk '/extern int/ { print $6 }' temp.aux`; do except $i ; done -rm -f -- temp.aux -.o + +# equivalent of gcc-specific -aux-info +${CC:-gcc} -E -I../include -xc ../include/semanage/semanage.h | + sed -n 's/^extern * int *\(\w*\) *(.*$/\1/p' | + while read f; do except $f; done -- 2.10.4