[build] Define DART_SHARED_LIB for elf_loader.cc.

This makes elf_loader.cc consistent with the other compilation units containing Dart_* functions. Addresses a Mac linker warning that these functions match the export glob but have hidden visibility.

TEST=build
Change-Id: I868c9940a7027c466c1173aa2db2fbeff6fe8999
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325362
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
Ryan Macnak 2023-09-12 22:42:38 +00:00 committed by Commit Queue
parent 5c320a108a
commit 3a5a7106ee
2 changed files with 23 additions and 3 deletions

View file

@ -148,6 +148,10 @@ template("build_elf_loader") {
"..:dart_os_fuchsia_config",
]
include_dirs = [ ".." ]
defines = [
# The only effect of DART_SHARED_LIB is to export the Dart API.
"DART_SHARED_LIB",
]
sources = [
"elf_loader.cc",
"elf_loader.h",

View file

@ -3,9 +3,10 @@
// BSD-style license that can be found in the LICENSE file.
import "dart:io";
import "package:expect/expect.dart";
import "use_flag_test_helper.dart";
main() {
if (Platform.isWindows) return;
if (Platform.isAndroid) return; // no nm available on test device
@ -35,7 +36,7 @@ main() {
symbols.remove("_IO_stdin_used"); // Only on IA32 for libc.
print(symbols);
Expect.setEquals(symbols, [
var expectedSymbols = [
"Dart_AddSymbols",
"Dart_Allocate",
"Dart_AllocateWithNativeFields",
@ -334,5 +335,20 @@ main() {
"Dart_WaitForEvent",
"Dart_WriteHeapSnapshot",
"Dart_WriteProfileToTimeline",
]);
];
if (isAOTRuntime) {
expectedSymbols.addAll([
"Dart_LoadELF",
"Dart_LoadELF_Memory",
"Dart_UnloadELF",
]);
if (!Platform.isMacOS) {
expectedSymbols.addAll([
"Dart_LoadELF_Fd",
]);
}
}
Expect.setEquals(expectedSymbols, symbols);
}