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

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