summaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-03-12 22:42:22 +0000
committermidipix <writeonce@midipix.org>2024-03-12 22:42:22 +0000
commitc5ee865ab8df8672b287fd8bd033bd1bb0309a3f (patch)
tree9dac0b79e603a01ef1234baee436a1b22ede2782 /src/driver
parentadbcf41997b809c4c89849d5ee4601073d4779b6 (diff)
downloadslibtool-c5ee865ab8df8672b287fd8bd033bd1bb0309a3f.tar.bz2
slibtool-c5ee865ab8df8672b287fd8bd033bd1bb0309a3f.tar.xz
driver: set default flag bits only after all argv options have been processed.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/slbt_driver_ctx.c25
1 files 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)