Move aliased library name handling into lib.c