tools/nolibc: fix missing strlen() definition and infinite loop with gcc-12