From 221e4dd488fa60a7932c82c941a270a0231bb800 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Thu, 11 Jul 2013 10:17:41 +0000 Subject: [PATCH] newlib: update git-svn-id: svn://kolibrios.org@3806 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/libraries/newlib/Makefile | 22 ++--- .../develop/libraries/newlib/crt/crtbegin.c | 18 ++++ .../develop/libraries/newlib/crt/dllstart.c | 11 --- programs/develop/libraries/newlib/dll.lds | 90 +++++++++---------- 4 files changed, 68 insertions(+), 73 deletions(-) create mode 100644 programs/develop/libraries/newlib/crt/crtbegin.c delete mode 100644 programs/develop/libraries/newlib/crt/dllstart.c diff --git a/programs/develop/libraries/newlib/Makefile b/programs/develop/libraries/newlib/Makefile index dd9808ab15..9da227f7d1 100644 --- a/programs/develop/libraries/newlib/Makefile +++ b/programs/develop/libraries/newlib/Makefile @@ -13,14 +13,6 @@ DEFINES:= -D_IEEE_LIBM INCLUDES:= -I $(LIBC_INCLUDES) -AMZ_SRCS:= \ - crt/crt_amz.S \ - crt/chkstk.S \ - crt/exit.S \ - crt/pseudo-reloc.c \ - crt/dllstart.c \ - crt/setjmp.S - STATIC_SRCS:= \ crt/start.S \ crt/crt1.c \ @@ -30,7 +22,8 @@ STATIC_SRCS:= \ pe/crtloader.c DLL_SRCS:= \ - crt/crtdll.c \ + crt/crtbegin.c \ + crt/pseudo-reloc.c \ crt/chkstk.S \ crt/exit.S @@ -46,6 +39,7 @@ LIBCRT_SRCS:= \ crt/start.S \ crt/chkstk.S \ crt/crt3.c \ + crt/crtbegin.o \ pe/crtloader.c CORE_SRCS:= \ @@ -308,8 +302,6 @@ MATH_SRCS = e_acos.c e_acosh.c e_asin.c e_atan2.c e_atanh.c e_cosh.c e_exp.c e_ f_log10.S f_log10f.S f_logf.S f_tan.S f_tanf.S -AMZ_OBJS = $(patsubst %.S, %.o, $(patsubst %.c, %.o, $(AMZ_SRCS))) - STATIC_OBJS = $(patsubst %.S, %.o, $(patsubst %.c, %.o, $(STATIC_SRCS))) LIBCRT_OBJS = $(patsubst %.S, %.o, $(patsubst %.c, %.o, $(LIBCRT_SRCS))) @@ -372,18 +364,18 @@ LIB_OBJS+= \ -shared: $(NAME).dll libcrt.a +shared: $(NAME).dll libcrt.a libdll.a $(NAME).dll: $(LIB_OBJS) $(SRC_DEP) Makefile - ld $(LDFLAGS) -L. -o $@ $(LIB_OBJS) -lgcc + ld $(LDFLAGS) -Map libcmap -L. -o $@ $(LIB_OBJS) -lgcc libcrt.a: $(LIBCRT_OBJS) Makefile ar rc libcrt.a $(LIBCRT_OBJS) -libamz.a: $(AMZ_OBJS) Makefile - ar rc libamz.a $(AMZ_OBJS) +libdll.a: $(DLL_OBJS) Makefile + ar rc libdll.a $(DLL_OBJS) libc.obj: $(NAME).dll fasm pe/libc.asm ./libc.obj diff --git a/programs/develop/libraries/newlib/crt/crtbegin.c b/programs/develop/libraries/newlib/crt/crtbegin.c new file mode 100644 index 0000000000..48c2cc1be5 --- /dev/null +++ b/programs/develop/libraries/newlib/crt/crtbegin.c @@ -0,0 +1,18 @@ + +extern void _pei386_runtime_relocator (void); + +int DllStartup(void *module, int reason);// __attribute__ ((dllexport)); + + +int DllStartup(void *module, int reason) +{ + _pei386_runtime_relocator(); + return 1; +}; + +void ___dll_start () + +{ + _pei386_runtime_relocator(); + +} diff --git a/programs/develop/libraries/newlib/crt/dllstart.c b/programs/develop/libraries/newlib/crt/dllstart.c deleted file mode 100644 index 11a657f1a2..0000000000 --- a/programs/develop/libraries/newlib/crt/dllstart.c +++ /dev/null @@ -1,11 +0,0 @@ - -void _pei386_runtime_relocator (void); - -int DllStartup(void *module, int reason); - - -int DllStartup(void *module, int reason) -{ - _pei386_runtime_relocator(); - return 1; -}; diff --git a/programs/develop/libraries/newlib/dll.lds b/programs/develop/libraries/newlib/dll.lds index 632d03f5ab..86c72ae46f 100644 --- a/programs/develop/libraries/newlib/dll.lds +++ b/programs/develop/libraries/newlib/dll.lds @@ -1,59 +1,58 @@ OUTPUT_FORMAT(pei-i386) +ENTRY("____dll_start") + SECTIONS { + . = SIZEOF_HEADERS; . = ALIGN(__section_alignment__); .text __image_base__ + . : { - - *(.init) - *(.text) - *(SORT(.text$*)) - *(.text.*) - *(.glue_7t) - *(.glue_7) - ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; + *(.text) + *(SORT(.text$*)) + *(.text.*) + *(.gnu.linkonce.t.*) + *(.glue_7t) + *(.glue_7) + ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0); - ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; + ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*)); LONG (0); - *(.fini) - /* ??? Why is .gcc_exc here? */ - *(.gcc_exc) - PROVIDE (etext = .); - *(.gcc_except_table) - } + *(.fini) - .rdata ALIGN(__section_alignment__): - { - *(.rdata) - *(SORT(.rdata$*)) - ___RUNTIME_PSEUDO_RELOC_LIST__ = .; - __RUNTIME_PSEUDO_RELOC_LIST__ = .; - *(.rdata_runtime_pseudo_reloc) - ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .; - __RUNTIME_PSEUDO_RELOC_LIST_END__ = .; - } - .CRT ALIGN(__section_alignment__): - { + . = ALIGN(16) ; ___crt_xc_start__ = . ; - *(SORT(.CRT$XC*)) /* C initialization */ - ___crt_xc_end__ = . ; - ___crt_xi_start__ = . ; - *(SORT(.CRT$XI*)) /* C++ initialization */ - ___crt_xi_end__ = . ; - ___crt_xl_start__ = . ; - *(SORT(.CRT$XL*)) /* TLS callbacks */ + *(SORT(.CRT$XC*)) /* C initialization */ + ___crt_xc_end__ = . ; + ___crt_xi_start__ = . ; + *(SORT(.CRT$XI*)) /* C++ initialization */ + ___crt_xi_end__ = . ; + ___crt_xl_start__ = . ; + *(SORT(.CRT$XL*)) /* TLS callbacks */ /* ___crt_xl_end__ is defined in the TLS Directory support code */ - ___crt_xp_start__ = . ; - *(SORT(.CRT$XP*)) /* Pre-termination */ - ___crt_xp_end__ = . ; - ___crt_xt_start__ = . ; - *(SORT(.CRT$XT*)) /* Termination */ - ___crt_xt_end__ = . ; - } + ___crt_xp_start__ = . ; + *(SORT(.CRT$XP*)) /* Pre-termination */ + ___crt_xp_end__ = . ; + ___crt_xt_start__ = . ; + *(SORT(.CRT$XT*)) /* Termination */ + ___crt_xt_end__ = . ; + + . = ALIGN(16) ; + + *(.rdata) + *(SORT(.rdata$*)) + __rt_psrelocs_start = .; + *(.rdata_runtime_pseudo_reloc) + __rt_psrelocs_end = .; + } + __rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start; + ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .; + __RUNTIME_PSEUDO_RELOC_LIST_END__ = .; + ___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size; + __RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size; .data ALIGN(__section_alignment__): { @@ -68,16 +67,12 @@ SECTIONS *(.data_cygwin_nocopy) } - .eh_frame ALIGN(__section_alignment__): - { - *(.eh_frame) - ___iend = . ; - } - .bss ALIGN(__section_alignment__): { + __bss_start__ = . ; *(.bss) *(COMMON) + __bss_end__ = . ; } .edata ALIGN(__section_alignment__): @@ -92,6 +87,7 @@ SECTIONS *(.debug$F) *(.drectve) *(.note.GNU-stack) + *(.eh_frame) *(.comment) *(.debug_abbrev) *(.debug_info)