diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -483,7 +483,11 @@ */ if (error != ENOENT) { foundfile = 1; - if (error == EEXIST) + /* + * The format is now recognized, abort trying another + * linker. + */ + if (error == EEXIST || error == EUNSDEP) break; } if (lf) { @@ -541,7 +545,7 @@ * can recognize this special case and not post bogus * dialog boxes. */ - if (error != EEXIST) + if (error != EEXIST && error != EUNSDEP) error = ENOEXEC; } else error = ENOENT; /* Nothing found */ @@ -1244,6 +1248,8 @@ error = kern_kldload(td, pathname, &fileid); if (error == 0) td->td_retval[0] = fileid; + else if (error == EUNSDEP) + error = ENOEXEC; } free(pathname, M_TEMP); return (error); @@ -2355,8 +2361,33 @@ } error = linker_load_module(NULL, modname, lf, verinfo, NULL); if (error) { - printf("KLD %s: depends on %s - not available or" - " version mismatch\n", lf->filename, modname); + switch (error) { + case ENOENT: + printf("KLD %s: depends on %s - not available\n", + lf->filename, modname); + break; + case EEXIST: + printf("KLD %s: depends on %s - version mismatch\n", + lf->filename, modname); + break; + case ENOEXEC: + printf("KLD %s: depends on %s - file format unrecognized\n", + lf->filename, modname); + break; + case ENOMEM: + printf("KLD %s: depends on %s - no memory\n", + lf->filename, modname); + break; + case EUNSDEP: + printf("KLD %s: depends on %s - transitive dependency error\n", + lf->filename, modname); + break; + default: + printf("KLD %s: depends on %s - can not load, error %d\n", + lf->filename, modname, error); + } + + error = EUNSDEP; break; } } @@ -2364,7 +2395,7 @@ if (error) return (error); linker_addmodules(lf, start, stop, 0); - return (error); + return (0); } static int