public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* x64 MSABI gcc 3.2.3
@ 2023-08-25 15:48 Paul Edwards
  0 siblings, 0 replies; only message in thread
From: Paul Edwards @ 2023-08-25 15:48 UTC (permalink / raw)
  To: GCC Development

[-- Attachment #1: Type: text/plain, Size: 3312 bytes --]

I have a slightly modified gcc 3.2.3.

Source is available in gcc-stage* in custom.zip at http://pdos.org

Executables are available in customb.zip but everything that
is really needed is in pdos.zip

gccdos.txt has instructions to run windows.mak which
produces the gccx64.exe that I use, but has these warnings
on the way:

C:\devel\gcc\gcc>pdmake -f windows.mak

gccwin -DTARGET_64BIT_DEFAULT -DMSABI -fno-common -O2 -S -D__WIN32__
-D__NOBIVA__ -DI386 -DHAVE_CONFIG_H -DIN_GCC -DPUREISO -I
../../pdos/pdpclib -I ../../pdos/src -I . -I config/i386 -I config -I
../include -o combine.s combine.c
combine.c: In function `try_combine':
combine.c:1682: warning: left shift count >= width of type
combine.c:1684: warning: left shift count >= width of type
combine.c:1694: warning: left shift count >= width of type
combine.c:1694: warning: left shift count >= width of type
combine.c:1696: warning: left shift count >= width of type
pdas --oformat coff -o combine.o combine.s

If I do pdmake -f makefile.te6 in c:\devel\pdos\pdpclib I do get
a valid 64-bit EFI executable.

But a more complex program gives:

C:\devel\pdos\pdpclib>pdmake -f makefile.eb6
rm -f *.o
rm -f pdptest.efi
gccx64 -S -O2 -mno-red-zone -D__64BIT__ -D__EFI__ -D__EFIBIOS__ -U__WIN32__
-I. -fno-builtin -fno-common -ansi -o pdptest.s pdptest.c
pdptest.c: In function `main':
pdptest.c:189: insn does not satisfy its constraints:
compilation terminated.
[pdptest.o] Error 1: Operation not permitted

C:\devel\pdos\pdpclib>


When I switch from mingw64 to gccx64:

C:\devel\pdos\pdpclib>git diff .
diff --git a/pdpclib/makefile.eb6 b/pdpclib/makefile.eb6
index 19fe84e4..98b02da0 100644
--- a/pdpclib/makefile.eb6
+++ b/pdpclib/makefile.eb6
@@ -1,14 +1,15 @@
 # This builds EFI executables for x86_64
 # We put no-builtin to stop the optimizer from making memset call memset

-CC=x86_64-w64-mingw32-gcc
+#CC=x86_64-w64-mingw32-gcc
+CC=gccx64
 #AR=x86_64-w64-mingw32-ar
 AR=ar
 #LD=x86_64-w64-mingw32-ld
 LD=pdld --no-insert-timestamp
 #AS=x86_64-w64-mingw32-as
 AS=pdas --64 --oformat coff
-COPTS=-S -O2 -mno-red-zone -D__64BIT__ -D__EFI__ -D__EFIBIOS__ -U__WIN32__
-I. -fno-builtin -fno-common -ansi -Wno-builtin-declaration-mismatch
+COPTS=-S -O2 -mno-red-zone -D__64BIT__ -D__EFI__ -D__EFIBIOS__ -U__WIN32__
-I. -fno-builtin -fno-common -ansi

 TARGET=pdptest.efi
 OBJS=efistart.o stdio.o string.o stdlib.o start.o time.o errno.o \

C:\devel\pdos\pdpclib>


Anyone interested in helping out with this?

Note that this (3.2.3) is the only version of gcc that runs
on PDOS/386 and it took a lot of effort to even do that.

Note that 3.2.3 normally wouldn't do the MSABI, but my
slightly modified version does:

#ifdef MSABI
static int const x86_64_int_parameter_registers[6] = {2 /*RCX*/, 1 /*RDX*/,
        8 /*R8*/, 9 /*R9*/,
                                                /* the following 2 need to
be deleted */
        FIRST_REX_INT_REG + 2 /*R10 */,
        FIRST_REX_INT_REG + 3 /*R11 */};
#else
static int const x86_64_int_parameter_registers[6] = {5 /*RDI*/, 4 /*RSI*/,
        1 /*RDX*/, 2 /*RCX*/,
        FIRST_REX_INT_REG /*R8 */,
        FIRST_REX_INT_REG + 1 /*R9 */};
#endif

My version (like standard 3.2.3) has 64-bit long, which is not
what Windows uses, but I am likely to stick with 64-bit long
regardless.

Thanks. Paul.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-25 15:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-25 15:48 x64 MSABI gcc 3.2.3 Paul Edwards

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).