Merge compat-from-mingw-w64 into compat-to-msvc since we dropped support for mainline MinGW32, and add dll_dependency.S so we don't need to build the libs with "-fno-stack-check -fno-stack-protector -mno-stack-arg-probe".

git-svn-id: https://svn.eduke32.com/eduke32@5341 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-09-08 02:58:03 +00:00
parent 51059b3896
commit eed78085bc
11 changed files with 117 additions and 37 deletions

View File

@ -319,7 +319,7 @@ ifeq ($(PLATFORM),DARWIN)
endif
ifeq ($(PLATFORM),WINDOWS)
LIBS += -lFLAC -lvorbisfile -lvorbis -logg -lcompat-from-mingw-w64
LIBS += -lFLAC -lvorbisfile -lvorbis -logg
LIBDIRS += -L$(AUDIOLIB_ROOT)/third-party/Windows/lib$(WINLIB)
DUKE3D_OBJS+= gameres winbits startwin.game
DUKE3D_EDITOR_OBJS+= buildres

View File

@ -98,7 +98,7 @@ ENET_CFLAGS=/I$(ENET_INC) /I$(ENET_SRC)
AUDIOLIB_CFLAGS=/I$(AUDIOLIB_INC) /I$(AUDIOLIB_SRC)
LIBS=user32.lib gdi32.lib shell32.lib winmm.lib ws2_32.lib comctl32.lib shlwapi.lib oleaut32.lib ole32.lib imm32.lib version.lib \
libogg.a libvorbis.a libvorbisfile.a libvpx.a libpng_mini.a libz_mini.a libcompat-from-mingw-w64.a \
libogg.a libvorbis.a libvorbisfile.a libvpx.a libpng_mini.a libz_mini.a \
dxguid.lib dsound.lib advapi32.lib libcompat-to-msvc.a
!if ("$(RENDERTYPE)"=="SDL")

View File

@ -1,18 +0,0 @@
o=o
NAME:=libcompat-from-mingw-w64
%.$o: %.c
gcc -Wall -Wextra -O3 -c $< -o $@
$(NAME).a: vsnprintf.$o
ar rc $@ $^
ranlib $@
all : $(NAME).a
@ls -l $^
clean:
-rm -f *.a *.o

View File

@ -1,13 +0,0 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#define __CRT__NO_INLINE
#include <stdarg.h>
#include <stdio.h>
int __cdecl __ms_vsnprintf (char *s,size_t n,const char *format,va_list arg)
{
return _vsnprintf(s, n, format, arg);
}

View File

@ -7,12 +7,16 @@ NAME:=libcompat-to-msvc
%.$o: %.c
gcc -Wall -Wextra -O3 -c $< -o $@
$(NAME).a: dll_math.$o io_math.$o
%.$o: %.S
gcc -c $< -o $@
OBJS=dll_math.$o io_math.$o dll_dependency.$o vsnprintf.$o
.INTERMEDIATE: $(OBJS)
$(NAME).a: $(OBJS)
ar rc $@ $^
ranlib $@
all : $(NAME).a
@ls -l $^
clean:
-rm -f *.a *.o

View File

@ -0,0 +1,88 @@
/* Implementation for gcc's internal stack-allocation routines. */
.global ___chkstk
.global __alloca
.global ___chkstk_ms
___chkstk_ms:
#ifdef _WIN64
pushq %rax
pushq %rcx
cmpq $0x1000, %rax
leaq 24(%rsp), %rcx
jb .Lchkstk_ms_end
.Lchkstk_ms_loop:
subq $0x1000, %rcx
subq $0x1000, %rax
orq $0x0, (%rcx)
cmpq $0x1000, %rax
ja .Lchkstk_ms_loop
.Lchkstk_ms_end:
subq %rax, %rcx
orq $0x0, (%rcx)
popq %rcx
popq %rax
ret
#else
pushl %eax
pushl %ecx
cmpl $0x1000, %eax
leal 12(%esp), %ecx
jb chkstk_ms_end
chkstk_ms_loop:
subl $0x1000, %ecx
subl $0x1000, %eax
orl $0x0, (%ecx)
cmpl $0x1000, %eax
ja chkstk_ms_loop
chkstk_ms_end:
subl %eax, %ecx
orl $0x0, (%ecx)
popl %ecx
popl %eax
ret
#endif
#ifdef _WIN64
__alloca:
movq %rcx, %rax
.align 4
___chkstk:
popq %r11
movq %rsp, %r10
cmpq $0x1000, %rax
jb .Lchkstk_end
.Lchkstk_loop:
subq $0x1000, %r10
subq $0x1000, %rax
orl $0x0, (%r10)
cmpq $0x1000, %rax
ja .Lchkstk_loop
.Lchkstk_end:
subq %rax, %r10
movq %rsp, %rax
orl $0x0, (%r10)
movq %r10, %rsp
pushq %r11
ret
#else
___chkstk:
__alloca:
pushl %ecx
leal 8(%esp), %ecx
cmpl $0x1000, %eax /* > 4k ?*/
jb chkstk_end
chkstk_loop:
subl $0x1000, %ecx
subl $0x1000, %eax
orl $0x0, (%ecx)
cmpl $0x1000, %eax
ja chkstk_loop
chkstk_end:
subl %eax, %ecx
orl $0x0, (%ecx)
movl %esp, %eax
movl %ecx, %esp
movl (%eax), %ecx
pushl 4(%eax)
ret
#endif

View File

@ -0,0 +1,19 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#define __CRT__NO_INLINE
#include <stdarg.h>
#include <stdlib.h>
extern int __cdecl _vsnprintf(char * __restrict__, size_t, const char * __restrict__, va_list);
int __cdecl __ms_vsnprintf (char * __restrict__ s, size_t n, const char * __restrict__ format, va_list arg)
{
return _vsnprintf(s, n, format, arg);
}
int __cdecl __mingw_vsnprintf (char * __restrict__ s, size_t n, const char * __restrict__ format, va_list arg)
{
return _vsnprintf(s, n, format, arg);
}