On Linux/ia32, I got [hjl@gnu-29 gcc]$ ./xgcc -B./ -S -march=native x.i -v Reading specs from ./specs COLLECT_GCC=./xgcc COLLECT_LTO_WRAPPER=./lto-wrapper Target: i686-pc-linux-gnu Configured with: ../src-trunk/configure --enable-clocale=gnu --with-system-zlib --enable-shared --with-demangler-in-ld -with-plugin-ld=ld.gold --enable-gold Thread model: posix gcc version 4.5.0 20091220 (experimental) [trunk revision 155368] (GCC) COLLECT_GCC_OPTIONS='-B./' '-S' '-v' ./cc1 -fpreprocessed x.i -march=nocona -mcx16 -msahf --param l1-cache-size=16 --param l1-cache-line-size=64 --param l2-cache-size=2048 -mtune=nocona -quiet -dumpbase x.i -auxbase x -version -o x.s GNU C (GCC) version 4.5.0 20091220 (experimental) [trunk revision 155368] (i686-pc-linux-gnu) compiled by GNU C version 4.5.0 20091220 (experimental) [trunk revision 155368], GMP version 4.2.4, MPFR version 2.4.1, MPC version 0.8 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU C (GCC) version 4.5.0 20091220 (experimental) [trunk revision 155368] (i686-pc-linux-gnu) compiled by GNU C version 4.5.0 20091220 (experimental) [trunk revision 155368], GMP version 4.2.4, MPFR version 2.4.1, MPC version 0.8 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 02fd4faf11d3fb405ccd44e93f31b44f COMPILER_PATH=./ LIBRARY_PATH=./:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-B./' '-S' '-v' [hjl@gnu-29 gcc]$ ./xgcc -B./ -S -march=i686 x.i -v Reading specs from ./specs COLLECT_GCC=./xgcc COLLECT_LTO_WRAPPER=./lto-wrapper Target: i686-pc-linux-gnu Configured with: ../src-trunk/configure --enable-clocale=gnu --with-system-zlib --enable-shared --with-demangler-in-ld -with-plugin-ld=ld.gold --enable-gold Thread model: posix gcc version 4.5.0 20091220 (experimental) [trunk revision 155368] (GCC) COLLECT_GCC_OPTIONS='-B./' '-S' '-march=i686' '-v' ./cc1 -fpreprocessed x.i -quiet -dumpbase x.i -march=i686 -auxbase x -version -o x.s GNU C (GCC) version 4.5.0 20091220 (experimental) [trunk revision 155368] (i686-pc-linux-gnu) compiled by GNU C version 4.5.0 20091220 (experimental) [trunk revision 155368], GMP version 4.2.4, MPFR version 2.4.1, MPC version 0.8 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU C (GCC) version 4.5.0 20091220 (experimental) [trunk revision 155368] (i686-pc-linux-gnu) compiled by GNU C version 4.5.0 20091220 (experimental) [trunk revision 155368], GMP version 4.2.4, MPFR version 2.4.1, MPC version 0.8 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 02fd4faf11d3fb405ccd44e93f31b44f COMPILER_PATH=./ LIBRARY_PATH=./:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-B./' '-S' '-march=i686' '-v' [hjl@gnu-29 gcc]$
This bug causes <http://gcc.gnu.org/ml/gcc-help/2010-11/msg00291.html>.
Joseph, can the new driver framework fix it?
I know nothing about what the issue is supposed to be here or what is or is not supposed to be in COLLECT_GCC_OPTIONS or how COLLECT_GCC_OPTIONS is used.
(In reply to comment #3) > I know nothing about what the issue is supposed to be here or what is or > is not supposed to be in COLLECT_GCC_OPTIONS or how COLLECT_GCC_OPTIONS is > used. We have several issues: 1. COLLECT_GCC_OPTIONS is used by LTO. 2. GCC driver knows -march=native. 3. Compilers, cc1/cc1plus, ... don't know -march=native. GCC driver translates -march=native to something cc1/cc1plus knows. Since -march=native isn't saved in COLLECT_GCC_OPTIONS, LTO doesn't work with -march=native. If -march=native handling is moved from GCC driver to cc1/cc1plus, this issue can be solved very easily.
On Thu, 6 Jan 2011, hjl.tools at gmail dot com wrote: > GCC driver translates -march=native to something cc1/cc1plus > knows. Since -march=native isn't saved in COLLECT_GCC_OPTIONS, > LTO doesn't work with -march=native. If -march=native handling > is moved from GCC driver to cc1/cc1plus, this issue can be solved > very easily. It's deliberate that -march=native is in the driver so that the output of "gcc -v" shows the particular options it chose. Maybe COLLECT_GCC_OPTIONS should be saving the options that were generated from -march=native in the driver.
This actually seems an important bug to solve, as -march=native users will otherwise have a bad experience with LTO.
A patch is posted at http://gcc.gnu.org/ml/gcc-patches/2011-01/msg00324.html
Author: hjl Date: Fri Jan 7 20:35:05 2011 New Revision: 168583 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168583 Log: Keep -m[arch|tune]=native in COLLECT_GCC_OPTIONS. 2011-01-07 H.J. Lu <hongjiu.lu@intel.com> PR driver/42445 * gcc.c (%>S): New. (SWITCH_KEEP_FOR_GCC): Likewise. (set_collect_gcc_options): Check SWITCH_KEEP_FOR_GCC. (do_spec_1): Handle "%>". * config/i386/i386.h (CC1_CPU_SPEC): Replace "%<" with "%>". Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.h trunk/gcc/gcc.c
Fixed for 4.6. No plan for backport.