From 403e071dd8974a862756aaebe692c0967961a89d Mon Sep 17 00:00:00 2001
From: midipix <writeonce@midipix.org>
Date: Tue, 20 Feb 2024 03:51:44 +0000
Subject: slbt_ar_create_mapfile(): also filter out coff weak symbols.

---
 src/arbits/slbt_archive_mapfile.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/arbits/slbt_archive_mapfile.c b/src/arbits/slbt_archive_mapfile.c
index 08ef3f9..5bfa0f7 100644
--- a/src/arbits/slbt_archive_mapfile.c
+++ b/src/arbits/slbt_archive_mapfile.c
@@ -24,6 +24,11 @@
 /* an underscore (where relevant) is not necessary.     */
 /********************************************************/
 
+static int slbt_is_strong_coff_symbol(const char * sym)
+{
+	return strncmp(sym,"__imp_",6) && strncmp(sym,".weak.",6);
+}
+
 static int slbt_ar_output_mapfile_impl(
 	const struct slbt_driver_ctx *  dctx,
 	struct slbt_archive_meta_impl * mctx,
@@ -73,7 +78,7 @@ static int slbt_ar_output_mapfile_impl(
 	symstrv = fsort ? mctx->mapstrv : mctx->symstrv;
 
 	for (symv=symstrv; *symv; symv++) {
-		if (!fcoff || strncmp(*symv,"__imp_",6)) {
+		if (!fcoff || slbt_is_strong_coff_symbol(*symv)) {
 			if (!regex || !regexec(&regctx,*symv,1,pmatch,0)) {
 				if (fcoff || fmach) {
 					if (slbt_dprintf(fdout,"%s\n",*symv) < 0)
-- 
cgit v1.2.3