libpayload: gdb: Make die_if() format string a literal

CB:77969 made minor changes to the die_if() macro. One of the
consequences is that the format string passed to it can no longer be a
real `char *` variable, it needs to actually be a string literal. In the
vast majority of call sites that is already the case, but there was one
instance in the GDB code where we're reusing the same format string many
times and for that reason put it into a const variable. Fix that by
turning it into a #define macro instead. (Even though this technically
duplicates the format string, the linker is able to merge identical
string literals together again, so it doesn't really end up taking more
space.)

Change-Id: I532a04b868f12aa0e3c01422c075ddaade251827
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/81361
Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/payloads/libpayload/gdb/transport.c b/payloads/libpayload/gdb/transport.c
index 5b575d0..66a6f20 100644
--- a/payloads/libpayload/gdb/transport.c
+++ b/payloads/libpayload/gdb/transport.c
@@ -16,12 +16,12 @@
 #include <gdb.h>
 #include <libpayload.h>
 
+#define OUTPUT_OVERRUN_MSG "GDB output buffer overrun (try increasing reply.size)!\n"
+
 /* MMIO word size is not standardized, but *usually* 32 (even on ARM64) */
 typedef u32 mmio_word_t;
 
 static const int timeout_us = 100 * 1000;
-static const char output_overrun[] = "GDB output buffer overrun (try "
-				     "increasing reply.size)!\n";
 
 /* Serial-specific glue code... add more transport layers here when desired. */
 
@@ -77,7 +77,7 @@
 void gdb_message_encode_bytes(struct gdb_message *message, const void *data,
 			      int length)
 {
-	die_if(message->used + length * 2 > message->size, output_overrun);
+	die_if(message->used + length * 2 > message->size, OUTPUT_OVERRUN_MSG);
 	const mmio_word_t *aligned =
 		(mmio_word_t *)ALIGN_DOWN((uintptr_t)data, sizeof(*aligned));
 	mmio_word_t word = be32toh(readl(aligned++));
@@ -114,7 +114,7 @@
 
 void gdb_message_encode_zero_bytes(struct gdb_message *message, int length)
 {
-	die_if(message->used + length * 2 > message->size, output_overrun);
+	die_if(message->used + length * 2 > message->size, OUTPUT_OVERRUN_MSG);
 	memset(message->buf + message->used, '0', length * 2);
 	message->used += length * 2;
 }
@@ -125,13 +125,13 @@
 			     string, message->size - message->used);
 
 	/* Check >= instead of > to account for strlcpy's trailing '\0'. */
-	die_if(message->used >= message->size, output_overrun);
+	die_if(message->used >= message->size, OUTPUT_OVERRUN_MSG);
 }
 
 void gdb_message_encode_int(struct gdb_message *message, uintptr_t val)
 {
 	int length = sizeof(uintptr_t) * 2 - __builtin_clz(val) / 4;
-	die_if(message->used + length > message->size, output_overrun);
+	die_if(message->used + length > message->size, OUTPUT_OVERRUN_MSG);
 	while (length--)
 		message->buf[message->used++] =
 			to_hex((val >> length * 4) & 0xf);