xref: /openbmc/linux/arch/x86/tools/chkobjdump.awk (revision 41e0d491)
1# GNU objdump version checker
2#
3# Usage:
4# objdump -v | awk -f chkobjdump.awk
5BEGIN {
6	# objdump version 2.19 or later is OK for the test.
7	od_ver = 2;
8	od_sver = 19;
9}
10
11/^GNU objdump/ {
12	verstr = ""
13	gsub(/\(.*\)/, "");
14	for (i = 3; i <= NF; i++)
15		if (match($(i), "^[0-9]")) {
16			verstr = $(i);
17			break;
18		}
19	if (verstr == "") {
20		printf("Warning: Failed to find objdump version number.\n");
21		exit 0;
22	}
23	split(verstr, ver, ".");
24	if (ver[1] > od_ver ||
25	    (ver[1] == od_ver && ver[2] >= od_sver)) {
26		exit 1;
27	} else {
28		printf("Warning: objdump version %s is older than %d.%d\n",
29		       verstr, od_ver, od_sver);
30		print("Warning: Skipping posttest.");
31		# Logic is inverted, because we just skip test without error.
32		exit 0;
33	}
34}
35