summaryrefslogtreecommitdiff
path: root/src/arbits
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-03-16 04:07:48 +0000
committermidipix <writeonce@midipix.org>2024-03-16 15:31:41 +0000
commite990e39ea0dbab989d1d6de47a2998afe9fac55b (patch)
tree98423f0ac535191842ba0241410463c484c61fb8 /src/arbits
parent213eb30aa5d5023f4156249349c278322a8ac2bf (diff)
downloadslibtool-e990e39ea0dbab989d1d6de47a2998afe9fac55b.tar.bz2
slibtool-e990e39ea0dbab989d1d6de47a2998afe9fac55b.tar.xz
slbt_ar_output_mapfile(): properly set strong aliases of weak symbols.
Diffstat (limited to 'src/arbits')
-rw-r--r--src/arbits/slbt_archive_mapfile.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/arbits/slbt_archive_mapfile.c b/src/arbits/slbt_archive_mapfile.c
index 3e7d4df..18f94dc 100644
--- a/src/arbits/slbt_archive_mapfile.c
+++ b/src/arbits/slbt_archive_mapfile.c
@@ -33,11 +33,14 @@ static int slbt_ar_output_mapfile_impl(
bool fsort;
bool fcoff;
bool fmach;
+ const char * dot;
+ const char * mark;
const char * regex;
const char ** symv;
const char ** symstrv;
regex_t regctx;
regmatch_t pmatch[2] = {{0,0},{0,0}};
+ char strbuf[4096];
fsort = !(dctx->cctx->fmtflags & SLBT_OUTPUT_ARCHIVE_NOSORT);
@@ -84,6 +87,17 @@ static int slbt_ar_output_mapfile_impl(
return SLBT_SYSTEM_ERROR(dctx,0);
}
}
+ /* coff weak symbols: expsym = .weak.alias.strong */
+ } else if (fcoff && !strncmp(*symv,".weak.",6)) {
+ mark = &(*symv)[6];
+ dot = strchr(mark,'.');
+
+ strncpy(strbuf,mark,dot-mark);
+ strbuf[dot-mark] = '\0';
+
+ if (!regex || !regexec(&regctx,strbuf,1,pmatch,0))
+ if (slbt_dprintf(fdout," %s = %s\n",strbuf,++dot) < 0)
+ return SLBT_SYSTEM_ERROR(dctx,0);
}
}