[aot] Clean up the linker invocation code a bit.