diff --git a/BUILD.gn b/BUILD.gn index 6e48015b1d769..8f4243d4b9936 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -73,6 +73,15 @@ config("config") { include_dirs = [ ".." ] } +config("export_dynamic_symbols") { + if (is_linux) { + inputs = [ + "$flutter_root/common/exported_symbols.sym", + ] + ldflags = [ "-Wl,--dynamic-list=" + rebase_path(inputs[0], root_build_dir) ] + } +} + group("dist") { testonly = true diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index f3cdba51fc5b8..45b8e7d63b61e 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -50,6 +50,7 @@ FILE: ../../../flutter/assets/zip_asset_store.cc FILE: ../../../flutter/assets/zip_asset_store.h FILE: ../../../flutter/benchmarking/benchmarking.cc FILE: ../../../flutter/benchmarking/benchmarking.h +FILE: ../../../flutter/common/exported_symbols.sym FILE: ../../../flutter/common/settings.cc FILE: ../../../flutter/common/settings.h FILE: ../../../flutter/common/task_runners.cc diff --git a/common/exported_symbols.sym b/common/exported_symbols.sym new file mode 100644 index 0000000000000..d85c253e3c07b --- /dev/null +++ b/common/exported_symbols.sym @@ -0,0 +1,8 @@ +# These symbols are looked up from within the executable at runtime and must +# be exported in the dynamic symbol table. +{ + kDartVmSnapshotData; + kDartVmSnapshotInstructions; + kDartIsolateSnapshotData; + kDartIsolateSnapshotInstructions; +}; diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index 96de6356e23e8..11affdaaf28cc 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -126,6 +126,8 @@ source_set("runtime_unittests_common") { executable("runtime_unittests") { testonly = true + configs += [ "$flutter_root:export_dynamic_symbols" ] + sources = [ "dart_isolate_unittests.cc", "dart_lifecycle_unittests.cc", @@ -136,8 +138,4 @@ executable("runtime_unittests") { deps = [ ":runtime_unittests_common", ] - - if (is_linux) { - ldflags = [ "-rdynamic" ] - } } diff --git a/shell/common/BUILD.gn b/shell/common/BUILD.gn index 9df00c6ea0e18..27fca16561896 100644 --- a/shell/common/BUILD.gn +++ b/shell/common/BUILD.gn @@ -135,9 +135,7 @@ template("shell_host_executable") { "//third_party/tonic", ] - if (is_linux) { - ldflags += [ "-rdynamic" ] - } + public_configs = [ "$flutter_root:export_dynamic_symbols" ] } } diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn index 41b8d25674c2b..a1519da001fee 100644 --- a/shell/platform/embedder/BUILD.gn +++ b/shell/platform/embedder/BUILD.gn @@ -63,6 +63,8 @@ test_fixtures("fixtures") { executable("embedder_unittests") { testonly = true + configs += [ "$flutter_root:export_dynamic_symbols" ] + include_dirs = [ "." ] sources = [ @@ -85,10 +87,6 @@ executable("embedder_unittests") { "//third_party/skia", "//third_party/tonic", ] - - if (is_linux) { - ldflags = [ "-rdynamic" ] - } } shared_library("flutter_engine_library") { diff --git a/shell/testing/BUILD.gn b/shell/testing/BUILD.gn index c8bf964540181..9e741ef165d06 100644 --- a/shell/testing/BUILD.gn +++ b/shell/testing/BUILD.gn @@ -9,7 +9,10 @@ executable("testing") { output_name = "flutter_tester" - public_configs = [ "$flutter_root:config" ] + public_configs = [ + "$flutter_root:config", + "$flutter_root:export_dynamic_symbols", + ] sources = [ "tester_main.cc", @@ -34,8 +37,4 @@ executable("testing") { "//zircon/public/lib/trace-provider", ] } - - if (is_linux) { - ldflags = [ "-rdynamic" ] - } }