-O2 comes from the default options in build/soong/cc/config/global.go -Os comes from external/v8/Android.v8common.mk that overrides those defaults
For most options, the last one takes effect. An exception is options that accumulate such as -I directories. On Friday, November 9, 2018 at 7:27:47 AM UTC-8, Muhui Jiang wrote: > > Hi > > I download the source code (PR2.180905.006.A1 android-9.0.0_r8). > > I set the compile target as aosp_arm-eng. Then I use make showcommands to > try to dig the detail flags used for compiling. > > I am curious about the optimization level. For example, Below is one > command generated. > > 2629 [ 0% 619/77386] /bin/bash -c "PWD=/proc/self/cwd > prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++ -I > external/v8/src -I external/v8 -I > out/host/linux-x86/obj/STATIC_LIBRARIES/libv8base_intermediates -I > out/host/linux-x86/gen/STATIC_LIBRARIES/libv8base_intermediates -I > libnativehelper/include_jni \$(cat > out/host/linux-x86/obj/STATIC_LIBRARIES/libv8base_intermediates/import_includes) > > -I system/core/include -I system/media/audio/include -I > hardware/libhardware/include -I hardware/libhardware_legacy/include -I > hardware/ril/include -I libnativehelper/include -I > frameworks/native/include -I frameworks/native/opengl/include -I > frameworks/av/include -c -Wa,--noexecstack -fPIC -U_FORTIFY_SOURCE > -D_FORTIFY_SOURCE=2 -fstack-protector -D__STDC_FORMAT_MACROS > -D__STDC_CONSTANT_MACROS > --gcc-toolchain=prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8 > --sysroot prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot > -fstack-protector-strong -m64 -DANDROID -fmessage-length=0 -W -Wall > -Wno-unused -Winit-self -Wpointer-arith -no-canonical-prefixes -DNDEBUG > -UDEBUG -fno-exceptions -Wno-multichar -O2 -g -fno-strict-aliasing > -fdebug-prefix-map=/proc/self/cwd= -D__compiler_offsetof=__builtin_offsetof > -Werror=int-conversion -Wno-reserved-id-macro -Wno-format-pedantic > -Wno-unused-command-line-argument -fcolor-diagnostics > -Wno-expansion-to-defined -Wno-zero-as-null-pointer-constant > -fdebug-prefix-map=\$PWD/= -target x86_64-linux-gnu > -Bprebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin > -Wsign-promo -Wno-inconsistent-missing-override -Wno-null-dereference > -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -Wno-thread-safety-negative > -Wno-gnu-include-next -isystem > prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/include/c++/4.8 > > -isystem > prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/include/c++/4.8/backward > > -isystem > prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/include/c++/4.8/x86_64-linux > > -std=gnu++14 -Wall -Werror -Wno-endif-labels -Wno-import -Wno-format > -Wno-unused-parameter -Wno-unused-private-field -Wno-sign-compare > -Wno-missing-field-initializers -Wno-ignored-qualifiers > -Wno-undefined-var-template -fno-exceptions -fvisibility=hidden > -DENABLE_DEBUGGER_SUPPORT -DENABLE_LOGGING_AND_PROFILING > -DENABLE_VMSTATE_TRACKING -DV8_NATIVE_REGEXP -DV8_I18N_SUPPORT -std=gnu++0x > -Os -fPIC -DV8_TARGET_ARCH_X64 -D_USING_LIBCXX -nostdinc++ > -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast > -Werror=address-of-temporary -Werror=return-type > -Wno-tautological-constant-compare -Wno-null-pointer-arithmetic > -Wno-enum-compare -Wno-enum-compare-switch -MD -MF > out/host/linux-x86/obj/STATIC_LIBRARIES/libv8base_intermediates/src/base/file-utils..d > > -o > out/host/linux-x86/obj/STATIC_LIBRARIES/libv8base_intermediates/src/base/file-utils..o > > external/v8/src/base/file-utils.cc" > > As you can see, there are two optimization flags. I highlighted it. My > question is what is the optimization level. O2 or Os? Or they have > different meanings? Many Thanks > > Regards > Muhui > -- -- You received this message because you are subscribed to the "Android Building" mailing list. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-building?hl=en --- You received this message because you are subscribed to the Google Groups "Android Building" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
