Blame SOURCES/redhat-rpm-config-9.1.0-ksyms-2.patch

6037de
--- redhat-rpm-config-9.1.0/find-requires.ksyms.old	2017-11-14 10:18:23.231861697 +0100
6037de
+++ redhat-rpm-config-9.1.0/find-requires.ksyms	2017-11-14 10:51:09.064436672 +0100
6037de
@@ -9,10 +9,24 @@ IFS=$'\n'
6037de
 
6037de
 # Extract all of the symbols provided by this module.
6037de
 all_provides() {
6037de
-    nm "$@" \
6037de
-    | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p' \
6037de
-    | awk --non-decimal-data '{printf("0x%08x\t%s\n", $1, $2)}' \
6037de
-    | LANG=C sort -k2,2 -u
6037de
+    if [[ -n $(nm "$@" | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p') ]]; then
6037de
+        nm "$@" \
6037de
+        | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p' \
6037de
+        | awk --non-decimal-data '{printf("0x%08x\t%s\n", $1, $2)}' \
6037de
+        | LC_ALL=C sort -k2,2 -u
6037de
+    else
6037de
+        ELFRODATA=$(readelf -R .rodata "$@" | awk '/0x/{printf $2$3$4$5}')
6037de
+        if [[ -n $(readelf -h "$@" | grep "little endian") ]]; then
6037de
+            RODATA=$(echo $ELFRODATA | sed 's/\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/g')
6037de
+        else
6037de
+            RODATA=$ELFRODATA
6037de
+        fi
6037de
+        for sym in $(nm "$@" | sed -r -ne 's:^0*([0-9a-f]+) R __crc_(.+):0x\1 \2:p'); do
6037de
+            echo $sym $RODATA
6037de
+        done \
6037de
+        | awk --non-decimal-data '{printf("0x%08s\t%s\n", substr($3,($1*2)+1,8), $2)}' \
6037de
+        | LC_ALL=C sort -k2,2 -u
6037de
+    fi
6037de
 }
6037de
 
6037de
 # Extract all of the requirements of this module.