On Tue, Oct 29, 2019 at 02:32:15AM +0000, Ramsay Jones wrote: > > + static const struct arch { > > + const char *name; > > + int mach; > > + int bits; > > + } archs[] = { > > + { "aarch64", MACH_ARM64, 64 }, > > + { "arm64", MACH_ARM64, 64 }, > > + { "arm", MACH_ARM, 32 }, > > + { "i386", MACH_I386, 32 }, > > + { "m68k", MACH_M68K, 32 }, > > + { "mips", MACH_MIPS64 }, > > + { "powerpc", MACH_PPC64 }, > > + { "ppc", MACH_PPC64 }, > > + { "riscv", MACH_RISCV64 }, > > I would rather these were explicitly set to 0. Hmm ... To me, the difference pop out better like so. The absence of a value is supposed to mean "there is not a known size for this, it needs to be calculated/guessed". I find that an explicit 0 conveys this les well. > > + { "s390", MACH_S390X, 64 }, > > + { "s390x", MACH_S390X, 64 }, > > + { "sparc", MACH_MIPS64 }, > > Er, I suppose this should be MACH_SPARC64, right? (also 0 init). Ooops, yes, thank you. Bad copy-paste, bad. > > + if (bits == 0) { > > + // guess the size of the architecture > > + if (!strcmp(suf, "")) { > > + if (arch_m64 == ARCH_LP32) > > + bits = 32; > > + else > > + bits = 64; > > So, this is a 50-50 bet. ;-) No, not really. The -m32/-m64 flags are still taken in account, before the --arch and after it too. If no -m32/-m64 is given at all then the used size is the one of the native arch (because arch_m64 is initialized so). I think it's quite natural to use but it lacks some error checking (e.g.: --arch=arm -m64 will purposely *not* select arm64, aka aarach64, but no warnings will be issued). -- Luc