Skip to content

Commit 70c0191

Browse files
jason-simmonsswift-kim
authored andcommitted
[Tizen] Temporarily cherrypick 449c49e
1 parent 7ab4d7a commit 70c0191

File tree

4 files changed

+65
-1
lines changed

4 files changed

+65
-1
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,6 +1888,7 @@ FILE: ../../../flutter/shell/platform/embedder/embedder.cc
18881888
FILE: ../../../flutter/shell/platform/embedder/embedder.h
18891889
FILE: ../../../flutter/shell/platform/embedder/embedder_engine.cc
18901890
FILE: ../../../flutter/shell/platform/embedder/embedder_engine.h
1891+
FILE: ../../../flutter/shell/platform/embedder/embedder_exports.lst
18911892
FILE: ../../../flutter/shell/platform/embedder/embedder_external_texture_gl.cc
18921893
FILE: ../../../flutter/shell/platform/embedder/embedder_external_texture_gl.h
18931894
FILE: ../../../flutter/shell/platform/embedder/embedder_external_texture_metal.h

shell/platform/embedder/BUILD.gn

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,12 @@ shared_library("flutter_engine_library") {
369369

370370
output_name = "flutter_engine"
371371

372+
ldflags = []
372373
if (is_mac && !embedder_for_target) {
373-
ldflags = [ "-Wl,-install_name,@rpath/FlutterEmbedder.framework/$_framework_binary_subpath" ]
374+
ldflags += [ "-Wl,-install_name,@rpath/FlutterEmbedder.framework/$_framework_binary_subpath" ]
375+
}
376+
if (is_linux) {
377+
ldflags += [ "-Wl,--version-script=" + rebase_path("embedder_exports.lst") ]
374378
}
375379

376380
deps = [ ":embedder" ]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2013 The Flutter Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
# Linker script that exports the minimal symbols required for the embedder library
6+
7+
{
8+
global:
9+
Flutter*;
10+
__Flutter*;
11+
kDartIsolateSnapshotData;
12+
kDartIsolateSnapshotInstructions;
13+
kDartVmSnapshotData;
14+
kDartVmSnapshotInstructions;
15+
local:
16+
*;
17+
};

testing/symbols/verify_exported.dart

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,15 @@ void main(List<String> arguments) {
5757
.where((String s) => s.startsWith('ios_'));
5858
final Iterable<String> androidReleaseBuilds = releaseBuilds
5959
.where((String s) => s.startsWith('android_'));
60+
final Iterable<String> hostReleaseBuilds = releaseBuilds
61+
.where((String s) => s.startsWith('host_'));
6062

6163
int failures = 0;
6264
failures += _checkIos(outPath, nmPath, iosReleaseBuilds);
6365
failures += _checkAndroid(outPath, nmPath, androidReleaseBuilds);
66+
if (Platform.isLinux) {
67+
failures += _checkLinux(outPath, nmPath, hostReleaseBuilds);
68+
}
6469
print('Failing checks: $failures');
6570
exit(failures);
6671
}
@@ -237,6 +242,40 @@ int _checkAndroid(String outPath, String nmPath, Iterable<String> builds) {
237242
return failures;
238243
}
239244

245+
int _checkLinux(String outPath, String nmPath, Iterable<String> builds) {
246+
int failures = 0;
247+
for (final String build in builds) {
248+
final String libFlutter = p.join(outPath, build, 'libflutter_engine.so');
249+
if (!File(libFlutter).existsSync()) {
250+
print('SKIPPING: $libFlutter does not exist.');
251+
continue;
252+
}
253+
final ProcessResult nmResult = Process.runSync(nmPath, <String>['-gUD', libFlutter]);
254+
if (nmResult.exitCode != 0) {
255+
print('ERROR: failed to execute "nm -gUD $libFlutter":\n${nmResult.stderr}');
256+
failures++;
257+
continue;
258+
}
259+
final List<NmEntry> entries = NmEntry.parse(nmResult.stdout as String).toList();
260+
for (final NmEntry entry in entries) {
261+
if (entry.type != 'T' && entry.type != 'R') {
262+
print('ERROR: $libFlutter exports an unexpected symbol type: ($entry)');
263+
print(' Library has $entries.');
264+
failures++;
265+
break;
266+
}
267+
if (!(entry.name.startsWith('Flutter')
268+
|| entry.name.startsWith('__Flutter'))) {
269+
print('ERROR: $libFlutter exports an unexpected symbol name: ($entry)');
270+
print(' Library has $entries.');
271+
failures++;
272+
break;
273+
}
274+
}
275+
}
276+
return failures;
277+
}
278+
240279
class NmEntry {
241280
NmEntry._(this.address, this.type, this.name);
242281

@@ -250,4 +289,7 @@ class NmEntry {
250289
return NmEntry._(parts[0], parts[1], parts.last);
251290
});
252291
}
292+
293+
@override
294+
String toString() => '$name: $type';
253295
}

0 commit comments

Comments
 (0)