#!/bin/sh # static.h.gen - Generate C definitions for GNU `ld -r -b binary` files # # Copyright (C) 2024 Luke T. Shumaker # 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'