I was building Spec 2006 with a powerpc64-linux cross compiler using the -save-temps option so that I could do some analysis on the generated code. Unfortunately, if I use -j4 in the make for the spec build, the test cactusADM does not build. I traced this down to there were several Startup.c files in different directories, and the spec make uses -o to put the resulting objects in different directories: <gcc>/gcc <flags> -o PUGH/Startup.o PUGH/Startup.c <gcc>/gcc <flags> -o IOUtil/Startup.o IOUtil/Startup.c <gcc>/gcc <flags> -o BenchADMsrc/Startup.o BenchADMsrc/Startup.c <gcc>/gcc <flags> -o CartGrid3D/Startup.o CartGrid3D/Startup.c ... As luck would have it, make decided to compile several of of the Startup.c's at the same time, and since they wrote the files in the current directory, they overwrote each other, and the assembler complained about illegal input.
Here at Sony we added -save-temps-o option which does this.
Subject: Re: New: -save-temps does not follow the -o option and instead puts the temp file in the current directory I've also found this to be a pain when working on glibc, where compilation commands are run from subdirectories of the source directory so using -save-temps causes the temporary files to be put in the source directory, after which the glibc build system can end up using them for future builds in preference to the actual source files.
Created attachment 17374 [details] This patch fixes -save-temps so that it puts the temp file in the output directory rather than the current directory
Subject: Bug 39293 Author: meissner Date: Thu Apr 2 20:45:26 2009 New Revision: 145470 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145470 Log: [PATCH, committed] Add -save-temps=obj, PR 39293 Modified: trunk/gcc/ChangeLog trunk/gcc/doc/invoke.texi trunk/gcc/gcc.c
Fixed for 4.5.