diff --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn --- a/llvm/utils/gn/build/BUILD.gn +++ b/llvm/utils/gn/build/BUILD.gn @@ -24,6 +24,9 @@ # The version of host gcc. Ignored if is_clang is true. gcc_version = 9 + + propellor_phase = 0 + propellor_profile_dir = "" } assert(!llvm_build_instrumented_coverage || is_clang, @@ -45,6 +48,23 @@ cflags_cc = [] ldflags = target_flags + target_ldflags + if (propellor_phase == 1) { + cflags += [ + "-funique-internal-linkage-names", + "-fbasic-block-sections=labels", + ] + } else if (propellor_phase == 2) { + assert(propellor_profile_dir != "", "") + cflags += [ + "-funique-internal-linkage-names", + "-fbasic-block-sections=list=" + propellor_profile_dir + "/cluster.txt", + ] + ldflags += [ + "-Wl,--symbol-ordering-file=" + propellor_profile_dir + "/symorder.txt", + "-Wl,--no-warn-symbol-ordering", + ] + } + # Mostly for compiler-rt, see compiler-rt/cmake/config-ix.cmake if (current_os == "ios") { asmflags += [ "-miphoneos-version-min=8.0" ]