diff options
author | midipix <writeonce@midipix.org> | 2024-03-11 02:56:29 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2024-03-11 02:59:08 +0000 |
commit | 15782cdd6cefca2847a682bf0728e62cc146d396 (patch) | |
tree | 1b44eb6a780bb6d09ed91c55287ddc65d2724f47 /src/logic | |
parent | e2b5823ceac5e29c6ece483f179207720a7c1dd6 (diff) | |
download | slibtool-15782cdd6cefca2847a682bf0728e62cc146d396.tar.bz2 slibtool-15782cdd6cefca2847a682bf0728e62cc146d396.tar.xz |
link mode: archive creation: do not import non-convenience libraries.
Diffstat (limited to 'src/logic')
-rw-r--r-- | src/logic/linkcmd/slbt_linkcmd_archive.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/logic/linkcmd/slbt_linkcmd_archive.c b/src/logic/linkcmd/slbt_linkcmd_archive.c index 00fe825..3ff04f0 100644 --- a/src/logic/linkcmd/slbt_linkcmd_archive.c +++ b/src/logic/linkcmd/slbt_linkcmd_archive.c @@ -50,6 +50,26 @@ static int slbt_exec_link_remove_file( return 0; } + +static bool slbt_archive_is_convenience_library(int fdcwd, const char * arpath) +{ + int fd; + char laipath[PATH_MAX]; + char * dot; + + strcpy(laipath,arpath); + dot = strrchr(laipath,'.'); + strcpy(dot,".lai"); + + if ((fd = openat(fdcwd,laipath,O_RDONLY,0)) >= 0) { + close(fd); + return false; + } + + return true; +} + + slbt_hidden int slbt_exec_link_create_archive( const struct slbt_driver_ctx * dctx, struct slbt_exec_ctx * ectx, @@ -159,8 +179,8 @@ slbt_hidden int slbt_exec_link_create_archive( if (slbt_adjust_wrapper_argument( *parg,true, dctx->cctx->settings.arsuffix)) - if (slbt_util_import_archive(ectx,output,*parg)) - return SLBT_NESTED_ERROR(dctx); - + if (slbt_archive_is_convenience_library(fdcwd,*parg)) + if (slbt_util_import_archive(ectx,output,*parg)) + return SLBT_NESTED_ERROR(dctx); return 0; } |