From c3c478ec699bba863bd422292277bb984f506d1a Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Tue, 24 Jan 2017 18:26:21 -0800 Subject: [PATCH] Snapshots: Don't use an empty array where a NULL array is expected. (flutter/engine#3361) Fixes dart-lang/sdk#28504 --- .../src/flutter/lib/snapshot/snapshot.c.tmpl | 20 +++++++++++-------- engine/src/flutter/runtime/dart_init.h | 2 +- engine/src/flutter/snapshotter/main.cc | 8 ++++---- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/engine/src/flutter/lib/snapshot/snapshot.c.tmpl b/engine/src/flutter/lib/snapshot/snapshot.c.tmpl index 52ed833d1b..b9d62a0310 100644 --- a/engine/src/flutter/lib/snapshot/snapshot.c.tmpl +++ b/engine/src/flutter/lib/snapshot/snapshot.c.tmpl @@ -10,16 +10,20 @@ // generated snapshot binary file for the vm isolate. // This string forms the content of the dart vm isolate snapshot which // is loaded into the vm isolate. -const uint8_t kDartVmSnapshotData[] - __attribute__((visibility("default"), aligned(8), used)) = { %s }; -const uint8_t kDartVmSnapshotInstructions[] - __attribute__((visibility("default"), aligned(8), used)) = {}; +static const uint8_t kDartVmSnapshotData_[] + __attribute__((aligned(8))) = { %s }; +const uint8_t* kDartVmSnapshotData + __attribute__((visibility("default"), used)) = kDartVmSnapshotData_; +const uint8_t* kDartVmSnapshotInstructions + __attribute__((visibility("default"), used)) = NULL; // The string on the next line will be filled in with the contents of the // generated snapshot binary file for a regular dart isolate. // This string forms the content of a regular dart isolate snapshot which // is loaded into an isolate when it is created. -const uint8_t kDartIsolateSnapshotData[] - __attribute__((visibility("default"), aligned(8), used)) = { %s }; -const uint8_t kDartIsolateSnapshotInstructions[] - __attribute__((visibility("default"), aligned(8), used)) = {}; +static const uint8_t kDartIsolateSnapshotData_[] + __attribute__((aligned(8))) = { %s }; +const uint8_t* kDartIsolateSnapshotData + __attribute__((visibility("default"), used)) = kDartIsolateSnapshotData_; +const uint8_t* kDartIsolateSnapshotInstructions + __attribute__((visibility("default"), used)) = NULL; diff --git a/engine/src/flutter/runtime/dart_init.h b/engine/src/flutter/runtime/dart_init.h index c3e1bac842..d1e187dade 100644 --- a/engine/src/flutter/runtime/dart_init.h +++ b/engine/src/flutter/runtime/dart_init.h @@ -36,7 +36,7 @@ extern void* kDartIsolateSnapshotData; extern void* kDartIsolateSnapshotInstructions; } -#define DART_SYMBOL(symbol) (&symbol) +#define DART_SYMBOL(symbol) (symbol) #endif // DART_ALLOW_DYNAMIC_RESOLUTION diff --git a/engine/src/flutter/snapshotter/main.cc b/engine/src/flutter/snapshotter/main.cc index a981fafd76..e43720d405 100644 --- a/engine/src/flutter/snapshotter/main.cc +++ b/engine/src/flutter/snapshotter/main.cc @@ -24,10 +24,10 @@ #include "lib/tonic/file_loader/file_loader.h" extern "C" { -extern const uint8_t kDartVmSnapshotData[]; -extern const uint8_t kDartVmSnapshotInstructions[]; -extern const uint8_t kDartIsolateSnapshotData[]; -extern const uint8_t kDartIsolateSnapshotInstructions[]; +extern const uint8_t* kDartVmSnapshotData; +extern const uint8_t* kDartVmSnapshotInstructions; +extern const uint8_t* kDartIsolateSnapshotData; +extern const uint8_t* kDartIsolateSnapshotInstructions; } namespace {