NetBSD-5.0.2/sys/lkm/arch/powerpc/lkmtramp.awk

#	$NetBSD: lkmtramp.awk,v 1.3 2005/12/11 12:24:47 christos Exp $
#
BEGIN {
	print "#include <machine/asm.h>"
}

/^SYMBOL TABLE:/ {
	doing_symbols = 1;
	next;
}

/^RELOCATION RECORDS/ {
	doing_symbols = 0;
	doing_relocs = 1;
	next;
}

$2 == "*UND*" {
	if (doing_symbols)
		x[$4] = "+";
	next;
}

$2 == "R_PPC_REL24" {
	if (!doing_relocs)
		next;
	if (x[$3] != "+")
		next;
	print "\nENTRY(__wrap_"$3")"
	print "\tlis\t0,__real_"$3"@h"
	print "\tori\t0,0,__real_"$3"@l"
	print "\tmtctr\t0"
	print "\tbctr"
	x[$3]=".";
}