summaryrefslogtreecommitdiff
path: root/build-aux/embed-sources.h.gen
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux/embed-sources.h.gen')
-rwxr-xr-xbuild-aux/embed-sources.h.gen10
1 files changed, 10 insertions, 0 deletions
diff --git a/build-aux/embed-sources.h.gen b/build-aux/embed-sources.h.gen
new file mode 100755
index 0000000..0ba6457
--- /dev/null
+++ b/build-aux/embed-sources.h.gen
@@ -0,0 +1,10 @@
+#!/bin/sh
+# embed-sources.h.gen - Generate C definitions for GNU `ld -r -b binary` files
+#
+# Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
+# SPDX-License-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'