From df642abc046981dfea4020a80f466a1acc7607ca Mon Sep 17 00:00:00 2001 From: zrj Date: Wed, 20 Mar 2019 08:08:06 +0200 Subject: [PATCH] gcc80: Add local -save-temps=objects option. The gcc currently supports -save-temps= cwd, obj, object(not documented). None of those variants can be used at all during buildworld sequence, even at serial buildworld, without interfering with build in funny ways. This is very easy to notice while compiling libraries, where rules are: * foo.c --> foo.o (non-pic) * foo.c --> foo.So (pic) * foo.c --> foo.po (profiled) The added option forces to use full object name (if it was supplied) when constructing names for .s and .i intermediates, as follows: cc -c foo.c -o foo.o --> foo.o.s + foo.o.i This allows to use -save-temps globally during buildworld and it is *less* likely to interfere while producing normally created objects. Repeated quickworld likely *will* have side effects, because the '-o' flags are not used for kernel and programs (foo.s will shadow foo.c). Tested by binary comparing /usr/obj trees for differences. --- contrib/gcc-8.0/README.DRAGONFLY | 1 + contrib/gcc-8.0/gcc/gcc.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/contrib/gcc-8.0/README.DRAGONFLY b/contrib/gcc-8.0/README.DRAGONFLY index c274a22c9b..e59b18e8c2 100644 --- a/contrib/gcc-8.0/README.DRAGONFLY +++ b/contrib/gcc-8.0/README.DRAGONFLY @@ -30,6 +30,7 @@ The following files have been patched (* planned) gcc/c-family/c-format.c extra TZ "%+" format for strftime() gcc/config/dragonfly.h default dynamic linker path gcc/gcc.c default paths for base tools + add -save-temps=objects option libbacktrace/fileline.c KERN_PROC_PATHNAME addition libgcc/gthr-posix.h avoid weakref (ld.gold issue) libssp/ssp.c include for alloca() diff --git a/contrib/gcc-8.0/gcc/gcc.c b/contrib/gcc-8.0/gcc/gcc.c index 2d20a17aef..278b9ea685 100644 --- a/contrib/gcc-8.0/gcc/gcc.c +++ b/contrib/gcc-8.0/gcc/gcc.c @@ -266,7 +266,8 @@ static const char *target_sysroot_hdrs_suffix = 0; static enum save_temps { SAVE_TEMPS_NONE, /* no -save-temps */ SAVE_TEMPS_CWD, /* -save-temps in current directory */ - SAVE_TEMPS_OBJ /* -save-temps in object directory */ + SAVE_TEMPS_OBJ, /* -save-temps in object directory */ + SAVE_TEMPS_OBJZ /* -save-temps in object directory with mangling */ } save_temps_flag; /* Output file to use to get the object directory for -save-temps=obj */ @@ -4020,6 +4021,8 @@ driver_handle_option (struct gcc_options *opts, else if (strcmp (arg, "obj") == 0 || strcmp (arg, "object") == 0) save_temps_flag = SAVE_TEMPS_OBJ; + else if (strcmp (arg, "objects") == 0) + save_temps_flag = SAVE_TEMPS_OBJZ; else fatal_error (input_location, "%qs is an unknown -save-temps option", decoded->orig_option_with_args_text); @@ -4520,6 +4523,10 @@ process_command (unsigned int decoded_options_count, } } + else if (save_temps_flag == SAVE_TEMPS_OBJZ && save_temps_prefix != NULL) + { + save_temps_length = strlen (save_temps_prefix); + } else if (save_temps_prefix != NULL) { free (save_temps_prefix); -- 2.41.0