diff --git a/apps/c/cpp/.gitignore b/apps/c/cpp_benchmark/.gitignore similarity index 100% rename from apps/c/cpp/.gitignore rename to apps/c/cpp_benchmark/.gitignore diff --git a/apps/c/cpp/axbuild.mk b/apps/c/cpp_benchmark/axbuild.mk similarity index 100% rename from apps/c/cpp/axbuild.mk rename to apps/c/cpp_benchmark/axbuild.mk diff --git a/apps/c/cpp/features.txt b/apps/c/cpp_benchmark/features.txt similarity index 100% rename from apps/c/cpp/features.txt rename to apps/c/cpp_benchmark/features.txt diff --git a/apps/c/cpp/std_benchmark.patch b/apps/c/cpp_benchmark/std_benchmark.patch similarity index 100% rename from apps/c/cpp/std_benchmark.patch rename to apps/c/cpp_benchmark/std_benchmark.patch diff --git a/apps/c/cpp_helloworld/axbuild.mk b/apps/c/cpp_helloworld/axbuild.mk new file mode 100644 index 000000000..402aefbec --- /dev/null +++ b/apps/c/cpp_helloworld/axbuild.mk @@ -0,0 +1,20 @@ +ARCH ?= x86_64 +C_COMPILER := $(shell which $(CC)) +CXX_COMPILER := $(shell which $(CC)) +AR := $(shell which $(AR)) +RANLIB := $(shell which $(RANLIB)) +CROSS_COMPILE_PATH := $(shell dirname $(C_COMPILER))/.. + +app-objs := main.o + +$(APP)/$(app-objs): $(APP)/axbuild.mk + $(CXX_COMPILER) -c -o $(app-objs) $(APP)/main.cpp + $(LD) -o $(app-objs) -nostdlib -static -no-pie -r -e main \ + $(app-objs) \ + $(CROSS_COMPILE_PATH)/*-linux-musl/lib/libstdc++.a \ + $(CROSS_COMPILE_PATH)/lib/gcc/*-linux-musl/*/libgcc_eh.a + +clean_c:: + rm -rf $(APP)/$(app-objs) + +.PHONY: $(APP)/$(app-objs) clean_c diff --git a/apps/c/cpp_helloworld/features.txt b/apps/c/cpp_helloworld/features.txt new file mode 100644 index 000000000..662a64968 --- /dev/null +++ b/apps/c/cpp_helloworld/features.txt @@ -0,0 +1,6 @@ +alloc +paging +irq +multitask +fs +random-hw diff --git a/apps/c/cpp_helloworld/main.cpp b/apps/c/cpp_helloworld/main.cpp new file mode 100644 index 000000000..9a69aca63 --- /dev/null +++ b/apps/c/cpp_helloworld/main.cpp @@ -0,0 +1,12 @@ +#include + +using namespace std; + +// This is a dummy function to avoid linker errors as this example should be a static executable. +void* __dso_handle = NULL; + +int main(int argc, char* argv[]) { + cout << "Hello, wolrd!" << endl; + return 0; +} +