summaryrefslogtreecommitdiff
path: root/cmd/srv9p/static.h.gen
blob: bb27e550094ae35b588150c7938a65cb856dcca7 (plain)
1
2
3
4
5
6
7
8
9
10
#!/bin/sh
# static.h.gen - Generate C definitions for GNU `ld -r -b binary` files
#
# Copyright (C) 2024  Luke T. Shumaker <lukeshu@lukeshu.com>
# SPDX-Licence-Identifier: AGPL-3.0-or-later

nm --format=posix "$@" |
	sed -n -E \
	    -e 's/(.*_(end|start)) D .*/extern char \1[];/p' \
	    -e 's/(.*_size) A .*/extern size_t \1;/p'