summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arbits/output/slbt_au_output_symbols.c24
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(&regctx,*symv,1,pmatch,0))
+ for (symv=symstrv; *symv; symv++) {
+ if (!fcoff || slbt_is_strong_coff_symbol(*symv)) {
+ if (!regex || !regexec(&regctx,*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(&regctx,strbuf,1,pmatch,0))
+ if (slbt_dprintf(fdout,"%s\n",strbuf) < 0)
+ return SLBT_SYSTEM_ERROR(dctx,0);
+ }
+ }
if (regex)
regfree(&regctx);