summaryrefslogtreecommitdiff
path: root/make_ldscript.awk
diff options
context:
space:
mode:
Diffstat (limited to 'make_ldscript.awk')
-rw-r--r--make_ldscript.awk26
1 files changed, 26 insertions, 0 deletions
diff --git a/make_ldscript.awk b/make_ldscript.awk
new file mode 100644
index 0000000..4883737
--- /dev/null
+++ b/make_ldscript.awk
@@ -0,0 +1,26 @@
+# Expects an input file with lines of the form 'SYMBOL ADDRESS'
+#
+
+BEGIN {
+ prevAddress = "";
+}
+/\w+ \w+/ {
+ symbol = $1;
+ address = $2;
+
+ # Output space before
+ if (prevAddress != "") {
+ space = address - prevAddress;
+ if (space < 0) {
+ print("error: list is not sorted" > /dev/stderr);
+ exit(1);
+ }
+ printf("\t.space 0x%X\n", space);
+ }
+
+ prevAddress = address;
+
+ # Output label
+ print(symbol ": @ " address);
+
+} \ No newline at end of file