diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-03-27 12:48:21 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-03-27 12:48:21 +0100 |
commit | 23bb276fcdd6cc3b57e7fc0eae2a614a798cfddf (patch) | |
tree | 5dd690844111811857fa21a1511fde010358c9f3 /LibC/Makefile | |
parent | f1a2cb0882bf192ecffa1b12e997648cdd367a07 (diff) | |
download | serenity-23bb276fcdd6cc3b57e7fc0eae2a614a798cfddf.zip |
LibC: Run constructors on process startup.
Cooperate with the compiler to generate and execute the _init_array list
of constructor functions on userspace program statup. This took two days
to get working, my goodness. :^)
Diffstat (limited to 'LibC/Makefile')
-rw-r--r-- | LibC/Makefile | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/LibC/Makefile b/LibC/Makefile index 471e70c205..d75ef1f585 100644 --- a/LibC/Makefile +++ b/LibC/Makefile @@ -40,17 +40,16 @@ LIBC_OBJS = \ poll.o \ locale.o \ arpa/inet.o \ - netdb.o \ - crt0.o + netdb.o -ASM_OBJS = setjmp.no +ASM_OBJS = setjmp.no crti.ao crtn.ao CPP_OBJS = $(AK_OBJS) $(WIDGETS_OBJS) $(LIBC_OBJS) LIBRARY = libc.a STANDARD_FLAGS = -std=c++17 WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough -FLAVOR_FLAGS = -fno-exceptions -fno-rtti +FLAVOR_FLAGS = -fno-exceptions -fno-rtti -fno-sized-deallocation OPTIMIZATION_FLAGS = -Os INCLUDE_FLAGS = -I.. -I. @@ -60,8 +59,14 @@ CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(FLAVOR_FLAGS) $(STA CXX = i686-pc-serenity-g++ LD = i686-pc-serenity-ld AR = i686-pc-serenity-ar +AS = i686-pc-serenity-as -all: $(LIBRARY) +all: $(LIBRARY) startfiles + +startfiles: + @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o crt0.o -c crt0.cpp + cp crti.ao crti.o + cp crtn.ao crtn.o $(LIBRARY): $(CPP_OBJS) $(ASM_OBJS) @echo "LIB $@"; $(AR) rcs $@ $(CPP_OBJS) $(ASM_OBJS) @@ -72,6 +77,9 @@ $(LIBRARY): $(CPP_OBJS) $(ASM_OBJS) %.no: %.asm @echo "NASM $@"; nasm -f elf -o $@ $< +%.ao: %.S + @echo "AS $@"; $(AS) -o $@ $< + -include $(OBJS:%.o=%.d) clean: |