From: Kevin S. <ks...@ez...> - 2013-12-11 03:36:03
|
On 10 Dec 2013, at 23:26:29 +0000, Keith Marshall wrote: > Are those offsets in hex, or decimal? If hex ... > if decimal, (as I suspect they are) A longer disassembly doesn't contain any hex-looking digits in the offsets, and does contain some '8' and '9', so it seems like it must be decimal. > OTOH, in GCC's own info documentation, I see: > >> 3.17.15 Intel 386 and AMD x86-64 Options >> ---------------------------------------- >> >> These `-m' options are defined for the i386 and x86-64 family of >> computers: >> >> `-mtune=CPU-TYPE' >> [...] The choices for CPU-TYPE are: >> _generic_ >> [...] But, if you do not know exactly what CPU users >> of your application will have, then you should use this >> option. >> >> As new processors are deployed in the marketplace, the >> behavior of this option will change. Therefore, if you >> upgrade to a newer version of GCC, the code generated option >> will change to reflect the processors that were most common >> when that version of GCC was released. >> >> There is no `-march=generic' option because `-march' >> indicates the instruction set the compiler can use, and there >> is no generic instruction set applicable to all processors. >> In contrast, `-mtune' indicates the processor (or, in this >> case, collection of processors) for which the code is >> optimized. >> ... > > which does suggest that, as GCC evolves, it may emit code which, by > default, depends on the instruction sets of newer processors. (It also > suggests that -march, rather than -mtune, may be the preferred option > for forcing an older instruction set): I interpret this differently, and to me, it sounds like -mtune=generic (without specifying any -march) should produce code that's able to run on all processors in the family, or at least on the "default machine type", whatever that means. A newer compiler with -mtune=generic may generate code different from what the older compiler generated from that same setting, due to it optimizing for a different subset of processors, but the resulting codes from both compilers are still expected to be able to run on the same set of processors, if the default machine type or chosen -march setting hasn't changed. I would hope that there's an explicit way to define what the default machine type is for a given gcc installation, and not have it necessarily be exactly the same as the local CPU type. It looks like there is such a configuration setting: http://gcc.gnu.org/gcc-4.5/changes.html#x86 > GCC now will set the default for -march= based on the configure target. Since this is a configurable setting, the MinGW-GCC (and runtime, binutils, etc.) maintainer du jour may tend to get whatever they've configured as their default, in which case it would seem that the MinGW build files should specify a chosen common -march value, rather than relying on the local default. Kevin |