mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 01:09:25 +00:00
The LinkDemo program calls dlopen/dlsym/dlclose to try and load a dyanmic library from /usr/lib. It read a global variable and calls a global function (extern "C" of course :) ). There a few hacks left in the LinkLib dynamic library, however. In order to get the linker to stop complaining, we have to use -nostartfiles -ffreestanding otherwise it will link crt0.o to our shared object, which is definitely not right as the _init function for a main program (that calls main) is not suitable for our lib
21 lines
501 B
Makefile
21 lines
501 B
Makefile
|
|
include ../../../Makefile.common
|
|
|
|
DYNLIBRARY = libDynamicLib.so
|
|
|
|
.PHONY: clean all
|
|
|
|
all: $(DYNLIBRARY)
|
|
|
|
DynamicLib.o: DynamicLib.cpp
|
|
$(CXX) -DDEBUG -fPIC -isystem../../../ -o $@ -c $<
|
|
|
|
# FIXME: Why do I need -nostartfiles and -nofreestanding?
|
|
# GCC isn't smart enough to not link crt0 against this dynamic lib
|
|
# which is clearly wrong. Isn't it? We don't want _start...
|
|
$(DYNLIBRARY): DynamicLib.o
|
|
$(CXX) -shared -nostartfiles -ffreestanding -o $(DYNLIBRARY) $<
|
|
|
|
clean:
|
|
rm -f *.o *.d *.so
|