Commit 3a5926a2 authored by Stefan Bader's avatar Stefan Bader

UBUNTU: [Packaging] resync retpoline extraction

BugLink: http://bugs.launchpad.net/bugs/1786013Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent e7be669d
...@@ -5,17 +5,19 @@ cd "$1" || exit 1 ...@@ -5,17 +5,19 @@ cd "$1" || exit 1
# Find all valid retpoline information, collate the detected and # Find all valid retpoline information, collate the detected and
# safe information together. Join the result to find the detected # safe information together. Join the result to find the detected
# but non-safe elements. These are our concern. # but non-safe elements. These are our concern.
tmp="/tmp/retpoline-check.$$" ur_detected=$(mktemp --tmpdir "retpoline-check-XXXXXX.ur-detected")
ur_safe=$(mktemp --tmpdir "retpoline-check-XXXXXX.ur-safe")
find "." -path './drivers/firmware/efi/libstub' -prune -o \ find "." -path './drivers/firmware/efi/libstub' -prune -o \
-path './arch/x86/boot' -prune -o \ -path './arch/x86/boot' -prune -o \
-path './arch/x86/purgatory' -prune -o \ -path './arch/x86/purgatory' -prune -o \
-name \*.ur-detected | xargs cat | \ -name \*.ur-detected | xargs cat | \
sed -e "s@^$1@@" -e "s@ $2/@ @" -e "s@^/@@" | \ sed -e "s@^$1@@" -e "s@ $2/@ @" -e "s@^/@@" | \
sort -k 1b,1 >"$tmp.ur-detected" sort -k 1b,1 >"$ur_detected"
find "." -name \*.ur-safe | xargs cat | \ find "." -name \*.ur-safe | xargs cat | \
sed -e "s@^$1@@" -e "s@^/@@" | \ sed -e "s@^$1@@" -e "s@^/@@" | \
sort -k 1b,1 >"$tmp.ur-safe" sort -k 1b,1 >"$ur_safe"
join -v 1 -j 1 "$tmp.ur-detected" "$tmp.ur-safe" | sed -s 's/[^ ]* *//' join -v 1 -j 1 "$ur_detected" "$ur_safe" | sed -s 's/[^ ]* *//'
rm -f "$tmp".* rm -f "$ur_detected" "$ur_safe"
...@@ -146,7 +146,7 @@ rela() ...@@ -146,7 +146,7 @@ rela()
# Uses 8 character 0 expanded hexadecimal key for ease of consumption. # Uses 8 character 0 expanded hexadecimal key for ease of consumption.
contentmap_init() contentmap_init()
{ {
raw32 "$1" "$2" >"$tmp.cm" raw32 "$1" "$2" >"$tmp"
let offset=0 let offset=0
while read value while read value
do do
...@@ -154,8 +154,8 @@ contentmap_init() ...@@ -154,8 +154,8 @@ contentmap_init()
eval contentmap_$offset_hex=\'$value\' eval contentmap_$offset_hex=\'$value\'
let offset="$offset + 4" let offset="$offset + 4"
done <"$tmp.cm" done <"$tmp"
rm -f "$tmp.cm" rm -f "$tmp"
} }
contentmap() contentmap()
{ {
...@@ -209,7 +209,7 @@ rel() ...@@ -209,7 +209,7 @@ rel()
} | sed -e 's/-00*\([0-9a-f]\)/-\1/' } | sed -e 's/-00*\([0-9a-f]\)/-\1/'
} }
tmp="/tmp/retpoline-extract.$$" tmp=$(mktemp --tmpdir "retpoline-extract-XXXXXX")
disassemble() disassemble()
{ {
...@@ -267,4 +267,4 @@ esac | sort -k 1b,1 >"$object.ur-safe" ...@@ -267,4 +267,4 @@ esac | sort -k 1b,1 >"$object.ur-safe"
# formed above. This is performed in retpoline-check. # formed above. This is performed in retpoline-check.
#join -v 1 -j 1 "$tmp.extracted" "$tmp.safe" | sed -s 's/[^ ]* *//' #join -v 1 -j 1 "$tmp.extracted" "$tmp.safe" | sed -s 's/[^ ]* *//'
rm -f "$tmp".* rm -f "$tmp"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment