This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Build compiler checksum from object files


On Thursday 07 October 2010 13:26:25, Andi Kleen wrote:

> -dummy-checksum.o : dummy-checksum.c $(CONFIG_H) $(SYSTEM_H)
> +.PHONY: checksum-options
>  
> -cc1-dummy$(exeext): $(C_OBJS) dummy-checksum.o $(BACKEND) $(LIBDEPS)
> -	+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) \
> -	  dummy-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
> +checksum-options:
> +	echo "$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS)" > checksum-options

I guess this could write to a temporary and do move-if-change.

>  
> -cc1-checksum.c : cc1-dummy$(exeext) build/genchecksum$(build_exeext)
> -	build/genchecksum$(build_exeext) cc1-dummy$(exeext) > $@
> +# compute checksum over all object files and the options
> +cc1-checksum.c : build/genchecksum$(build_exeext) checksum-options \
> +	$(C_OBJS) $(BACKEND) $(LIBDEPS) 
> +	build/genchecksum$(build_exeext) $(C_OBJS) $(BACKEND) $(LIBDEPS) \
> +                     checksum-options > $@

and so you could remove the .PHONY above, so that this isn't rebuilt
everytime, and so that cc1 isn't relinked everytime, even if nothing
changed.

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]