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