summaryrefslogtreecommitdiff
path: root/src/logic/slbt_exec_compile.c
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-07-11 09:27:24 -0400
committermidipix <writeonce@midipix.org>2018-07-11 09:35:43 -0400
commit77e6c6fd7c894ff6e4a9f53314049831c4b5c796 (patch)
treec778ad50f4ee9c4cdea8d96caf6c6b3a045f9396 /src/logic/slbt_exec_compile.c
parentb5fcb346edd0b22ff4a53dec6c3cb7ed3708de74 (diff)
downloadslibtool-77e6c6fd7c894ff6e4a9f53314049831c4b5c796.tar.bz2
slibtool-77e6c6fd7c894ff6e4a9f53314049831c4b5c796.tar.xz
compile mode: (optionally) pass -fPIC only with the relevant --tag (CC|CXX).
Diffstat (limited to 'src/logic/slbt_exec_compile.c')
-rw-r--r--src/logic/slbt_exec_compile.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/logic/slbt_exec_compile.c b/src/logic/slbt_exec_compile.c
index 70d44fd..1c84734 100644
--- a/src/logic/slbt_exec_compile.c
+++ b/src/logic/slbt_exec_compile.c
@@ -35,6 +35,7 @@ int slbt_exec_compile(
struct slbt_exec_ctx * ectx)
{
int ret;
+ char * fpic;
struct slbt_exec_ctx * actx = 0;
const struct slbt_common_ctx * cctx = dctx->cctx;
@@ -65,14 +66,19 @@ int slbt_exec_compile(
ectx->program = ectx->compiler;
ectx->argv = ectx->cargv;
+ /* -fpic */
+ fpic = *ectx->fpic;
+
+ if ((cctx->tag == SLBT_TAG_CC) || (cctx->tag == SLBT_TAG_CXX))
+ if (cctx->settings.picswitch)
+ fpic = cctx->settings.picswitch;
+
/* shared library object */
if (cctx->drvflags & SLBT_DRIVER_SHARED) {
- if (!(cctx->drvflags & SLBT_DRIVER_ANTI_PIC))
+ if (!(cctx->drvflags & SLBT_DRIVER_ANTI_PIC)) {
*ectx->dpic = "-DPIC";
-
- if (!(cctx->drvflags & SLBT_DRIVER_ANTI_PIC))
- if (cctx->settings.picswitch)
- *ectx->fpic = cctx->settings.picswitch;
+ *ectx->fpic = fpic;
+ }
*ectx->lout[0] = "-o";
*ectx->lout[1] = ectx->lobjname;
@@ -94,12 +100,10 @@ int slbt_exec_compile(
if (cctx->drvflags & SLBT_DRIVER_STATIC) {
slbt_reset_placeholders(ectx);
- if (cctx->drvflags & SLBT_DRIVER_PRO_PIC)
+ if (cctx->drvflags & SLBT_DRIVER_PRO_PIC) {
*ectx->dpic = "-DPIC";
-
- if (cctx->drvflags & SLBT_DRIVER_PRO_PIC)
- if (cctx->settings.picswitch)
- *ectx->fpic = cctx->settings.picswitch;
+ *ectx->fpic = fpic;
+ }
*ectx->lout[0] = "-o";
*ectx->lout[1] = ectx->aobjname;