Skip to content

Commit ecd7977

Browse files
rmacnak-googlecommit-bot@chromium.org
authored andcommitted
[vm] Fix gcc build.
Change-Id: I8a0a9a695403dc6d048dccb9f33642d70cc5d588 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121866 Reviewed-by: Liam Appelbe <liama@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
1 parent 411bd62 commit ecd7977

22 files changed

+102
-71
lines changed

build/config/linux/BUILD.gn

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,21 @@
55
import("//build/config/sysroot.gni")
66

77
config("sdk") {
8-
# Don't allow visible symbols from libc++ to be re-exported.
9-
ldflags = [
10-
"-nodefaultlibs",
11-
"-lc++",
12-
"-lc",
13-
"-lm",
14-
"-lpthread",
15-
"-lclang_rt.builtins",
16-
"-Wl,--exclude-libs=libc++.a",
17-
]
8+
ldflags = []
189

1910
if (is_asan || is_lsan || is_msan || is_tsan || is_ubsan) {
2011
ldflags += [ "-lrt" ]
12+
} else if (is_clang) {
13+
# Don't allow visible symbols from libc++ to be re-exported.
14+
ldflags = [
15+
"-nodefaultlibs",
16+
"-lc++",
17+
"-lc",
18+
"-lm",
19+
"-lpthread",
20+
"-lclang_rt.builtins",
21+
"-Wl,--exclude-libs=libc++.a",
22+
]
2123
}
2224

2325
if (sysroot != "") {

runtime/BUILD.gn

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ config("dart_config") {
168168
"-fno-exceptions",
169169
"-Wimplicit-fallthrough",
170170
]
171+
if (!is_clang) {
172+
cflags += [ "-Wno-cast-function-type" ]
173+
}
171174

172175
ldflags = []
173176
if (is_clang && dart_vm_code_coverage) {

runtime/bin/ffi_test/ffi_test_functions.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
#include <unistd.h>
1717

1818
// Only OK to use here because this is test code.
19+
#include <condition_variable> // NOLINT(build/c++11)
20+
#include <functional> // NOLINT(build/c++11)
21+
#include <mutex> // NOLINT(build/c++11)
1922
#include <thread> // NOLINT(build/c++11)
2023
#endif
2124

runtime/vm/class_table.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,12 @@ void SharedClassTable::Grow(intptr_t new_capacity) {
252252
memmove(new_table, table_, top_ * sizeof(intptr_t));
253253
memset(new_table + top_, 0, (new_capacity - top_) * sizeof(intptr_t));
254254
#ifndef PRODUCT
255-
auto new_stats_table = static_cast<ClassHeapStats*>(
256-
realloc(class_heap_stats_table_,
257-
new_capacity * sizeof(ClassHeapStats))); // NOLINT
255+
auto new_stats_table = reinterpret_cast<ClassHeapStats*>(
256+
malloc(new_capacity * sizeof(ClassHeapStats)));
257+
for (intptr_t i = 0; i < capacity_; i++) {
258+
new_stats_table[i] = class_heap_stats_table_[i];
259+
}
260+
free(class_heap_stats_table_);
258261
#endif
259262
for (intptr_t i = capacity_; i < new_capacity; i++) {
260263
new_table[i] = 0;

runtime/vm/compiler/aot/precompiler.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,13 +2274,12 @@ void PrecompileParsedFunctionHelper::FinalizeCompilation(
22742274
// to install code.
22752275
bool PrecompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
22762276
ASSERT(FLAG_precompiled_mode);
2277-
const Function& function = parsed_function()->function();
2278-
if (optimized() && !function.IsOptimizable()) {
2277+
if (optimized() && !parsed_function()->function().IsOptimizable()) {
22792278
// All functions compiled by precompiler must be optimizable.
22802279
UNREACHABLE();
22812280
return false;
22822281
}
2283-
bool is_compiled = false;
2282+
volatile bool is_compiled = false;
22842283
Zone* const zone = thread()->zone();
22852284
HANDLESCOPE(thread());
22862285

@@ -2301,6 +2300,7 @@ bool PrecompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
23012300
if (val == 0) {
23022301
FlowGraph* flow_graph = nullptr;
23032302
ZoneGrowableArray<const ICData*>* ic_data_array = nullptr;
2303+
const Function& function = parsed_function()->function();
23042304

23052305
CompilerState compiler_state(thread());
23062306

@@ -2314,7 +2314,7 @@ bool PrecompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
23142314
}
23152315

23162316
if (optimized()) {
2317-
flow_graph->PopulateWithICData(parsed_function()->function());
2317+
flow_graph->PopulateWithICData(function);
23182318
}
23192319

23202320
const bool print_flow_graph =

runtime/vm/compiler/backend/flow_graph_compiler.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2270,7 +2270,7 @@ void FlowGraphCompiler::GenerateCidRangesCheck(
22702270

22712271
int bias = 0;
22722272
for (intptr_t i = 0; i < cid_ranges.length(); ++i) {
2273-
const CidRange& range = cid_ranges[i];
2273+
const CidRangeValue& range = cid_ranges[i];
22742274
RELEASE_ASSERT(!range.IsIllegalRange());
22752275
const bool last_round = i == (cid_ranges.length() - 1);
22762276

runtime/vm/compiler/backend/flow_graph_compiler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ class FlowGraphCompiler : public ValueObject {
872872
static int EmitTestAndCallCheckCid(compiler::Assembler* assembler,
873873
compiler::Label* label,
874874
Register class_id_reg,
875-
const CidRange& range,
875+
const CidRangeValue& range,
876876
int bias,
877877
bool jump_on_miss = true);
878878

runtime/vm/compiler/backend/flow_graph_compiler_arm.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ void FlowGraphCompiler::EmitTestAndCallLoadCid(Register class_id_reg) {
13301330
int FlowGraphCompiler::EmitTestAndCallCheckCid(compiler::Assembler* assembler,
13311331
compiler::Label* label,
13321332
Register class_id_reg,
1333-
const CidRange& range,
1333+
const CidRangeValue& range,
13341334
int bias,
13351335
bool jump_on_miss) {
13361336
intptr_t cid_start = range.cid_start;

runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,7 @@ void FlowGraphCompiler::EmitTestAndCallLoadCid(Register class_id_reg) {
12971297
int FlowGraphCompiler::EmitTestAndCallCheckCid(compiler::Assembler* assembler,
12981298
compiler::Label* label,
12991299
Register class_id_reg,
1300-
const CidRange& range,
1300+
const CidRangeValue& range,
13011301
int bias,
13021302
bool jump_on_miss) {
13031303
const intptr_t cid_start = range.cid_start;

runtime/vm/compiler/backend/flow_graph_compiler_ia32.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ void FlowGraphCompiler::EmitTestAndCallLoadCid(Register class_id_reg) {
11851185
int FlowGraphCompiler::EmitTestAndCallCheckCid(compiler::Assembler* assembler,
11861186
compiler::Label* label,
11871187
Register class_id_reg,
1188-
const CidRange& range,
1188+
const CidRangeValue& range,
11891189
int bias,
11901190
bool jump_on_miss) {
11911191
intptr_t cid_start = range.cid_start;

0 commit comments

Comments
 (0)