diff --git a/BUILD.gn b/BUILD.gn index 3b03c3791046de8e2318c198c969cf877be217e9..99a516f624010190aa9ed0a281532d45dc73cdbb 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -154,6 +154,23 @@ ohos_shared_library("sqlite") { "openssl:libcrypto_shared", ] } + if (is_ohos && is_clang && enhanced_opt && + (target_cpu == "arm" || target_cpu == "arm64")) { + ldflags += [ "-Wl,-Bsymbolic" ] + if (sqlite_feature_enable_pgo) { + cflags_c += [ + "-fprofile-use=" + + rebase_path("${sqlite_feature_pgo_path}/libsqlite.profdata", + root_build_dir), + "-Wno-error=backend_plugin", + "-Wno-profile-instr-out-of-date", + "-Wno-profile-instr-unprofiled", + ] + if(target_cpu == "arm64" && enable_enhanced_opt) { + ldflags += [ "-Wl,--aarch64-inline-plt" ] + } + } + } } ohos_executable("sqlite3") { diff --git a/bundle.json b/bundle.json index b733d959f77b1571557362debe2efd21b3b2745b..910ada014a9011527946c7684791f67030cfe3da 100644 --- a/bundle.json +++ b/bundle.json @@ -14,7 +14,11 @@ "name": "sqlite", "subsystem": "thirdparty", "syscap": [], - "features": [ "sqlite_support_check_pages" ], + "features": [ + "sqlite_support_check_pages", + "sqlite_feature_enable_pgo", + "sqlite_feature_pgo_path" + ], "adapted_system_type": [ "standard" ], "rom": "2200KB", "ram": "1024KB", diff --git a/sqlite.gni b/sqlite.gni index 0f9c7918f6137ed70f020fea71df20fedf0932ea..e26e4627db8fe9317808360cea59df16f00d1ce6 100644 --- a/sqlite.gni +++ b/sqlite.gni @@ -13,4 +13,6 @@ declare_args() { sqlite_support_check_pages = false + sqlite_feature_enable_pgo = false + sqlite_feature_pgo_path = "" }