When compile 32-bit targets on some 64-bit systems, the "-m32" flag might be unrecognized by some gcc compilers, e.g. compiling arm32 in aarch64 system, compiling riscv32 in riscv64 system. Add check before adding "-m32" flag to gcc, and only add it if it is supported.