diff options
author | midipix <writeonce@midipix.org> | 2024-02-04 03:37:08 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2024-02-04 03:37:08 +0000 |
commit | 5c429555a5cb83026f39fbfd8aeb666b58b283b5 (patch) | |
tree | d3cfbc1dc302ab0018806aea6092317217e9b9ef | |
parent | 80b4319d2e8453a90c2cecba3bfd43cf4dddbc0a (diff) | |
download | slibtool-5c429555a5cb83026f39fbfd8aeb666b58b283b5.tar.bz2 slibtool-5c429555a5cb83026f39fbfd8aeb666b58b283b5.tar.xz |
slbt_exec_link(): enhance logging of linker- and linking-tool errors.
-rw-r--r-- | include/slibtool/slibtool.h | 4 | ||||
-rw-r--r-- | src/logic/slbt_exec_link.c | 36 |
2 files changed, 36 insertions, 4 deletions
diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h index 4267665..21b7234 100644 --- a/include/slibtool/slibtool.h +++ b/include/slibtool/slibtool.h @@ -88,6 +88,10 @@ enum slbt_custom_error { SLBT_ERR_FLOW_ERROR, SLBT_ERR_FLEE_ERROR, SLBT_ERR_COMPILE_ERROR, + SLBT_ERR_LINK_ERROR, + SLBT_ERR_AR_ERROR, + SLBT_ERR_MDSO_ERROR, + SLBT_ERR_DLLTOOL_ERROR, SLBT_ERR_ARCHIVE_IMPORT, SLBT_ERR_HOST_INIT, SLBT_ERR_INSTALL_FAIL, diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c index b2cad03..122e6ee 100644 --- a/src/logic/slbt_exec_link.c +++ b/src/logic/slbt_exec_link.c @@ -1244,9 +1244,15 @@ static int slbt_exec_link_create_import_library( return SLBT_NESTED_ERROR(dctx); /* dlltool/mdso spawn */ - if ((slbt_spawn(ectx,true) < 0) || ectx->exitcode) + if ((slbt_spawn(ectx,true) < 0) && (ectx->pid < 0)) { return SLBT_SPAWN_ERROR(dctx); + } else if (ectx->exitcode) { + return SLBT_CUSTOM_ERROR( + dctx, + fmdso ? SLBT_ERR_MDSO_ERROR : SLBT_ERR_DLLTOOL_ERROR); + } + return 0; } @@ -1349,9 +1355,15 @@ static int slbt_exec_link_create_archive( return SLBT_NESTED_ERROR(dctx); /* ar spawn */ - if ((slbt_spawn(ectx,true) < 0) || ectx->exitcode) + if ((slbt_spawn(ectx,true) < 0) && (ectx->pid < 0)) { return SLBT_SPAWN_ERROR(dctx); + } else if (ectx->exitcode) { + return SLBT_CUSTOM_ERROR( + dctx, + SLBT_ERR_AR_ERROR); + } + /* input objects associated with .la archives */ for (parg=ectx->cargv; *parg; parg++) if (slbt_adjust_wrapper_argument(*parg,true)) @@ -1566,11 +1578,19 @@ static int slbt_exec_link_create_library( SLBT_NESTED_ERROR(dctx)); /* spawn */ - if ((slbt_spawn(ectx,true) < 0) || ectx->exitcode) + if ((slbt_spawn(ectx,true) < 0) && (ectx->pid < 0)) { return slbt_exec_link_exit( &depsmeta, SLBT_SPAWN_ERROR(dctx)); + } else if (ectx->exitcode) { + return slbt_exec_link_exit( + &depsmeta, + SLBT_CUSTOM_ERROR( + dctx, + SLBT_ERR_LINK_ERROR)); + } + return slbt_exec_link_exit(&depsmeta,0); } @@ -1739,11 +1759,19 @@ static int slbt_exec_link_create_executable( SLBT_NESTED_ERROR(dctx)); /* spawn */ - if ((slbt_spawn(ectx,true) < 0) || ectx->exitcode) + if ((slbt_spawn(ectx,true) < 0) && (ectx->pid < 0)) { return slbt_exec_link_exit( &depsmeta, SLBT_SPAWN_ERROR(dctx)); + } else if (ectx->exitcode) { + return slbt_exec_link_exit( + &depsmeta, + SLBT_CUSTOM_ERROR( + dctx, + SLBT_ERR_LINK_ERROR)); + } + /* executable wrapper: finalize */ slbt_exec_close_fdwrapper(ectx); |