Browse Source

[Pal] Move user_start.S under Pal/crt_init/ directory

Isaku Yamahata 4 years ago
parent
commit
c126c10452

+ 13 - 3
LibOS/shim/test/inline/Makefile

@@ -9,9 +9,19 @@ default: all
 
 include ../../../../Scripts/Makefile.Test
 
-LDLIBS-user_start = $(PALDIR)/user_start.o
-$(PALDIR)/user_start.o: $(PALDIR)/user_start.S
-	$(MAKE) -C $(PALDIR) $(notdir $@)
+.PHONY: crt_init-recurse
+crt_init-recurse:
+	$(MAKE) -C ../crt_init all
+
+../crt_init/user_shared_start.o ../crt_init/user_start.o: crt_init-recurse
+	@true
+
+LDLIBS-user_start = $(PALDIR)/../crt_init/user_start.o
+.PHONY: crt_init-recurse
+crt_init-recurse:
+	$(MAKE) -C $(PALDIR)/../crt_init/ all
+$(PALDIR)/../crt_init/user_start.o: crt_init-recurse
+	@true
 
 ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
 

+ 4 - 1
Pal/Makefile

@@ -1,15 +1,17 @@
 include ../Scripts/Makefile.configs
 
-DIRS = src test regression
+DIRS = src crt_init test regression
 
 .PHONY: all
 all:
 	$(MAKE) -C src
+	$(MAKE) -C crt_init
 
 clean_targets = clean distclean
 .PHONY: $(clean_targets)
 $(clean_targets):
 	$(MAKE) -C src $@
+	$(MAKE) -C crt_init $@
 	$(MAKE) -C test $@
 	$(MAKE) -C regression $@
 	$(MAKE) -C lib $@
@@ -17,6 +19,7 @@ $(clean_targets):
 .PHONY: test
 test:
 	$(MAKE) -C src test
+	$(MAKE) -C crt_init test
 	$(MAKE) -C test
 	$(MAKE) -C regression
 

+ 26 - 0
Pal/crt_init/Makefile

@@ -0,0 +1,26 @@
+include ../../Scripts/Makefile.configs
+include ../../Scripts/Makefile.rules
+
+ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
+files_to_build += user_start.o user_shared_start.o
+endif
+
+.PHONY: all test
+all: $(files_to_build)
+test:
+
+user_start.o: user_start.S
+	$(call cmd,as_o_S)
+
+ASFLAGS-user_shared_start.o = -DSHARED -fPIC
+user_shared_start.o: user_start.S
+	$(call cmd,as_o_S)
+
+include $(wildcard *.d)
+
+.PHONY: clean
+clean:
+	$(RM) $(files_to_build) *.d
+
+.PHONY: distclean
+distclean: clean

+ 0 - 0
Pal/src/user_start.S → Pal/crt_init/user_start.S


+ 8 - 4
Pal/regression/Makefile

@@ -79,8 +79,12 @@ manifest_rules = \
 	-e 's:\$$(RA_CLIENT_LINKABLE):$(if $(RA_CLIENT_LINKABLE),$(RA_CLIENT_LINKABLE),0):g' \
 	$(extra_rules)
 
-../src/user_shared_start.o ../src/user_start.o: ../src/user_start.S
-	$(MAKE) -C ../src $(notdir $@)
+.PHONY: crt_init-recurse
+crt_init-recurse:
+	$(MAKE) -C ../crt_init all
+
+../crt_init/user_shared_start.o ../crt_init/user_start.o: crt_init-recurse
+	@true
 
 CFLAGS-AvxDisable += -mavx
 
@@ -90,13 +94,13 @@ CFLAGS-AvxDisable += -mavx
 	@true
 
 ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
-LDLIBS-preloads = ../src/user_shared_start.o $(graphene_lib) $(pal_lib)
+LDLIBS-preloads = ../crt_init/user_shared_start.o $(graphene_lib) $(pal_lib)
 $(preloads): CFLAGS += -shared -fPIC
 $(preloads): LDLIBS = $(LDLIBS-preloads)
 $(preloads): %.so: %.c $(LDLIBS-preloads)
 	$(call cmd,csingle)
 
-LDLIBS-executables = ../src/user_start.o $(graphene_lib) $(pal_lib) $(preloads)
+LDLIBS-executables = ../crt_init/user_start.o $(graphene_lib) $(pal_lib) $(preloads)
 $(executables): CFLAGS += -no-pie
 $(executables): LDLIBS = $(LDLIBS-executables)
 $(executables): %: %.c $(LDLIBS-executables)

+ 0 - 12
Pal/src/Makefile

@@ -45,10 +45,6 @@ objs	= $(addprefix db_,streams memory threading mutex events process \
 graphene_lib = $(LIB_DIR)/graphene-lib.a
 host_lib = $(HOST_DIR)/libpal-$(PAL_HOST).a
 
-ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
-files_to_build += user_start.o user_shared_start.o
-endif
-
 ifeq ($(DEBUG),1)
 CC += -gdwarf-2 -g3
 CFLAGS += -DDEBUG
@@ -129,14 +125,6 @@ $(pal_static): $(addprefix $(OBJ_DIR)/,$(addsuffix .o,$(objs))) \
 	       $(host_lib) $(graphene_lib)
 	$(call cmd,ar_a_o)
 
-user_start.o: ASFLAGS =
-user_start.o: user_start.S
-	$(call cmd,as_o_S)
-
-user_shared_start.o: ASFLAGS = -DSHARED -fPIC
-user_shared_start.o: user_start.S
-	$(call cmd,as_o_S)
-
 $(OBJ_DIR)/%.o: %.c
 	@mkdir -p $(OBJ_DIR)
 	$(call cmd,cc_o_c)

+ 9 - 2
Pal/test/Makefile

@@ -20,7 +20,7 @@ graphene_lib = .lib/graphene-lib.a
 pal_lib = ../../Runtime/libpal-$(PAL_HOST).so
 
 .PHONY: all
-all:	pal_loader $(target) $(call expand_target_to_sig,$(target)) $(call expand_target_to_sgx,$(target))
+all: pal_loader $(target) $(call expand_target_to_sig,$(target)) $(call expand_target_to_sgx,$(target))
 
 .PHONY: sgx-tokens
 sgx-tokens: $(call expand_target_to_token,$(target))
@@ -37,8 +37,15 @@ pal_loader:
 	ln -sf ../../Runtime/pal_loader
 
 ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
+.PHONY: crt_init-recurse
+crt_init-recurse:
+	$(MAKE) -C ../crt_init all
+
+../crt_init/user_start.o: crt_init-recurse
+	@true
+
 CFLAGS-Pie = -fPIC -pie
-LDLIBS = $(graphene_lib) $(pal_lib) ../src/user_start.o
+LDLIBS = $(graphene_lib) $(pal_lib) ../crt_init/user_start.o
 $(executables): %: %.c $(LDLIBS)
 	$(call cmd,csingle)