Skip to content

Commit

Permalink
build library stub from separate file
Browse files Browse the repository at this point in the history
the stub can't include external libraries. it is a placeholder until the linker rewrites imports
  • Loading branch information
0xcaff committed Dec 25, 2023
1 parent 2d6c6ad commit 2bd8df9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions samples/library_example/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions samples/library_example/library_example/lib.stub.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
int testLibraryFunction()
{
return 0;
}

0 comments on commit 2bd8df9

Please sign in to comment.