summaryrefslogtreecommitdiffhomepage
path: root/src/arbits
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-02-18 17:39:03 +0000
committermidipix <writeonce@midipix.org>2024-02-18 17:39:03 +0000
commit9feb47215a7730a9efcbacc25d8ff02e861a8527 (patch)
treebbc64a7003192e318244708c77bf42126ef28008 /src/arbits
parent0006f718b62316336a9f27a008ea8525173a5b56 (diff)
downloadslibtool-9feb47215a7730a9efcbacc25d8ff02e861a8527.tar.bz2
slibtool-9feb47215a7730a9efcbacc25d8ff02e861a8527.tar.xz
ar mode: pretty printer: coff archives: filter out __imp_ prefixed symbols.
Diffstat (limited to 'src/arbits')
-rw-r--r--src/arbits/output/slbt_ar_output_mapfile.c9
-rw-r--r--src/arbits/output/slbt_ar_output_symbols.c9
2 files changed, 12 insertions, 6 deletions
diff --git a/src/arbits/output/slbt_ar_output_mapfile.c b/src/arbits/output/slbt_ar_output_mapfile.c
index f2c2a9b..1c5534e 100644
--- a/src/arbits/output/slbt_ar_output_mapfile.c
+++ b/src/arbits/output/slbt_ar_output_mapfile.c
@@ -21,6 +21,7 @@ static int slbt_ar_output_mapfile_impl(
int fdout)
{
bool fsort;
+ bool fcoff;
const char * regex;
const char ** symv;
const char ** symstrv;
@@ -28,6 +29,7 @@ static int slbt_ar_output_mapfile_impl(
regmatch_t pmatch[2] = {{0,0},{0,0}};
fsort = !(dctx->cctx->fmtflags & SLBT_OUTPUT_ARCHIVE_NOSORT);
+ fcoff = (mctx->ofmtattr == AR_OBJECT_ATTR_COFF);
if (slbt_dprintf(fdout,"{\n" "\t" "global:\n") < 0)
return SLBT_SYSTEM_ERROR(dctx,0);
@@ -45,9 +47,10 @@ static int slbt_ar_output_mapfile_impl(
symstrv = fsort ? mctx->mapstrv : mctx->symstrv;
for (symv=symstrv; *symv; symv++)
- if (!regex || !regexec(&regctx,*symv,1,pmatch,0))
- if (slbt_dprintf(fdout,"\t\t%s;\n",*symv) < 0)
- return SLBT_SYSTEM_ERROR(dctx,0);
+ if (!fcoff || strncmp(*symv,"__imp_",6))
+ if (!regex || !regexec(&regctx,*symv,1,pmatch,0))
+ if (slbt_dprintf(fdout,"\t\t%s;\n",*symv) < 0)
+ return SLBT_SYSTEM_ERROR(dctx,0);
if (regex)
regfree(&regctx);
diff --git a/src/arbits/output/slbt_ar_output_symbols.c b/src/arbits/output/slbt_ar_output_symbols.c
index 148e0b1..0598d2e 100644
--- a/src/arbits/output/slbt_ar_output_symbols.c
+++ b/src/arbits/output/slbt_ar_output_symbols.c
@@ -26,6 +26,7 @@ static int slbt_ar_output_symbols_posix(
{
int fdout;
bool fsort;
+ bool fcoff;
const char * regex;
const char ** symv;
const char ** symstrv;
@@ -34,6 +35,7 @@ static int slbt_ar_output_symbols_posix(
fdout = fdctx->fdout;
fsort = !(dctx->cctx->fmtflags & SLBT_OUTPUT_ARCHIVE_NOSORT);
+ fcoff = (mctx->ofmtattr == AR_OBJECT_ATTR_COFF);
if (fsort && !mctx->mapstrv)
if (slbt_update_mapstrv(dctx,mctx) < 0)
@@ -48,9 +50,10 @@ static int slbt_ar_output_symbols_posix(
symstrv = fsort ? mctx->mapstrv : mctx->symstrv;
for (symv=symstrv; *symv; symv++)
- if (!regex || !regexec(&regctx,*symv,1,pmatch,0))
- if (slbt_dprintf(fdout,"%s\n",*symv) < 0)
- return SLBT_SYSTEM_ERROR(dctx,0);
+ if (!fcoff || strncmp(*symv,"__imp_",6))
+ if (!regex || !regexec(&regctx,*symv,1,pmatch,0))
+ if (slbt_dprintf(fdout,"%s\n",*symv) < 0)
+ return SLBT_SYSTEM_ERROR(dctx,0);
if (regex)
regfree(&regctx);