diff options
-rw-r--r-- | buildrun.cxx | 6 | ||||
-rw-r--r-- | main.cxx | 4 | ||||
-rw-r--r-- | stap.1.in | 3 | ||||
-rw-r--r-- | testsuite/systemtap.base/cache.exp | 5 |
4 files changed, 13 insertions, 5 deletions
diff --git a/buildrun.cxx b/buildrun.cxx index b54a0534..9cc9d98a 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -187,6 +187,12 @@ compile_pass (systemtap_session& s) // if (s.keep_tmpdir) // o << "CFLAGS += -fverbose-asm -save-temps" << endl; + // 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 + + // Allow user to override default optimization when so requested. + // Last -OX wins. o << "EXTRA_CFLAGS += " << s.gcc_flags << endl; // Add -O[0123s] // o << "CFLAGS += -fno-unit-at-a-time" << endl; @@ -118,7 +118,7 @@ usage (systemtap_session& s, int exitcode) << " -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 + << " Default is the kernel opt-level default (-O2 or -Os)." << 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 @@ -411,7 +411,7 @@ main (int argc, char * const argv []) s.ignore_dwarf = false; s.load_only = false; s.skip_badvars = false; - s.gcc_flags = "-O0"; + s.gcc_flags = ""; // Default to kernel opt-level. // Location of our signing certificate. // If we're root, use the database in SYSCONFDIR, otherwise @@ -188,7 +188,8 @@ 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. +like -O2 but tuned for small code size. Default is the kernel opt-level +default (-O2 or -Os). .TP .BI \-c " CMD" Start the probes, run CMD, and exit when CMD finishes. diff --git a/testsuite/systemtap.base/cache.exp b/testsuite/systemtap.base/cache.exp index e70f3334..8b4cb4e6 100644 --- a/testsuite/systemtap.base/cache.exp +++ b/testsuite/systemtap.base/cache.exp @@ -105,10 +105,11 @@ 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 +stap_compile OPTZERO [F_UNCACHED_COMPILE] $basic_script1 -O0 # -O is an alias for -O1, so already cached stap_compile OPTONE [F_CACHED_COMPILE] $basic_script1 -O1 +# Either -O2 or -Os could be the kernel opt-level default, +# so don't assume either is already there. 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 |