From 2bd8df9120596d13ffb5d345aaa8161a5c7c9167 Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 25 Dec 2023 14:27:25 -0600 Subject: [PATCH] build library stub from separate file the stub can't include external libraries. it is a placeholder until the linker rewrites imports --- samples/library_example/Makefile | 4 ++-- samples/library_example/library_example/lib.stub.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 samples/library_example/library_example/lib.stub.c diff --git a/samples/library_example/Makefile b/samples/library_example/Makefile index 2e4e6f99..f7ecd851 100644 --- a/samples/library_example/Makefile +++ b/samples/library_example/Makefile @@ -59,10 +59,10 @@ $(INTDIR)/%.o: $(PROJDIR)/%.c $(INTDIR)/%.o: $(PROJDIR)/%.cpp $(CCX) $(CXXFLAGS) -o $@ $< -$(INTDIR)/%.o.stub: $(PROJDIR)/%.c +$(INTDIR)/%.o.stub: $(PROJDIR)/%.stub.c $(CC) -target x86_64-pc-linux-gnu -ffreestanding -nostdlib -fno-builtin -fPIC -c $(TOOLCHAIN)/include -o $@ $< -$(INTDIR)/%.o.stub: $(PROJDIR)/%.cpp +$(INTDIR)/%.o.stub: $(PROJDIR)/%.stub.cpp $(CCX) -target x86_64-pc-linux-gnu -ffreestanding -nostdlib -fno-builtin -fPIC -c $(TOOLCHAIN)/include -o $@ $< .PHONY: clean diff --git a/samples/library_example/library_example/lib.stub.c b/samples/library_example/library_example/lib.stub.c new file mode 100644 index 00000000..3e6ff711 --- /dev/null +++ b/samples/library_example/library_example/lib.stub.c @@ -0,0 +1,4 @@ +int testLibraryFunction() +{ + return 0; +}