11e277 compile & link modes: accommodate conceptually challenged, PICky targets.

Authored and Committed by midipix 6 years ago
    compile & link modes: accommodate conceptually challenged, PICky targets.
    
        
file modified
+1 -0
include/slibtool/slibtool.h CHANGED
@@ -215,6 +215,7 @@ struct slbt_flavor_settings {
215
215
const char * impprefix;
216
216
const char * impsuffix;
217
217
const char * ldpathenv;
218
+ char * picswitch;
218
219
};
219
220
220
221
struct slbt_common_ctx {
file modified
+20 -24
src/driver/slbt_driver_ctx.c CHANGED
@@ -29,15 +29,15 @@ static const struct slbt_source_version slbt_src_version = {
29
29
};
30
30
31
31
/* flavor settings */
32
- #define SLBT_FLAVOR_SETTINGS(flavor,bfmt,arp,ars,dsop,dsos,exep,exes,impp,imps,ldenv) \
32
+ #define SLBT_FLAVOR_SETTINGS(flavor,bfmt,pic,arp,ars,dsop,dsos,exep,exes,impp,imps,ldenv) \
33
33
static const struct slbt_flavor_settings flavor = { \
34
- bfmt,arp,ars,dsop,dsos,exep,exes,impp,imps,ldenv}
34
+ bfmt,arp,ars,dsop,dsos,exep,exes,impp,imps,ldenv,pic}
35
35
36
- SLBT_FLAVOR_SETTINGS(host_flavor_default, "elf", "lib",".a", "lib",".so", "","", "", "", "LD_LIBRARY_PATH");
37
- SLBT_FLAVOR_SETTINGS(host_flavor_midipix, "pe", "lib",".a", "lib",".so", "","", "lib",".lib.a", "PATH");
38
- SLBT_FLAVOR_SETTINGS(host_flavor_mingw, "pe", "lib",".a", "lib",".dll", "",".exe", "lib",".dll.a", "PATH");
39
- SLBT_FLAVOR_SETTINGS(host_flavor_cygwin, "pe", "lib",".a", "lib",".dll", "",".exe", "lib",".dll.a", "PATH");
40
- SLBT_FLAVOR_SETTINGS(host_flavor_darwin, "macho","lib",".a", "lib",".dylib", "","", "", "", "DYLD_LIBRARY_PATH");
36
+ SLBT_FLAVOR_SETTINGS(host_flavor_default, "elf", "-fPIC","lib",".a", "lib",".so", "","", "", "", "LD_LIBRARY_PATH");
37
+ SLBT_FLAVOR_SETTINGS(host_flavor_midipix, "pe", "-fPIC","lib",".a", "lib",".so", "","", "lib",".lib.a", "PATH");
38
+ SLBT_FLAVOR_SETTINGS(host_flavor_mingw, "pe", 0, "lib",".a", "lib",".dll", "",".exe", "lib",".dll.a", "PATH");
39
+ SLBT_FLAVOR_SETTINGS(host_flavor_cygwin, "pe", 0, "lib",".a", "lib",".dll", "",".exe", "lib",".dll.a", "PATH");
40
+ SLBT_FLAVOR_SETTINGS(host_flavor_darwin, "macho","-fPIC","lib",".a", "lib",".dylib", "","", "", "", "DYLD_LIBRARY_PATH");
41
41
42
42
43
43
/* annotation strings */
@@ -1245,25 +1245,21 @@ int slbt_get_driver_ctx(
1245
1245
ctx->cctx.cargv = sargv.cargv;
1246
1246
1247
1247
/* host params */
1248
- if (cctx.mode == SLBT_MODE_COMPILE) {
1249
- (void)0;
1250
-
1251
- } else {
1252
- if (slbt_init_host_params(
1253
- &ctx->ctx,
1254
- &ctx->cctx,
1255
- &ctx->host,
1248
+ if (slbt_init_host_params(
1249
+ &ctx->ctx,
1250
+ &ctx->cctx,
1251
+ &ctx->host,
1252
+ &ctx->cctx.host,
1253
+ &ctx->cctx.cfgmeta)) {
1254
+ slbt_free_driver_ctx(&ctx->ctx);
1255
+ return -1;
1256
- &ctx->cctx.host,
1257
- &ctx->cctx.cfgmeta)) {
1258
- slbt_free_driver_ctx(&ctx->ctx);
1259
- return -1;
1260
- }
1261
-
1262
- slbt_init_flavor_settings(
1263
- &ctx->cctx,0,
1264
- &ctx->cctx.settings);
1265
1256
}
1266
1257
1258
+ /* flavor settings */
1259
+ slbt_init_flavor_settings(
1260
+ &ctx->cctx,0,
1261
+ &ctx->cctx.settings);
1262
+
1267
1263
/* ldpath */
1268
1264
if (slbt_init_ldrpath(&ctx->cctx,&ctx->cctx.host)) {
1269
1265
slbt_free_driver_ctx(&ctx->ctx);
file modified
+10 -6
src/logic/slbt_exec_compile.c CHANGED
@@ -66,10 +66,12 @@ int slbt_exec_compile(
66
66
67
67
/* shared library object */
68
68
if (dctx->cctx->drvflags & SLBT_DRIVER_SHARED) {
69
- if (!(dctx->cctx->drvflags & SLBT_DRIVER_ANTI_PIC)) {
69
+ if (!(dctx->cctx->drvflags & SLBT_DRIVER_ANTI_PIC))
70
70
*ectx->dpic = "-DPIC";
71
- *ectx->fpic = "-fPIC";
72
- }
71
+
72
+ if (!(dctx->cctx->drvflags & SLBT_DRIVER_ANTI_PIC))
73
+ if (dctx->cctx->settings.picswitch)
74
+ *ectx->fpic = dctx->cctx->settings.picswitch;
73
75
74
76
*ectx->lout[0] = "-o";
75
77
*ectx->lout[1] = ectx->lobjname;
@@ -91,10 +93,12 @@ int slbt_exec_compile(
91
93
if (dctx->cctx->drvflags & SLBT_DRIVER_STATIC) {
92
94
slbt_reset_placeholders(ectx);
93
95
94
- if (dctx->cctx->drvflags & SLBT_DRIVER_PRO_PIC) {
96
+ if (dctx->cctx->drvflags & SLBT_DRIVER_PRO_PIC)
95
97
*ectx->dpic = "-DPIC";
96
- *ectx->fpic = "-fPIC";
97
- }
98
+
99
+ if (dctx->cctx->drvflags & SLBT_DRIVER_PRO_PIC)
100
+ if (dctx->cctx->settings.picswitch)
101
+ *ectx->fpic = dctx->cctx->settings.picswitch;
98
102
99
103
*ectx->lout[0] = "-o";
100
104
*ectx->lout[1] = ectx->aobjname;
file modified
+3 -1
src/logic/slbt_exec_link.c CHANGED
@@ -1221,9 +1221,11 @@ static int slbt_exec_link_create_library(
1221
1221
/* shared/static */
1222
1222
if (dctx->cctx->drvflags & SLBT_DRIVER_ALL_STATIC) {
1223
1223
*ectx->dpic = "-static";
1224
+ } else if (dctx->cctx->settings.picswitch) {
1225
+ *ectx->dpic = "-shared";
1226
+ *ectx->fpic = dctx->cctx->settings.picswitch;
1224
1227
} else {
1225
1228
*ectx->dpic = "-shared";
1226
- *ectx->fpic = "-fPIC";
1227
1229
}
1228
1230
1229
1231
/* output */