From b8dd56ad1477766403a4b7dbaaff309feba3d92d Mon Sep 17 00:00:00 2001 From: midipix Date: Feb 20 2024 07:12:33 +0000 Subject: slbt_ar_create_mapfile(): refactor coff & mach-o detection logic. --- diff --git a/src/arbits/slbt_archive_mapfile.c b/src/arbits/slbt_archive_mapfile.c index 5bfa0f7..c448c8c 100644 --- a/src/arbits/slbt_archive_mapfile.c +++ b/src/arbits/slbt_archive_mapfile.c @@ -45,14 +45,11 @@ static int slbt_ar_output_mapfile_impl( fsort = !(dctx->cctx->fmtflags & SLBT_OUTPUT_ARCHIVE_NOSORT); - fmach = !strcmp(dctx->cctx->host.flavor,"darwin"); - fmach = fmach || (mctx->ofmtattr & AR_OBJECT_ATTR_MACHO); - - fcoff = !strcmp(dctx->cctx->host.flavor,"midipix"); - fcoff = fcoff || !strcmp(dctx->cctx->host.flavor,"cygwin"); - fcoff = fcoff || !strcmp(dctx->cctx->host.flavor,"mingw"); - fcoff = fcoff || !strcmp(dctx->cctx->host.flavor,"msys2"); - fcoff = fcoff || (mctx->ofmtattr & AR_OBJECT_ATTR_COFF); + fmach = slbt_host_objfmt_is_macho(dctx); + fmach |= (mctx->ofmtattr & AR_OBJECT_ATTR_MACHO); + + fcoff = slbt_host_objfmt_is_coff(dctx); + fcoff |= (mctx->ofmtattr & AR_OBJECT_ATTR_COFF); if (fcoff) { if (slbt_dprintf(fdout,"EXPORTS\n") < 0)