From 5c429555a5cb83026f39fbfd8aeb666b58b283b5 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 4 Feb 2024 03:37:08 +0000 Subject: slbt_exec_link(): enhance logging of linker- and linking-tool errors. --- src/logic/slbt_exec_link.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'src/logic/slbt_exec_link.c') 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); -- cgit v1.2.3