os: remove startup lib from dynamic programs

All the pre- and post-processing of the startup lib around the main
function of a dynamic program is now done by LDSO. Hence LDSO directly
calls the main function of the program.

Issue #1042
This commit is contained in:
Martin Stein
2014-02-05 15:18:21 +01:00
committed by Norman Feske
parent 8d21064b5e
commit bd52e49698
15 changed files with 81 additions and 230 deletions

View File

@@ -80,15 +80,6 @@ LIBS += ldso-startup
ifneq ($(LIB),$(DYNAMIC_LINKER))
LIBS += $(DYNAMIC_LINKER)
#
# Ensure that startup_dyn is build for the dynamic programs that depend on a
# shared library. They add it to their dependencies as replacement for the
# static-case startup as soon as they recognize that they are dynamic.
# The current library in contrast filters-out startup_dyn from its
# dependencies before they get merged.
#
LIBS += startup_dyn
endif
#

View File

@@ -126,17 +126,11 @@ $(LIB_A): $(OBJECTS)
$(MSG_MERGE)$(LIB_A)
$(VERBOSE)$(AR) -rc $@ $(OBJECTS)
#
# Prevent linkage of startup_dyn as we added it only in order that it gets
# build for the dynamic programs.
#
ifdef SHARED_LIB
override DEPS := $(filter-out startup_dyn.lib,$(DEPS))
#
# Prevent linkage of startup code and base libs against shared libraries except
# for ld.lib.so
#
ifdef SHARED_LIB
ifneq ($(LIB),ld)
override DEPS := $(filter-out $(BASE_LIBS:=.lib) startup.lib,$(DEPS))
endif

View File

@@ -126,13 +126,9 @@ LD_CMD += -Wl,--dynamic-linker=$(DYNAMIC_LINKER).lib.so \
-Wl,--eh-frame-hdr
#
# Filter out the base libraries since they will be provided by the LDSO
# library and the startup library as the CRT0 part of program startup is
# done by LDSO already. As replacement for the startup library startup_dyn
# is used. The startup_dyn build is triggered by any shared library without
# merging it to the library.
# Filter out the base libraries since they will be provided by the LDSO library
#
FILTER_DEPS := $(filter-out $(BASE_LIBS) startup,$(DEPS:.lib=)) startup_dyn
FILTER_DEPS := $(filter-out $(BASE_LIBS) startup,$(DEPS:.lib=))
SHARED_LIBS += $(LIB_CACHE_DIR)/$(DYNAMIC_LINKER)/$(DYNAMIC_LINKER).lib.so
#

View File

@@ -56,7 +56,6 @@
/* stack of the temporary initial environment */
.p2align 4
.space 32 * 1024
.global _stack_high
_stack_high:
/* initial value of the SP register */

View File

@@ -59,7 +59,6 @@
/* stack of the temporary initial environment */
.p2align 4
.space 32 * 1024
.global _stack_high
_stack_high:
/* initial value of the ESP, EAX and EDI register */

View File

@@ -70,16 +70,15 @@
/* stack of the temporary initial environment */
.p2align 8
.space 32 * 1024
.global _stack_high
_stack_high:
/* initial value of the RSP, RAX and RDI register */
.globl __initial_sp
.globl __initial_sp
__initial_sp:
.space 8
.globl __initial_ax
.globl __initial_ax
__initial_ax:
.space 8
.globl __initial_di
.globl __initial_di
__initial_di:
.space 8