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

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