summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-03-16 12:45:29 +0000
committermidipix <writeonce@midipix.org>2024-03-16 15:31:41 +0000
commit7ff9431e77e9966c19c8fcda06a0de2a750efe09 (patch)
tree7fba4a8e51c25df422f86c54b5150f4140faf802 /src
parent4b2826c57b656a6929d445f0d95b087a58ac65df (diff)
downloadslibtool-7ff9431e77e9966c19c8fcda06a0de2a750efe09.tar.bz2
slibtool-7ff9431e77e9966c19c8fcda06a0de2a750efe09.tar.xz
slbt_ar_output_symfile(): include weak aliases of strong symbols.
Diffstat (limited to 'src')
-rw-r--r--src/arbits/slbt_archive_symfile.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/arbits/slbt_archive_symfile.c b/src/arbits/slbt_archive_symfile.c
index eadfed1..49d2ff0 100644
--- a/src/arbits/slbt_archive_symfile.c
+++ b/src/arbits/slbt_archive_symfile.c
@@ -34,11 +34,14 @@ static int slbt_ar_output_symfile_impl(
{
bool fsort;
bool fcoff;
+ 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);
@@ -63,6 +66,18 @@ static int slbt_ar_output_symfile_impl(
if (slbt_dprintf(fdout,"%s\n",*symv) < 0)
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);
}
}