diff options
-rw-r--r-- | buildrun.cxx | 11 | ||||
-rw-r--r-- | hash.cxx | 1 | ||||
-rw-r--r-- | main.cxx | 28 | ||||
-rw-r--r-- | session.h | 3 | ||||
-rw-r--r-- | stap.1.in | 7 | ||||
-rw-r--r-- | testsuite/systemtap.base/cache.exp | 15 |
6 files changed, 11 insertions, 54 deletions
diff --git a/buildrun.cxx b/buildrun.cxx index b77eac14..9ebd4796 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -187,7 +187,16 @@ compile_pass (systemtap_session& s) // if (s.keep_tmpdir) // o << "CFLAGS += -fverbose-asm -save-temps" << endl; - o << "EXTRA_CFLAGS += " << s.gcc_flags << endl; // Add -O[0123s] + // Kernels can be compiled with CONFIG_CC_OPTIMIZE_FOR_SIZE to select + // -Os, otherwise -O2 is the default. + o << "EXTRA_CFLAGS += -freorder-blocks" << endl; // improve on -Os + + // We used to allow the user to override default optimization when so + // requested by adding a -O[0123s] so they could determine the + // time/space/speed tradeoffs themselves, but we cannot guantantee that + // the (un)optimized code actually compiles and/or generates functional + // code, so we had to remove it. + // o << "EXTRA_CFLAGS += " << s.gcc_flags << endl; // Add -O[0123s] // o << "CFLAGS += -fno-unit-at-a-time" << endl; @@ -175,7 +175,6 @@ find_script_hash (systemtap_session& s, const string& script, const hash &base) h.add(s.ignore_dwarf); // --ignore-dwarf h.add(s.consult_symtab); // --kelf, --kmap h.add(s.skip_badvars); // --skip-badvars - h.add(s.gcc_flags); // -O[0123s] if (!s.kernel_symtab_path.empty()) // --kmap { h.add(s.kernel_symtab_path); @@ -112,14 +112,6 @@ usage (systemtap_session& s, int exitcode) << " " << s.module_name << endl << " -o FILE send script output to file, instead of stdout. This supports" << endl << " strftime(3) formats for FILE" << endl - << " -O[0123s] optimization to use for C code. Passed to gcc in pass 4." << endl - << " -O Alias for -O1" << endl - << " -O0 Fast compilation" << endl - << " -O1 Optimize, takes a bit more time" << endl - << " -O2 Optimize more, takes more time" << endl - << " -O3 Optimize even more, takes even more time" << endl - << " -Os Optimize for size, like -O2 but tuned for small code size" << endl - << " Default is -O0." << endl << " -c CMD start the probes, run CMD, and exit when it finishes" << endl << " -x PID sets target() to PID" << endl << " -F run as on-file flight recorder with -o." << endl @@ -499,8 +491,6 @@ main (int argc, char * const argv []) s.load_only = false; s.skip_badvars = false; s.unprivileged = false; - s.gcc_flags = "-O0"; - s.unprivileged = false; // Location of our signing certificate. // If we're root, use the database in SYSCONFDIR, otherwise @@ -595,7 +585,7 @@ main (int argc, char * const argv []) { "unprivileged", 0, &long_opt, LONG_OPT_UNPRIVILEGED }, { NULL, 0, NULL, 0 } }; - int grc = getopt_long (argc, argv, "hVMvtp:I:e:o:O::R:r:m:kgPc:x:D:bs:uqwl:d:L:FS:", + int grc = getopt_long (argc, argv, "hVMvtp:I:e:o:R:r:m:kgPc:x:D:bs:uqwl:d:L:FS:", long_options, NULL); if (grc < 0) break; @@ -659,22 +649,6 @@ main (int argc, char * const argv []) s.output_file = string (optarg); break; - case 'O': - if (optarg == NULL) - s.gcc_flags = "-O1"; - else - s.gcc_flags = "-O" + string (optarg); - - if (s.gcc_flags != "-O0" && s.gcc_flags != "-O1" - && s.gcc_flags != "-O2" && s.gcc_flags != "-O3" - && s.gcc_flags != "-Os") - { - cerr << "'" << s.gcc_flags << "'" - << " isn't a valid optimization option." << endl; - usage (s, 1); - } - break; - case 'R': s.runtime_path = string (optarg); break; @@ -136,9 +136,6 @@ struct systemtap_session // Skip bad $ vars bool skip_badvars; - // Optimization flag passed to gcc -O[0123s] - std::string gcc_flags; - // NB: It is very important for all of the above (and below) fields // to be cleared in the systemtap_session ctor (elaborate.cxx) // and/or main.cxx(main). @@ -183,13 +183,6 @@ Send standard output to named file. In bulk mode, percpu files will start with FILE_ (FILE_cpu with -F) followed by the cpu number. This supports strftime(3) formats for FILE. .TP -.BI \-O[0123s] -Optimization to use for C code. Passed to gcc in pass 4. -O is an -alias for -O1, -O0 enables fast compilation, -O1 optimizes the code and -takes a bit more time, -O2 optimizes more and takes more time, -O3 -optimizes even more and takes even more time, -Os optimizes for size, -like -O2 but tuned for small code size. The default is -O0. -.TP .BI \-c " CMD" Start the probes, run CMD, and exit when CMD finishes. .TP diff --git a/testsuite/systemtap.base/cache.exp b/testsuite/systemtap.base/cache.exp index e70f3334..5c5c1441 100644 --- a/testsuite/systemtap.base/cache.exp +++ b/testsuite/systemtap.base/cache.exp @@ -102,21 +102,6 @@ stap_compile MERGE2 [F_CACHED_COMPILE] $basic_script1 -b -M stap_compile TIMING1 [F_UNCACHED_COMPILE] $basic_script1 -t stap_compile TIMING2 [F_CACHED_COMPILE] $basic_script1 -t -# Using '-O[0123s]' (C compile optimizations) should change the hash -# unless they are the same -stap_compile OPTO [F_UNCACHED_COMPILE] $basic_script1 -O -# -O0 is the default, so will have been cached by BASIC1 -stap_compile OPTZERO [F_CACHED_COMPILE] $basic_script1 -O0 -# -O is an alias for -O1, so already cached -stap_compile OPTONE [F_CACHED_COMPILE] $basic_script1 -O1 -stap_compile OPTTWO [F_UNCACHED_COMPILE] $basic_script1 -O2 -stap_compile OPTTHREE [F_UNCACHED_COMPILE] $basic_script1 -O3 -stap_compile OPTSMALL [F_UNCACHED_COMPILE] $basic_script1 -Os -# Bad -O argument should be rejected -stap_compile OPTBAD [F_UNCACHED_NO_COMPILE] $basic_script1 -OX - -stap_compile TIMING2 [F_CACHED_COMPILE] $basic_script1 -t - # Changing the runtime directory should change the hash set new_runtime [exec pwd]/.cache_test_runtime exec /bin/rm -f $new_runtime |