From 5b42a87bbe5759edc5ed0ef494942dff48f61373 Mon Sep 17 00:00:00 2001
From: midipix <writeonce@midipix.org>
Date: Fri, 23 Feb 2024 00:01:19 +0000
Subject: link mode: regex: create a compatible export list for projects that
 expect it.

---
 src/logic/linkcmd/slbt_linkcmd_argv.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/logic/linkcmd/slbt_linkcmd_argv.c b/src/logic/linkcmd/slbt_linkcmd_argv.c
index f062ae7..6ad75bb 100644
--- a/src/logic/linkcmd/slbt_linkcmd_argv.c
+++ b/src/logic/linkcmd/slbt_linkcmd_argv.c
@@ -608,6 +608,7 @@ static int slbt_exec_link_create_expsyms_archive(
 			dctx,
 			SLBT_ERR_FLOW_ERROR);
 
+	/* .expsyms.xxx --> .expsyms.a */
 	dot[1] = 'a';
 	dot[2] = '\0';
 
@@ -676,9 +677,26 @@ static int slbt_exec_link_create_expsyms_archive(
 		ectx->mapfilename,
 		0644);
 
+	/* .expsyms.a --> .exp */
+	if (ret == 0) {
+		*dot = '\0';
+
+		if ((dot = strrchr(output,'.'))) {
+			dot[1] = 'e';
+			dot[2] = 'x';
+			dot[3] = 'p';
+			dot[4] = '\0';
+
+			ret = slbt_ar_create_symfile(
+				arctx->meta,
+				output,
+				0644);
+		}
+	}
+
 	slbt_ar_free_archive_ctx(arctx);
 
-	return (ret < 0) ? SLBT_NESTED_ERROR(dctx) : 0;
+	return ((ret < 0) && dot) ? SLBT_NESTED_ERROR(dctx) : 0;
 }
 
 
-- 
cgit v1.2.3