From dcf6a5f80a8bf402e0ba8bd61eaae7d06a9e46c6 Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 28 Feb 2024 08:12:48 +0000 Subject: ar mode: driver: added -Wdlsyms, -Wdlunit. --- include/slibtool/slibtool.h | 1 + include/slibtool/slibtool_output.h | 3 ++- src/internal/slibtool_driver_impl.h | 2 ++ src/logic/slbt_exec_ar.c | 15 +++++++++++++++ src/skin/slbt_skin_ar.c | 13 +++++++++++++ 5 files changed, 33 insertions(+), 1 deletion(-) diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h index e6d5ed5..ffa41c2 100644 --- a/include/slibtool/slibtool.h +++ b/include/slibtool/slibtool.h @@ -314,6 +314,7 @@ struct slbt_common_ctx { char ** cargv; char ** targv; char * libname; + const char * dlunit; const char * ccwrap; const char * target; const char * output; diff --git a/include/slibtool/slibtool_output.h b/include/slibtool/slibtool_output.h index 3320990..263e4d7 100644 --- a/include/slibtool/slibtool_output.h +++ b/include/slibtool/slibtool_output.h @@ -11,7 +11,8 @@ #define SLBT_OUTPUT_ARCHIVE_SYMBOLS 0x00000004 #define SLBT_OUTPUT_ARCHIVE_ARMAPS 0x00000008 #define SLBT_OUTPUT_ARCHIVE_MAPFILE 0x00000010 -#define SLBT_OUTPUT_ARCHIVE_NOSORT 0x00000020 +#define SLBT_OUTPUT_ARCHIVE_DLSYMS 0x00000020 +#define SLBT_OUTPUT_ARCHIVE_NOSORT 0x00000040 /* pretty-printer flags */ #define SLBT_PRETTY_YAML SLBT_PRETTY(0x00000001) diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h index 656c113..b8aefb6 100644 --- a/src/internal/slibtool_driver_impl.h +++ b/src/internal/slibtool_driver_impl.h @@ -92,6 +92,8 @@ enum app_tags { TAG_AR_CHECK, TAG_AR_PRINT, TAG_AR_MAPFILE, + TAG_AR_DLUNIT, + TAG_AR_DLSYMS, TAG_AR_NOSORT, TAG_AR_REGEX, TAG_AR_PRETTY, diff --git a/src/logic/slbt_exec_ar.c b/src/logic/slbt_exec_ar.c index d36fdc8..2abf7f2 100644 --- a/src/logic/slbt_exec_ar.c +++ b/src/logic/slbt_exec_ar.c @@ -107,6 +107,10 @@ static int slbt_exec_ar_perform_archive_actions( if (dctx->cctx->fmtflags & SLBT_OUTPUT_ARCHIVE_MAPFILE) if (slbt_au_output_mapfile((*arctxp)->meta) < 0) return SLBT_NESTED_ERROR(dctx); + + if (dctx->cctx->fmtflags & SLBT_OUTPUT_ARCHIVE_DLSYMS) + if (slbt_au_output_dlsyms(arctxv,dctx->cctx->dlunit) < 0) + return SLBT_NESTED_ERROR(dctx); } if (dctx->cctx->drvflags & SLBT_DRIVER_MODE_AR_MERGE) { @@ -237,6 +241,14 @@ int slbt_exec_ar(const struct slbt_driver_ctx * dctx) ictx->cctx.fmtflags |= SLBT_OUTPUT_ARCHIVE_MAPFILE; break; + case TAG_AR_DLSYMS: + ictx->cctx.fmtflags |= SLBT_OUTPUT_ARCHIVE_DLSYMS; + break; + + case TAG_AR_DLUNIT: + ictx->cctx.dlunit = entry->arg; + break; + case TAG_AR_NOSORT: ictx->cctx.fmtflags |= SLBT_OUTPUT_ARCHIVE_NOSORT; break; @@ -294,6 +306,9 @@ int slbt_exec_ar(const struct slbt_driver_ctx * dctx) } else if (cctx->fmtflags & SLBT_OUTPUT_ARCHIVE_MAPFILE) { (void)0; + } else if (cctx->fmtflags & SLBT_OUTPUT_ARCHIVE_DLSYMS) { + (void)0; + } else if (!(cctx->drvflags & SLBT_DRIVER_MODE_AR_ACTIONS)) { if (cctx->drvflags & SLBT_DRIVER_VERBOSITY_ERRORS) slbt_dprintf(fderr, diff --git a/src/skin/slbt_skin_ar.c b/src/skin/slbt_skin_ar.c index eecc5b9..948dcf3 100644 --- a/src/skin/slbt_skin_ar.c +++ b/src/skin/slbt_skin_ar.c @@ -51,6 +51,19 @@ const slbt_hidden struct argv_option slbt_ar_options[] = { 0,"", "filter armap symbols using the specified %s."}, + {"Wdlunit", 0,TAG_AR_DLUNIT,ARGV_OPTARG_REQUIRED, + ARGV_OPTION_HYBRID_ONLY|ARGV_OPTION_HYBRID_SPACE, + 0,"", + "consider %s to be the name of " + "the dynamic library (libfoo), the program (foo), " + "or the loaded module (foo) for which " + "a compatible dlsym vtable should be created."}, + + {"Wdlsyms", 0,TAG_AR_DLSYMS,ARGV_OPTARG_NONE, + ARGV_OPTION_HYBRID_ONLY, + 0,0, + "print out a compatible dlsyms vtable."}, + {"Wnosort", 0,TAG_AR_NOSORT,ARGV_OPTARG_NONE, ARGV_OPTION_HYBRID_ONLY, 0,0, -- cgit v1.2.3