summaryrefslogtreecommitdiff
path: root/ld/ld_script.awk
diff options
context:
space:
mode:
Diffstat (limited to 'ld/ld_script.awk')
-rw-r--r--ld/ld_script.awk11
1 files changed, 10 insertions, 1 deletions
diff --git a/ld/ld_script.awk b/ld/ld_script.awk
index 96460a52a0b9..12f2e3e5b75a 100644
--- a/ld/ld_script.awk
+++ b/ld/ld_script.awk
@@ -1,10 +1,19 @@
-# $Id: ld_script.awk 2493 2012-04-15 18:59:09Z kaiwang27 $
+# Transform text file contents into a string literal.
+#
+# Usage: awk -f THIS-SCRIPT INPUT > OUTPUT
+#
+# $Id: ld_script.awk 3593 2018-04-11 18:26:20Z jkoshy $
BEGIN {
+ # Generate a symbol name based on the last component
+ # of the input file name.
split(ARGV[1], s, ".");
+ sub(".*/", "", s[1]);
printf "const char *%s = ", s[1];
}
+# Enclose each line of text with a preceding and trailing '"',
+# escaping any '"' characters that are present.
{
printf "\"";
gsub("\"", "\\\"");