Skip to content

Commit 001aa7b

Browse files
riptlripatel-fd
authored andcommitted
config: disable C++ support by default
Introduces a FD_HAS_CXX flag that re-enables it
1 parent 5856f06 commit 001aa7b

File tree

15 files changed

+31
-10
lines changed

15 files changed

+31
-10
lines changed

config/base.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ LD?=$(CXX)
3535
LLVM_COV?=llvm-cov
3636
LLVM_PROFDATA?=llvm-profdata
3737

38+
# C++ support (libstdc++ and default exception handler)
39+
#FD_HAS_CXX:=1
40+
3841
# Rust
3942
RUST_PROFILE=debug
4043

config/extra/with-clang.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,3 @@ CPPFLAGS+=-DFD_USING_CLANG=1
3636
# itself doesn't matter ... only that the variable is defined).
3737

3838
FD_USING_CLANG:=1
39-
40-
# Using clang++ doesn't always bring in this library
41-
42-
LDFLAGS+=-lstdc++

config/extra/with-libcxx.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ ifndef LIBCXX
1313
$(error LIBCXX is not set)
1414
endif
1515

16+
FD_HAS_CXX:=1
1617
CXXFLAGS+=-nostdinc++ -nostdlib++
1718
CXXFLAGS+=-isystem $(LIBCXX)/include/c++/v1
1819
LDFLAGS+=$(LIBCXX)/lib/libc++.a $(LIBCXX)/lib/libc++abi.a

config/extra/with-rocksdb.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ ifneq (,$(wildcard $(OPT)/lib/librocksdb.a))
22
ifneq (,$(wildcard $(OPT)/lib/libsnappy.a))
33
ifneq (,$(wildcard $(OPT)/lib/libzstd.a))
44
FD_HAS_ROCKSDB:=1
5+
FD_HAS_CXX:=1
56
CFLAGS+=-DFD_HAS_ROCKSDB=1 -DROCKSDB_LITE=1
67
ROCKSDB_LIBS:=$(OPT)/lib/librocksdb.a $(OPT)/lib/libsnappy.a
8+
ifndef LIBCXX
9+
ROCKSDB_LIBS+=-lstdc++
10+
endif
711

812
# RocksDB enables io_uring support opportunistically; only link liburing when
913
# the static archive actually references its symbols (e.g. Arch Linux builds).

contrib/quic/agave_compat/build.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ fn main() {
2929
lib
3030
);
3131
}
32-
println!("cargo:rustc-link-lib=static=stdc++"); // fd_tile_threads.cxx
3332

3433
let mut include_path = build_path.clone();
3534
include_path.push("include");

contrib/quic/go_compat/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ package main
88
// #cgo LDFLAGS: -lfd_tango
99
// #cgo LDFLAGS: -lfd_ballet
1010
// #cgo LDFLAGS: -lfd_util
11-
// #cgo LDFLAGS: -lstdc++
1211
// #include <stdlib.h>
1312
// #include <stdio.h>
1413
// #include <firedancer/waltz/quic/fd_quic.h>

contrib/quic/rust_compat/build.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ fn main() {
2929
lib
3030
);
3131
}
32-
println!("cargo:rustc-link-lib=static=stdc++"); // fd_tile_threads.cxx
3332

3433
let mut include_path = build_path.clone();
3534
include_path.push("include");

src/util/tile/Local.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ $(call add-objs,fd_tile,fd_util)
33
ifdef FD_HAS_THREADS
44
$(call make-unit-test,test_cpuset,test_cpuset,fd_util)
55
$(call run-unit-test,test_cpuset)
6+
ifdef FD_HAS_CXX
7+
$(call add-objs,fd_tile_threads_cxx,fd_util)
8+
else
69
$(call add-objs,fd_tile_threads,fd_util)
10+
endif
711
else
812
$(call add-objs,fd_tile_nothreads,fd_util)
913
endif

src/util/tile/fd_tile_threads.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "fd_tile_threads.inc"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,16 @@ fd_tile_private_manager( void * _args ) {
339339
int argc = FD_VOLATILE_CONST( tile->argc );
340340
char ** argv = FD_VOLATILE_CONST( tile->argv );
341341
fd_tile_task_t task = FD_VOLATILE_CONST( tile->task );
342+
# ifdef __cplusplus
342343
try {
344+
# endif
343345
FD_VOLATILE( tile->ret ) = task( argc, argv );
344346
FD_VOLATILE( tile->fail ) = NULL;
347+
# ifdef __cplusplus
345348
} catch( ... ) {
346349
FD_VOLATILE( tile->fail ) = "uncaught exception";
347350
}
351+
# endif
348352

349353
FD_COMPILER_MFENCE();
350354
FD_VOLATILE( tile->state ) = FD_TILE_PRIVATE_STATE_IDLE;

0 commit comments

Comments
 (0)