From c5ee865ab8df8672b287fd8bd033bd1bb0309a3f Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 12 Mar 2024 22:42:22 +0000 Subject: driver: set default flag bits only after all argv options have been processed. --- src/driver/slbt_driver_ctx.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c index b7c7b4c..6737815 100644 --- a/src/driver/slbt_driver_ctx.c +++ b/src/driver/slbt_driver_ctx.c @@ -454,8 +454,8 @@ int slbt_lib_get_driver_ctx( if (flags & SLBT_DRIVER_MODE_AR) cctx.mode = SLBT_MODE_AR; - /* shared and static objects: enable by default, disable by ~switch */ - cctx.drvflags = flags | SLBT_DRIVER_SHARED | SLBT_DRIVER_STATIC; + /* default flags (set at compile time and derived from symlink) */ + cctx.drvflags = flags; /* full annotation when annotation is on; */ if (!(cctx.drvflags & SLBT_DRIVER_ANNOTATE_NEVER)) @@ -800,6 +800,15 @@ int slbt_lib_get_driver_ctx( } } + /* enable both shared and static targets by default as appropriate */ + if (!(cctx.drvflags & SLBT_DRIVER_HEURISTICS)) { + if (!cmdnoshared) + cctx.drvflags |= SLBT_DRIVER_SHARED; + + if (!cmdnostatic) + cctx.drvflags |= SLBT_DRIVER_STATIC; + } + /* incompatible command-line arguments? */ if (cmdstatic && cmdshared) return slbt_driver_fail_incompatible_args( @@ -932,18 +941,6 @@ int slbt_lib_get_driver_ctx( cctx.drvflags &= ~(uint64_t)SLBT_DRIVER_DISABLE_STATIC; cctx.drvflags |= lflags; - cctx.drvflags |= SLBT_DRIVER_SHARED; - cctx.drvflags |= SLBT_DRIVER_STATIC; - - if (cmdstatic) { - cctx.drvflags |= SLBT_DRIVER_DISABLE_SHARED; - cctx.drvflags &= ~(uint64_t)SLBT_DRIVER_DISABLE_STATIC; - } - - if (cmdshared) { - cctx.drvflags |= SLBT_DRIVER_DISABLE_STATIC; - cctx.drvflags &= ~(uint64_t)SLBT_DRIVER_DISABLE_SHARED; - } /* -disable-static? */ if (cctx.drvflags & SLBT_DRIVER_DISABLE_STATIC) -- cgit v1.2.3