Skip to content

Commit

Permalink
[Tizen] Temporarily cherrypick 449c49e
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-simmons authored and swift-kim committed Nov 3, 2022
1 parent 7ab4d7a commit 70c0191
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 1 deletion.
1 change: 1 addition & 0 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -1888,6 +1888,7 @@ FILE: ../../../flutter/shell/platform/embedder/embedder.cc
FILE: ../../../flutter/shell/platform/embedder/embedder.h
FILE: ../../../flutter/shell/platform/embedder/embedder_engine.cc
FILE: ../../../flutter/shell/platform/embedder/embedder_engine.h
FILE: ../../../flutter/shell/platform/embedder/embedder_exports.lst
FILE: ../../../flutter/shell/platform/embedder/embedder_external_texture_gl.cc
FILE: ../../../flutter/shell/platform/embedder/embedder_external_texture_gl.h
FILE: ../../../flutter/shell/platform/embedder/embedder_external_texture_metal.h
Expand Down
6 changes: 5 additions & 1 deletion shell/platform/embedder/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,12 @@ shared_library("flutter_engine_library") {

output_name = "flutter_engine"

ldflags = []
if (is_mac && !embedder_for_target) {
ldflags = [ "-Wl,-install_name,@rpath/FlutterEmbedder.framework/$_framework_binary_subpath" ]
ldflags += [ "-Wl,-install_name,@rpath/FlutterEmbedder.framework/$_framework_binary_subpath" ]
}
if (is_linux) {
ldflags += [ "-Wl,--version-script=" + rebase_path("embedder_exports.lst") ]
}

deps = [ ":embedder" ]
Expand Down
17 changes: 17 additions & 0 deletions shell/platform/embedder/embedder_exports.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Linker script that exports the minimal symbols required for the embedder library

{
global:
Flutter*;
__Flutter*;
kDartIsolateSnapshotData;
kDartIsolateSnapshotInstructions;
kDartVmSnapshotData;
kDartVmSnapshotInstructions;
local:
*;
};
42 changes: 42 additions & 0 deletions testing/symbols/verify_exported.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,15 @@ void main(List<String> arguments) {
.where((String s) => s.startsWith('ios_'));
final Iterable<String> androidReleaseBuilds = releaseBuilds
.where((String s) => s.startsWith('android_'));
final Iterable<String> hostReleaseBuilds = releaseBuilds
.where((String s) => s.startsWith('host_'));

int failures = 0;
failures += _checkIos(outPath, nmPath, iosReleaseBuilds);
failures += _checkAndroid(outPath, nmPath, androidReleaseBuilds);
if (Platform.isLinux) {
failures += _checkLinux(outPath, nmPath, hostReleaseBuilds);
}
print('Failing checks: $failures');
exit(failures);
}
Expand Down Expand Up @@ -237,6 +242,40 @@ int _checkAndroid(String outPath, String nmPath, Iterable<String> builds) {
return failures;
}

int _checkLinux(String outPath, String nmPath, Iterable<String> builds) {
int failures = 0;
for (final String build in builds) {
final String libFlutter = p.join(outPath, build, 'libflutter_engine.so');
if (!File(libFlutter).existsSync()) {
print('SKIPPING: $libFlutter does not exist.');
continue;
}
final ProcessResult nmResult = Process.runSync(nmPath, <String>['-gUD', libFlutter]);
if (nmResult.exitCode != 0) {
print('ERROR: failed to execute "nm -gUD $libFlutter":\n${nmResult.stderr}');
failures++;
continue;
}
final List<NmEntry> entries = NmEntry.parse(nmResult.stdout as String).toList();
for (final NmEntry entry in entries) {
if (entry.type != 'T' && entry.type != 'R') {
print('ERROR: $libFlutter exports an unexpected symbol type: ($entry)');
print(' Library has $entries.');
failures++;
break;
}
if (!(entry.name.startsWith('Flutter')
|| entry.name.startsWith('__Flutter'))) {
print('ERROR: $libFlutter exports an unexpected symbol name: ($entry)');
print(' Library has $entries.');
failures++;
break;
}
}
}
return failures;
}

class NmEntry {
NmEntry._(this.address, this.type, this.name);

Expand All @@ -250,4 +289,7 @@ class NmEntry {
return NmEntry._(parts[0], parts[1], parts.last);
});
}

@override
String toString() => '$name: $type';
}

0 comments on commit 70c0191

Please sign in to comment.