From 115b81881f2ebe3fa90ba406f75a4fd5a6253a74 Mon Sep 17 00:00:00 2001 From: Coldy Date: Mon, 7 Feb 2022 09:45:44 +0000 Subject: [PATCH] cmm: - added __COFF__ predefined macro (for mark MSCOFF build); - edited makefiles (added compiler -fpack-struct=2 option/for correct struct packing) git-svn-id: svn://kolibrios.org@9695 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/cmm/Makefile | 4 ++-- programs/develop/cmm/Makefile.lin32 | 2 +- programs/develop/cmm/Makefile.win | 4 ++-- programs/develop/cmm/Makefile.win32 | 2 +- programs/develop/cmm/MakefileKolibriOS | 2 +- programs/develop/cmm/MakefileUnixWin | 4 ++-- programs/develop/cmm/Makefile_pyakov_ubuntu32 | 4 ++-- programs/develop/cmm/toke.cpp | 3 +++ 8 files changed, 14 insertions(+), 11 deletions(-) diff --git a/programs/develop/cmm/Makefile b/programs/develop/cmm/Makefile index 7e508b5226..4fcf73fe57 100644 --- a/programs/develop/cmm/Makefile +++ b/programs/develop/cmm/Makefile @@ -2,8 +2,8 @@ Compiler = gcc -Compiler_Options = -m32 -c -fno-exceptions -D_UNIX_ -#Compiler_Options = -c -fno-exceptions -O2 -D_WIN32_ +Compiler_Options = -m32 -c -fpack-struct=2 -fno-exceptions -D_UNIX_ +#Compiler_Options = -c -fpack-struct=2 -fno-exceptions -O2 -D_WIN32_ #-D: _WIN32_ or _UNIX_ #-D: for _WIN32_ add -D__CONSOLE__ diff --git a/programs/develop/cmm/Makefile.lin32 b/programs/develop/cmm/Makefile.lin32 index 5d16323a71..cf1e88982d 100644 --- a/programs/develop/cmm/Makefile.lin32 +++ b/programs/develop/cmm/Makefile.lin32 @@ -1,4 +1,4 @@ -CPPFLAGS=-m32 -fno-exceptions -std=c++03 -Wno-write-strings -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DO_BINARY=0 -D_UNIX_ +CPPFLAGS=-m32 -fpack-struct=2 -fno-exceptions -std=c++03 -Wno-write-strings -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DO_BINARY=0 -D_UNIX_ LDFLAGS=-m32 OBJS=$(patsubst %.cpp, %.o, $(wildcard *.cpp)) diff --git a/programs/develop/cmm/Makefile.win b/programs/develop/cmm/Makefile.win index 3898ff6764..5db627acfd 100644 --- a/programs/develop/cmm/Makefile.win +++ b/programs/develop/cmm/Makefile.win @@ -1,7 +1,7 @@ Compiler = gcc -#Compiler_Options = -c -fno-exceptions -D_UNIX_ -Compiler_Options = -c -fno-exceptions -O2 -D_WIN32_ +#Compiler_Options = -c -fpack-struct=2 -fno-exceptions -D_UNIX_ +Compiler_Options = -c -fpack-struct=2 -fno-exceptions -O2 -D_WIN32_ #-D: _WIN32_ or _UNIX_ #-D: for _WIN32_ add -D__CONSOLE__ diff --git a/programs/develop/cmm/Makefile.win32 b/programs/develop/cmm/Makefile.win32 index bfc4587115..4929c4ddd8 100644 --- a/programs/develop/cmm/Makefile.win32 +++ b/programs/develop/cmm/Makefile.win32 @@ -1,4 +1,4 @@ -CPPFLAGS=-m32 -fno-exceptions -std=c++03 -Wno-write-strings -D_WIN32_ +CPPFLAGS=-m32 -fpack-struct=2 -fno-exceptions -std=c++03 -Wno-write-strings -D_WIN32_ LDFLAGS=-m32 OBJS=$(patsubst %.cpp, %.o, $(wildcard *.cpp)) diff --git a/programs/develop/cmm/MakefileKolibriOS b/programs/develop/cmm/MakefileKolibriOS index e2a66371ca..e24384877b 100644 --- a/programs/develop/cmm/MakefileKolibriOS +++ b/programs/develop/cmm/MakefileKolibriOS @@ -7,7 +7,7 @@ Includes = -Id:\TEMP\mprog\kos\includes -I$(SDK_DIR)/sources/newlib/libc/include Compatib_Posix = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -Compiler_Options = -c -fno-exceptions -D_KOS_ -U_Win32 -U_WIN32 -U__MINGW32__ \ +Compiler_Options = -c -fpack-struct=2 -fno-exceptions -D_KOS_ -U_Win32 -U_WIN32 -U__MINGW32__ \ -mno-ms-bitfields -Wno-write-strings $(Includes) $(Compatib_Posix) Exe_file = cmm.kex diff --git a/programs/develop/cmm/MakefileUnixWin b/programs/develop/cmm/MakefileUnixWin index 42650a58c2..62426af32e 100644 --- a/programs/develop/cmm/MakefileUnixWin +++ b/programs/develop/cmm/MakefileUnixWin @@ -1,7 +1,7 @@ Compiler = gcc -Compiler_Options = -c -m32 -fno-exceptions -D_UNIX_ -#Compiler_Options = -c -fno-exceptions -O2 -D_WIN32_ +Compiler_Options = -c -m32 -fpack-struct=2 -fno-exceptions -D_UNIX_ +#Compiler_Options = -c -fpack-struct=2 -fno-exceptions -O2 -D_WIN32_ #-D: _WIN32_ or _UNIX_ #-D: for _WIN32_ add -D__CONSOLE__ diff --git a/programs/develop/cmm/Makefile_pyakov_ubuntu32 b/programs/develop/cmm/Makefile_pyakov_ubuntu32 index 49e4361020..1926be5781 100755 --- a/programs/develop/cmm/Makefile_pyakov_ubuntu32 +++ b/programs/develop/cmm/Makefile_pyakov_ubuntu32 @@ -1,8 +1,8 @@ Compiler = gcc Compatib_Posix = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -Compiler_Options = -m32 -c -fno-exceptions -D_UNIX_ $(Compatib_Posix) -Wno-narrowing -#Compiler_Options = -c -fno-exceptions -O2 -D_WIN32_ +Compiler_Options = -m32 -c -fpack-struct=2 -fno-exceptions -D_UNIX_ $(Compatib_Posix) -Wno-narrowing +#Compiler_Options = -c -fpack-struct=2 -fno-exceptions -O2 -D_WIN32_ #-D: _WIN32_ or _UNIX_ #-D: for _WIN32_ add -D__CONSOLE__ diff --git a/programs/develop/cmm/toke.cpp b/programs/develop/cmm/toke.cpp index 99878e22dd..2f501c6bb5 100644 --- a/programs/develop/cmm/toke.cpp +++ b/programs/develop/cmm/toke.cpp @@ -4264,6 +4264,9 @@ int ifdefconst() if(comfile==file_meos&&strcmp((char *)string+2,"MEOS__")==0)return TRUE; if((sobj||fobj)&&strcmp((char *)string+2,"OBJ__")==0)return TRUE; + + // Added by Coldy (for mark MSCOFF build) + if ((ocoff&&sobj) && strcmp((char *)string + 2, "COFF__") == 0)return TRUE; if(comfile==file_exe){