From 874b595d141abd86bf5253ca835471c828b4e8be Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 17 Feb 2024 20:19:03 +0000 Subject: ar mode: pretty printer: symbols, mapfile: added the -Wnosort switch. --- include/slibtool/slibtool_output.h | 1 + src/arbits/output/slbt_ar_output_mapfile.c | 2 +- src/arbits/output/slbt_ar_output_symbols.c | 2 +- src/internal/slibtool_driver_impl.h | 1 + src/logic/slbt_exec_ar.c | 4 ++++ src/skin/slbt_skin_ar.c | 6 ++++++ 6 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/slibtool/slibtool_output.h b/include/slibtool/slibtool_output.h index 37fb73c..3320990 100644 --- a/include/slibtool/slibtool_output.h +++ b/include/slibtool/slibtool_output.h @@ -11,6 +11,7 @@ #define SLBT_OUTPUT_ARCHIVE_SYMBOLS 0x00000004 #define SLBT_OUTPUT_ARCHIVE_ARMAPS 0x00000008 #define SLBT_OUTPUT_ARCHIVE_MAPFILE 0x00000010 +#define SLBT_OUTPUT_ARCHIVE_NOSORT 0x00000020 /* pretty-printer flags */ #define SLBT_PRETTY_YAML SLBT_PRETTY(0x00000001) diff --git a/src/arbits/output/slbt_ar_output_mapfile.c b/src/arbits/output/slbt_ar_output_mapfile.c index 3455c37..ab85394 100644 --- a/src/arbits/output/slbt_ar_output_mapfile.c +++ b/src/arbits/output/slbt_ar_output_mapfile.c @@ -27,7 +27,7 @@ static int slbt_ar_output_mapfile_impl( regex_t regctx; regmatch_t pmatch[2] = {0}; - fsort = true; + fsort = !(dctx->cctx->fmtflags & SLBT_OUTPUT_ARCHIVE_NOSORT); if (slbt_dprintf(fdout,"{\n" "\t" "global:\n") < 0) return SLBT_SYSTEM_ERROR(dctx,0); diff --git a/src/arbits/output/slbt_ar_output_symbols.c b/src/arbits/output/slbt_ar_output_symbols.c index 167de50..72dd3e0 100644 --- a/src/arbits/output/slbt_ar_output_symbols.c +++ b/src/arbits/output/slbt_ar_output_symbols.c @@ -33,7 +33,7 @@ static int slbt_ar_output_symbols_posix( regmatch_t pmatch[2] = {0}; fdout = fdctx->fdout; - fsort = true; + fsort = !(dctx->cctx->fmtflags & SLBT_OUTPUT_ARCHIVE_NOSORT); if (fsort && !mctx->mapstrv) if (slbt_update_mapstrv(dctx,mctx) < 0) diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h index cf9742d..2fecb92 100644 --- a/src/internal/slibtool_driver_impl.h +++ b/src/internal/slibtool_driver_impl.h @@ -90,6 +90,7 @@ enum app_tags { TAG_AR_CHECK, TAG_AR_PRINT, TAG_AR_MAPFILE, + TAG_AR_NOSORT, TAG_AR_REGEX, TAG_AR_PRETTY, TAG_AR_POSIX, diff --git a/src/logic/slbt_exec_ar.c b/src/logic/slbt_exec_ar.c index 35c8380..ede3f72 100644 --- a/src/logic/slbt_exec_ar.c +++ b/src/logic/slbt_exec_ar.c @@ -243,6 +243,10 @@ int slbt_exec_ar( ictx->cctx.fmtflags |= SLBT_OUTPUT_ARCHIVE_MAPFILE; break; + case TAG_AR_NOSORT: + ictx->cctx.fmtflags |= SLBT_OUTPUT_ARCHIVE_NOSORT; + break; + case TAG_AR_REGEX: ictx->cctx.regex = entry->arg; break; diff --git a/src/skin/slbt_skin_ar.c b/src/skin/slbt_skin_ar.c index ccd986c..e0d87e4 100644 --- a/src/skin/slbt_skin_ar.c +++ b/src/skin/slbt_skin_ar.c @@ -50,6 +50,12 @@ const struct argv_option slbt_ar_options[] = { 0,"", "filter armap symbols using the specified %s."}, + {"Wnosort", 0,TAG_AR_NOSORT,ARGV_OPTARG_NONE, + ARGV_OPTION_HYBRID_ONLY, + 0,0, + "do not sort the symbol list; " + "affect switches are -Wprint=symbols and -Wmapfile."}, + {"Wpretty", 0,TAG_AR_PRETTY,ARGV_OPTARG_REQUIRED, ARGV_OPTION_HYBRID_EQUAL, "posix|yaml|hexdata",0, -- cgit v1.2.3