From 5d0af4bacc8f8ec740f829df045dedeedf13cf13 Mon Sep 17 00:00:00 2001 From: midipix Date: Feb 14 2024 04:44:53 +0000 Subject: link mode: support the darwin syntax for the -soname switch. --- diff --git a/src/logic/linkcmd/slbt_linkcmd_dsolib.c b/src/logic/linkcmd/slbt_linkcmd_dsolib.c index a3361db..a00a8df 100644 --- a/src/logic/linkcmd/slbt_linkcmd_dsolib.c +++ b/src/logic/linkcmd/slbt_linkcmd_dsolib.c @@ -115,6 +115,14 @@ int slbt_exec_link_create_library( ? dctx->cctx->output : 0; + char wl_soname[24]; + + if (!strcmp(dctx->cctx->host.host,"darwin")) { + strcpy(wl_soname,"-Wl,-install_name"); + } else { + strcpy(wl_soname,"-Wl,-soname"); + } + if ((dctx->cctx->drvflags & SLBT_DRIVER_IMAGE_MACHO)) { (void)0; @@ -123,7 +131,7 @@ int slbt_exec_link_create_library( "-Wl,%s",dctx->cctx->output) < 0) return SLBT_BUFFER_ERROR(dctx); - *ectx->soname = "-Wl,-soname"; + *ectx->soname = wl_soname; *ectx->lsoname = soname; } else if (relfilename && dctx->cctx->verinfo.verinfo) { @@ -137,7 +145,7 @@ int slbt_exec_link_create_library( dctx->cctx->settings.osdfussix) < 0) return SLBT_BUFFER_ERROR(dctx); - *ectx->soname = "-Wl,-soname"; + *ectx->soname = wl_soname; *ectx->lsoname = soname; } else if (relfilename) { @@ -149,7 +157,7 @@ int slbt_exec_link_create_library( dctx->cctx->settings.dsosuffix) < 0) return SLBT_BUFFER_ERROR(dctx); - *ectx->soname = "-Wl,-soname"; + *ectx->soname = wl_soname; *ectx->lsoname = soname; } else if (dctx->cctx->drvflags & SLBT_DRIVER_AVOID_VERSION) { @@ -160,7 +168,7 @@ int slbt_exec_link_create_library( dctx->cctx->settings.dsosuffix) < 0) return SLBT_BUFFER_ERROR(dctx); - *ectx->soname = "-Wl,-soname"; + *ectx->soname = wl_soname; *ectx->lsoname = soname; } else { @@ -173,7 +181,7 @@ int slbt_exec_link_create_library( dctx->cctx->settings.osdfussix) < 0) return SLBT_BUFFER_ERROR(dctx); - *ectx->soname = "-Wl,-soname"; + *ectx->soname = wl_soname; *ectx->lsoname = soname; }