148062Sbostic#!/bin/sh -
27460Smckusick#
3*62116Sbostic# Copyright (c) 1982, 1993
4*62116Sbostic#	The Regents of the University of California.  All rights reserved.
57460Smckusick#
648062Sbostic# %sccs.include.redist.sh%
722267Sdist#
8*62116Sbostic#	@(#)pcexterns.awk	8.1 (Berkeley) 06/06/93
948062Sbostic#
1048062Sbostic
117603Smckusick# This generates .stabs for all the global routines and variables
127603Smckusick# in a library. The format of a stab can be found in man5/stab.5.
137603Smckusick#
1414118Smckusick# This value must be coordinated with the one in ../src/pstab.h.
1514118Smckusick#
1614118SmckusickBEGIN {
1714118Smckusick	N_FLAGCHECKSUM = 1;
1814118Smckusick}
1914118Smckusick#
207603Smckusick# Generate "source file" stab for the library name.
217603Smckusick#
227460SmckusickNR == 1	{
237460Smckusick	name = substr($1, 1, index($1, ":") - 1);
2414118Smckusick	printf "	.stabs	\"%s\",0x30,0,0x1,%d\n", name, N_FLAGCHECKSUM;
257460Smckusick}
267603Smckusick#
277603Smckusick# Generate "library routine" stab.
287603Smckusick#
297460SmckusickNF == 3 && $2 == "T" {
307599Smckusick	printf "	.stabs	\"%s\",0x30,0,0xc,0x%d\n", substr($3, 2), NR;
317460Smckusick}
327603Smckusick#
337603Smckusick# Generate "library variable" stab.
347603Smckusick#
357460SmckusickNF == 3 && $2 ~ /[ABD]/ {
367599Smckusick	printf "	.stabs	\"%s\",0x30,0,0xb,0x%d\n", substr($3, 2), NR;
377460Smckusick}
38