1#
2# Copyright (c) 1982 Regents of the University of California.
3# All rights reserved.  The Berkeley software License Agreement
4# specifies the terms and conditions for redistribution.
5#
6#	@(#)pcexterns.awk	5.1 (Berkeley) 06/05/85
7#
8# This generates .stabs for all the global routines and variables
9# in a library. The format of a stab can be found in man5/stab.5.
10#
11# This value must be coordinated with the one in ../src/pstab.h.
12#
13BEGIN {
14	N_FLAGCHECKSUM = 1;
15}
16#
17# Generate "source file" stab for the library name.
18#
19NR == 1	{
20	name = substr($1, 1, index($1, ":") - 1);
21	printf "	.stabs	\"%s\",0x30,0,0x1,%d\n", name, N_FLAGCHECKSUM;
22}
23#
24# Generate "library routine" stab.
25#
26NF == 3 && $2 == "T" {
27	printf "	.stabs	\"%s\",0x30,0,0xc,0x%d\n", substr($3, 2), NR;
28}
29#
30# Generate "library variable" stab.
31#
32NF == 3 && $2 ~ /[ABD]/ {
33	printf "	.stabs	\"%s\",0x30,0,0xb,0x%d\n", substr($3, 2), NR;
34}
35