summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-03-04 02:14:18 +0000
committermidipix <writeonce@midipix.org>2024-03-04 03:28:58 +0000
commit4ffae7b501bb689302926c4de443354986623075 (patch)
tree12cd2e0c7ec619451e1817906b40acb8b42cbf93 /src
parent93e38b3566a587e0aec3c46de85abf28f82614ac (diff)
downloadslibtool-4ffae7b501bb689302926c4de443354986623075.tar.bz2
slibtool-4ffae7b501bb689302926c4de443354986623075.tar.xz
slbt_adjust_linker_argument(): refactor, fix .libs related logic of .la files.
Diffstat (limited to 'src')
-rw-r--r--src/logic/linkcmd/slbt_linkcmd_argv.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/logic/linkcmd/slbt_linkcmd_argv.c b/src/logic/linkcmd/slbt_linkcmd_argv.c
index de145e0..5782952 100644
--- a/src/logic/linkcmd/slbt_linkcmd_argv.c
+++ b/src/logic/linkcmd/slbt_linkcmd_argv.c
@@ -217,36 +217,40 @@ slbt_hidden int slbt_adjust_linker_argument(
char * dot;
char base[PATH_MAX];
+ /* argv switch or non-library input argument? */
if (*arg == '-')
return 0;
if (!(dot = strrchr(arg,'.')))
return 0;
+ /* explicit .a input argument? */
if (!(strcmp(dot,arsuffix))) {
*xarg = arg;
return slbt_get_deps_meta(dctx,arg,1,depsmeta);
}
+ /* explicit .so input argument? */
if (!(strcmp(dot,dsosuffix)))
return slbt_get_deps_meta(dctx,arg,1,depsmeta);
+ /* not an .la library? */
if (strcmp(dot,".la"))
return 0;
- if (fpic) {
- if ((slash = strrchr(arg,'/')))
- slash++;
- else
- slash = arg;
+ /* .la file, associated .deps located under .libs */
+ if ((slash = strrchr(arg,'/'))) {
+ slash++;
+ } else {
+ slash = arg;
+ }
- if (slbt_snprintf(base,sizeof(base),
- "%s",slash) < 0)
- return 0;
+ if (slbt_snprintf(base,sizeof(base),
+ "%s",slash) < 0)
+ return 0;
- sprintf(slash,".libs/%s",base);
- dot = strrchr(arg,'.');
- }
+ sprintf(slash,".libs/%s",base);
+ dot = strrchr(arg,'.');
/* fdcwd */
fdcwd = slbt_driver_fdcwd(dctx);
@@ -255,12 +259,15 @@ slbt_hidden int slbt_adjust_linker_argument(
if (fpic) {
sprintf(dot,"%s",dsosuffix);
- if (slbt_symlink_is_a_placeholder(fdcwd,arg))
+ if (slbt_symlink_is_a_placeholder(fdcwd,arg)) {
sprintf(dot,"%s",arsuffix);
- else if ((fdlib = openat(fdcwd,arg,O_RDONLY)) >= 0)
+
+ } else if ((fdlib = openat(fdcwd,arg,O_RDONLY)) >= 0) {
close(fdlib);
- else
+
+ } else {
sprintf(dot,"%s",arsuffix);
+ }
return slbt_get_deps_meta(dctx,arg,0,depsmeta);
}