diff options
author | midipix <writeonce@midipix.org> | 2024-03-16 15:57:31 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2024-03-16 15:57:31 +0000 |
commit | 1443ebb29f38c44a40bf3ce7754b9153b45712e9 (patch) | |
tree | e41e52fd06e2aa8a15f53012d45a372da2b3fd2f /src/arbits/output | |
parent | c8ac943463470e1486a061a65943b2be859ba2df (diff) | |
download | slibtool-1443ebb29f38c44a40bf3ce7754b9153b45712e9.tar.bz2 slibtool-1443ebb29f38c44a40bf3ce7754b9153b45712e9.tar.xz |
slbt_au_output_symbols(): include weak aliases of strong symbols.
Diffstat (limited to 'src/arbits/output')
-rw-r--r-- | src/arbits/output/slbt_au_output_symbols.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/arbits/output/slbt_au_output_symbols.c b/src/arbits/output/slbt_au_output_symbols.c index 8d53d77..49d78ae 100644 --- a/src/arbits/output/slbt_au_output_symbols.c +++ b/src/arbits/output/slbt_au_output_symbols.c @@ -28,11 +28,14 @@ static int slbt_au_output_symbols_posix( int fdout; 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]; fdout = fdctx->fdout; fsort = !(dctx->cctx->fmtflags & SLBT_OUTPUT_ARCHIVE_NOSORT); @@ -50,11 +53,26 @@ static int slbt_au_output_symbols_posix( symstrv = fsort ? mctx->mapstrv : mctx->symstrv; - for (symv=symstrv; *symv; symv++) - if (!fcoff || slbt_is_strong_coff_symbol(*symv)) - if (!regex || !regexec(®ctx,*symv,1,pmatch,0)) + for (symv=symstrv; *symv; symv++) { + if (!fcoff || slbt_is_strong_coff_symbol(*symv)) { + if (!regex || !regexec(®ctx,*symv,1,pmatch,0)) { 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(®ctx,strbuf,1,pmatch,0)) + if (slbt_dprintf(fdout,"%s\n",strbuf) < 0) + return SLBT_SYSTEM_ERROR(dctx,0); + } + } if (regex) regfree(®ctx); |