Ver código fonte

- moved files to systems directory

carl 23 anos atrás
pai
commit
1603394d9a

+ 28 - 144
compiler/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 1.1 [2002/08/11]
+# Don't edit, this file is generated by FPCMake Version 1.1 [2002/02/27]
 #
 default: all
-MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx
+MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx
 override PATH:=$(subst \,/,$(PATH))
 ifeq ($(findstring ;,$(PATH)),)
 inUnix=1
@@ -42,9 +42,6 @@ endif
 ifeq ($(OS_TARGET),netbsd)
 BSDhier=1
 endif
-ifeq ($(OS_TARGET),openbsd)
-BSDhier=1
-endif
 ifdef inUnix
 BATCHEXT=.sh
 else
@@ -111,7 +108,7 @@ ifndef FPC_VERSION
 FPC_VERSION:=$(shell $(FPC) -iV)
 endif
 export FPC FPC_VERSION
-unexport CHECKDEPEND ALLDEPENDENCIES
+unexport CHECKDEPEND ALL_DEPENDENCIES
 ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
 COMPILERINFO:=$(shell $(FPC) -iSP -iTP -iSO -iTO)
 ifndef CPU_SOURCE
@@ -293,7 +290,7 @@ override FPCOPT:=$(LOCALOPT)
 override TARGET_DIRS+=utils
 override INSTALL_FPCPACKAGE=y
 override COMPILER_INCLUDEDIR+=$(PPC_TARGET)
-override COMPILER_UNITDIR+=$(PPC_TARGET) targets
+override COMPILER_UNITDIR+=$(PPC_TARGET) systems
 override COMPILER_TARGETDIR+=$(CPU_UNITDIR)
 ifdef REQUIRE_UNITSDIR
 override UNITSDIR+=$(REQUIRE_UNITSDIR)
@@ -311,15 +308,9 @@ endif
 ifeq ($(OS_TARGET),netbsd)
 UNIXINSTALLDIR=1
 endif
-ifeq ($(OS_TARGET),openbsd)
-UNIXINSTALLDIR=1
-endif
 ifeq ($(OS_TARGET),sunos)
 UNIXINSTALLDIR=1
 endif
-ifeq ($(OS_TARGET),qnx)
-UNIXINSTALLDIR=1
-endif
 else
 ifeq ($(OS_SOURCE),linux)
 UNIXINSTALLDIR=1
@@ -330,15 +321,9 @@ endif
 ifeq ($(OS_SOURCE),netbsd)
 UNIXINSTALLDIR=1
 endif
-ifeq ($(OS_SOURCE),openbsd)
-UNIXINSTALLDIR=1
-endif
 ifeq ($(OS_TARGET),sunos)
 UNIXINSTALLDIR=1
 endif
-ifeq ($(OS_TARGET),qnx)
-UNIXINSTALLDIR=1
-endif
 endif
 ifndef INSTALL_PREFIX
 ifdef PREFIX
@@ -357,9 +342,6 @@ endif
 endif
 endif
 export INSTALL_PREFIX
-ifdef INSTALL_FPCSUBDIR
-export INSTALL_FPCSUBDIR
-endif
 ifndef DIST_DESTDIR
 DIST_DESTDIR:=$(BASEDIR)
 endif
@@ -406,27 +388,22 @@ endif
 endif
 ifndef INSTALL_SOURCEDIR
 ifdef UNIXINSTALLDIR
+ifdef INSTALL_FPCPACKAGE
 ifdef BSDhier
-SRCPREFIXDIR=share/src
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/share/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
 else
-SRCPREFIXDIR=src
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
 endif
-ifdef INSTALL_FPCPACKAGE
-ifdef INSTALL_FPCSUBDIR
-INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
 else
-INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
-endif
+ifdef BSDhier
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/share/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
 else
-INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
 endif
 else
 ifdef INSTALL_FPCPACKAGE
-ifdef INSTALL_FPCSUBDIR
-INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
-else
 INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)
-endif
 else
 INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source
 endif
@@ -434,15 +411,18 @@ endif
 endif
 ifndef INSTALL_DOCDIR
 ifdef UNIXINSTALLDIR
+ifdef INSTALL_FPCPACKAGE
 ifdef BSDhier
-DOCPREFIXDIR=share/doc
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/share/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
 else
-DOCPREFIXDIR=doc
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
 endif
-ifdef INSTALL_FPCPACKAGE
-INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
 else
-INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+ifdef BSDhier
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/share/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
 endif
 else
 ifdef INSTALL_FPCPACKAGE
@@ -534,12 +514,6 @@ HASSHAREDLIB=1
 FPCMADE=fpcmade.netbsd
 ZIPSUFFIX=netbsd
 endif
-ifeq ($(OS_TARGET),openbsd)
-EXEEXT=
-HASSHAREDLIB=1
-FPCMADE=fpcmade.openbsd
-ZIPSUFFIX=openbsd
-endif
 ifeq ($(OS_TARGET),win32)
 PPUEXT=.ppw
 OEXT=.ow
@@ -565,7 +539,7 @@ ECHO=echo
 endif
 ifeq ($(OS_TARGET),amiga)
 EXEEXT=
-PPUEXT=.ppu
+PPUEXT=.ppa
 ASMEXT=.asm
 OEXT=.o
 SMARTEXT=.sl
@@ -574,7 +548,7 @@ SHAREDLIBEXT=.library
 FPCMADE=fpcmade.amg
 endif
 ifeq ($(OS_TARGET),atari)
-PPUEXT=.ppu
+PPUEXT=.ppt
 ASMEXT=.s
 OEXT=.o
 SMARTEXT=.sl
@@ -612,18 +586,6 @@ EXEEXT=
 FPCMADE=fpcmade.qnx
 ZIPSUFFIX=qnx
 endif
-ifeq ($(OS_TARGET),netware)
-STATICLIBPREFIX=
-PPUEXT=.ppn
-OEXT=.on
-ASMEXT=.s
-SMARTEXT=.sl
-STATICLIBEXT=.a
-SHAREDLIBEXT=.nlm
-FPCMADE=fpcmade.nw
-ZIPSUFFIX=nw
-EXEEXT=.nlm
-endif
 ifndef ECHO
 ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
 ifeq ($(ECHO),)
@@ -879,15 +841,6 @@ endif
 ifeq ($(OS_TARGET),qnx)
 REQUIRE_PACKAGES_RTL=1
 endif
-ifeq ($(OS_TARGET),netware)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(OS_TARGET),openbsd)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(OS_TARGET),wdosx)
-REQUIRE_PACKAGES_RTL=1
-endif
 ifdef REQUIRE_PACKAGES_RTL
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/$(OS_TARGET)/Makefile.fpc,$(PACKAGESDIR))))))
 ifneq ($(PACKAGEDIR_RTL),)
@@ -899,7 +852,7 @@ endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_RTL)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_RTL) $(FPCMADE)
-override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(FPCMADE)
+override ALL_DEPENDENCIES+=$(PACKAGEDIR_RTL)/$(FPCMADE)
 endif
 else
 PACKAGEDIR_RTL=
@@ -920,9 +873,6 @@ endif
 ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
-ifeq ($(OS_SOURCE),openbsd)
-override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
-endif
 ifdef UNITDIR
 override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
@@ -1030,78 +980,12 @@ ifdef TARGET_RSTS
 override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
 override CLEANRSTFILES+=$(RSTFILES)
 endif
-.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
-ifdef INSTALL_UNITS
-override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
-endif
-ifdef INSTALL_BUILDUNIT
-override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES))
-endif
-ifdef INSTALLPPUFILES
-override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
-override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
-override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)))
-override INSTALL_CREATEPACKAGEFPC=1
-endif
-ifdef INSTALLEXEFILES
-override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES))
-endif
-fpc_install: all $(INSTALLTARGET)
-ifdef INSTALLEXEFILES
-	$(MKDIR) $(INSTALL_BINDIR)
-ifdef UPXPROG
-	-$(UPXPROG) $(INSTALLEXEFILES)
-endif
-	$(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
-endif
-ifdef INSTALL_CREATEPACKAGEFPC
-ifdef FPCMAKE
-ifdef PACKAGE_VERSION
-ifneq ($(wildcard Makefile.fpc),)
-	$(FPCMAKE) -p -T$(OS_TARGET) Makefile.fpc
-	$(MKDIR) $(INSTALL_UNITDIR)
-	$(INSTALL) Package.fpc $(INSTALL_UNITDIR)
-endif
-endif
-endif
-endif
-ifdef INSTALLPPUFILES
-	$(MKDIR) $(INSTALL_UNITDIR)
-	$(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)
-ifneq ($(INSTALLPPULINKFILES),)
-	$(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)
-endif
-ifneq ($(wildcard $(LIB_FULLNAME)),)
-	$(MKDIR) $(INSTALL_LIBDIR)
-	$(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)
-ifdef inUnix
-	ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)
-endif
-endif
-endif
-ifdef INSTALL_FILES
-	$(MKDIR) $(INSTALL_DATADIR)
-	$(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)
-endif
-fpc_sourceinstall: distclean
-	$(MKDIR) $(INSTALL_SOURCEDIR)
-	$(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
-fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
-ifdef HASEXAMPLES
-	$(MKDIR) $(INSTALL_EXAMPLEDIR)
-endif
-ifdef EXAMPLESOURCEFILES
-	$(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)
-endif
-ifdef TARGET_EXAMPLEDIRS
-	$(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR)
-endif
 .PHONY: fpc_distinstall
 fpc_distinstall: install exampleinstall
 .PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall
 ifndef PACKDIR
 ifndef inUnix
-PACKDIR=$(BASEDIR)/../fpc-pack
+PACKDIR=$(BASEDIR)/fpc-pack
 else
 PACKDIR=/tmp/fpc-pack
 endif
@@ -1389,8 +1273,8 @@ smart: $(addsuffix _smart,$(TARGET_DIRS))
 release: $(addsuffix _release,$(TARGET_DIRS))
 examples: $(addsuffix _examples,$(TARGET_DIRS))
 shared: $(addsuffix _shared,$(TARGET_DIRS))
-sourceinstall: fpc_sourceinstall
-exampleinstall: fpc_exampleinstall $(addsuffix _exampleinstall,$(TARGET_DIRS))
+sourceinstall:
+exampleinstall: $(addsuffix _exampleinstall,$(TARGET_DIRS))
 distinstall: fpc_distinstall
 zipinstall: fpc_zipinstall
 zipsourceinstall: fpc_zipsourceinstall
@@ -1484,14 +1368,14 @@ msgtxt.inc: $(MSGFILE)
 msg: msgtxt.inc
 ifndef COMPLETE
 $(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg \
-	     $(wildcard targets/*.pas) $(wilcard targets/*.inc) \
+	     $(wildcard systems/*.pas) $(wilcard systems/*.inc) \
 	     $(wildcard $(PPC_TARGET)/*.pas) $(wildcard $(PPC_TARGET)/*.inc)
 	$(COMPILER) pp.pas
 	$(EXECPPAS)
 	$(MOVE) $(COMPILER_TARGETDIR)/$(PPEXENAME) $(EXENAME)
 else
 $(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg \
-	     $(wildcard targets/*.pas) $(wilcard targets/*.inc) \
+	     $(wildcard systems/*.pas) $(wilcard systems/*.inc) \
 	     $(wildcard $(PPC_TARGET)/*.pas) $(wildcard $(PPC_TARGET)/*.inc)
 	$(COMPILER) pp.pas
 	$(EXECPPAS)
@@ -1574,7 +1458,7 @@ fullcycle:
 	$(MAKE) ppuclean
 	$(MAKE) $(filter-out $(PPC_TARGET),$(CYCLETARGETS)) 'FPC=$(BASEDIR)/$(EXENAME)'
 htmldocs:
-	$(PASDOC) -p -h -o html$(PATHSEP)$(PPC_TARGET) -d fpc -d gdb -d $(PPC_TARGET) -u $(PPC_TARGET) $(PPC_TARGET)$(PATHSEP)*.pas targets$(PATHSEP)*.pas *.pas
+	$(PASDOC) -p -h -o html$(PATHSEP)$(PPC_TARGET) -d fpc -d gdb -d $(PPC_TARGET) -u $(PPC_TARGET) $(PPC_TARGET)$(PATHSEP)*.pas systems$(PATHSEP)*.pas *.pas
 .PHONY: quickinstall install installsym
 MSGINSTALLDIR=$(INSTALL_BASEDIR)/msg
 override PPEXEFILE:=$(wildcard $(EXENAME))

+ 4 - 4
compiler/Makefile.fpc

@@ -11,7 +11,7 @@ dirs=utils
 
 [compiler]
 targetdir=$(CPU_UNITDIR)
-unitdir=$(PPC_TARGET) targets
+unitdir=$(PPC_TARGET) systems
 includedir=$(PPC_TARGET)
 
 [require]
@@ -309,14 +309,14 @@ msg: msgtxt.inc
 # Make only the compiler
 ifndef COMPLETE
 $(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg \
-             $(wildcard targets/*.pas) $(wilcard targets/*.inc) \
+             $(wildcard systems/*.pas) $(wilcard systems/*.inc) \
              $(wildcard $(PPC_TARGET)/*.pas) $(wildcard $(PPC_TARGET)/*.inc)
         $(COMPILER) pp.pas
         $(EXECPPAS)
         $(MOVE) $(COMPILER_TARGETDIR)/$(PPEXENAME) $(EXENAME)
 else
 $(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg \
-             $(wildcard targets/*.pas) $(wilcard targets/*.inc) \
+             $(wildcard systems/*.pas) $(wilcard systems/*.inc) \
              $(wildcard $(PPC_TARGET)/*.pas) $(wildcard $(PPC_TARGET)/*.inc)
         $(COMPILER) pp.pas
         $(EXECPPAS)
@@ -472,7 +472,7 @@ fullcycle:
 # Docs
 #####################################################################
 htmldocs:
-        $(PASDOC) -p -h -o html$(PATHSEP)$(PPC_TARGET) -d fpc -d gdb -d $(PPC_TARGET) -u $(PPC_TARGET) $(PPC_TARGET)$(PATHSEP)*.pas targets$(PATHSEP)*.pas *.pas
+        $(PASDOC) -p -h -o html$(PATHSEP)$(PPC_TARGET) -d fpc -d gdb -d $(PPC_TARGET) -u $(PPC_TARGET) $(PPC_TARGET)$(PATHSEP)*.pas systems$(PATHSEP)*.pas *.pas
 
 #####################################################################
 # Installation

+ 0 - 103
compiler/i_amiga.pas

@@ -1,103 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support information structures for AmigaOS
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
-}
-{ This unit implements support information structures for the AmigaOS. }
-unit i_amiga;
-
-  interface
-
-    uses
-       systems;
-
-    const
-       system_m68k_amiga_info : tsysteminfo =
-          (
-            system       : target_m68k_Amiga;
-            name         : 'Commodore Amiga';
-            shortname    : 'amiga';
-            flags        : [];
-            cpu          : cpu_m68k;
-            short_name   : 'AMIGA';
-            unit_env     : '';
-            extradefines : '';
-            sharedlibext : '.library';
-            staticlibext : '.a';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '';
-            defext       : '';
-            scriptext    : '';
-            smartext     : '.sl';
-            unitext      : '.ppa';
-            unitlibext   : '.ppl';
-            asmext       : '.asm';
-            objext       : '.o';
-            resext       : '.res';
-            resobjext    : '.or';
-            staticlibprefix : '';
-            sharedlibprefix : '';
-            Cprefix      : '_';
-            newline      : #10;
-            dirsep       : '/';
-            files_case_relevent : true;
-            assem        : as_gas;
-            assemextern  : as_gas;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_m68k_ar;
-            res          : res_none;
-            script       : script_amiga;
-            endian       : endian_big;
-            stackalignment : 2;
-            maxCrecordalignment : 4;
-            heapsize     : 128*1024;
-            stacksize    : 8192;
-            DllScanSupported:false;
-            use_function_relative_addresses : false
-          );
-
-  implementation
-
-initialization
-{$ifdef cpu68}
-  {$ifdef AMIGA}
-    set_source_info(system_m68k_Amiga);
-  {$endif amiga}
-{$endif cpu68}
-end.
-{
-  $Log$
-  Revision 1.3  2002-08-13 18:01:51  carl
-    * rename swatoperands to swapoperands
-    + m68k first compilable version (still needs a lot of testing):
-        assembler generator, system information , inline
-        assembler reader.
-
-  Revision 1.2  2002/08/12 15:08:39  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.1  2002/07/26 21:15:38  florian
-    * rewrote the system handling
-}

+ 0 - 103
compiler/i_atari.pas

@@ -1,103 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support information structures for atari
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
-}
-{ This unit implements support information structures for atari. }
-unit i_atari;
-
-  interface
-
-    uses
-       systems;
-
-    const
-       system_m68k_atari_info : tsysteminfo =
-          (
-            system       : target_m68k_Atari;
-            name         : 'Atari ST/STE';
-            shortname    : 'atari';
-            flags        : [];
-            cpu          : cpu_m68k;
-            short_name   : 'ATARI';
-            unit_env     : '';
-            extradefines : '';
-            sharedlibext : '.dll';
-            staticlibext : '.a';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '.tpp';
-            defext       : '';
-            scriptext    : '';
-            smartext     : '.sl';
-            unitext      : '.ppt';
-            unitlibext   : '.ppl';
-            asmext       : '.s';
-            objext       : '.o';
-            resext       : '.res';
-            resobjext    : '.or';
-            staticlibprefix : '';
-            sharedlibprefix : '';
-            Cprefix      : '_';
-            newline      : #10;
-            dirsep       : '/';
-            files_case_relevent : true;
-            assem        : as_gas;
-            assemextern  : as_gas;
-            link         : ld_m68k_atari;
-            linkextern   : ld_m68k_atari;
-            ar           : ar_m68k_ar;
-            res          : res_none;
-            script       : script_unix;
-            endian       : endian_big;
-            stackalignment : 2;
-            maxCrecordalignment : 4;
-            heapsize     : 16*1024;
-            stacksize    : 8192;
-            DllScanSupported:false;
-            use_function_relative_addresses : false
-          );
-
-  implementation
-
-initialization
-{$ifdef cpu68}
-  {$ifdef atari}
-    set_source_info(system_m68k_atari_info);
-  {$endif atari}
-{$endif cpu68}
-end.
-{
-  $Log$
-  Revision 1.3  2002-08-13 18:01:51  carl
-    * rename swatoperands to swapoperands
-    + m68k first compilable version (still needs a lot of testing):
-        assembler generator, system information , inline
-        assembler reader.
-
-  Revision 1.2  2002/08/12 15:08:39  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.1  2002/07/26 21:15:38  florian
-    * rewrote the system handling
-}

+ 0 - 115
compiler/i_beos.pas

@@ -1,115 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support information structures for BeOS
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
-}
-{ This unit implements support information structures for BeOS. }
-unit i_beos;
-
-  interface
-
-    uses
-       systems;
-
-    const
-       system_i386_beos_info : tsysteminfo =
-          (
-            system       : system_i386_BeOS;
-            name         : 'Beos for i386';
-            shortname    : 'Beos';
-            flags        : [tf_under_development];
-            cpu          : cpu_i386;
-            unit_env     : 'BEOSUNITS';
-            extradefines : '';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '';
-            defext       : '.def';
-            scriptext    : '.sh';
-            smartext     : '.sl';
-            unitext      : '.ppu';
-            unitlibext   : '.ppl';
-            asmext       : '.s';
-            objext       : '.o';
-            resext       : '.res';
-            resobjext    : '.or';
-            sharedlibext : '.so';
-            staticlibext : '.a';
-            staticlibprefix : 'libp';
-            sharedlibprefix : 'lib';
-            sharedClibext : '.so';
-            staticClibext : '.a';
-            staticClibprefix : 'lib';
-            sharedClibprefix : 'lib';
-            Cprefix      : '';
-            newline      : #10;
-            dirsep       : '/';
-            files_case_relevent : true;
-            assem        : as_gas;
-            assemextern  : as_gas;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_gnu_ar;
-            res          : res_none;
-            script       : script_unix;
-            endian       : endian_little;
-            alignment    :
-              (
-                procalign       : 4;
-                loopalign       : 4;
-                jumpalign       : 0;
-                constalignmin   : 0;
-                constalignmax   : 4;
-                varalignmin     : 0;
-                varalignmax     : 4;
-                localalignmin   : 0;
-                localalignmax   : 4;
-                paraalign       : 4;
-                recordalignmin  : 0;
-                recordalignmax  : 2;
-                maxCrecordalign : 4
-              );
-            first_parm_offset : 8;
-            heapsize     : 256*1024;
-            stacksize    : 8192;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
-          );
-
-  implementation
-
-initialization
-{$ifdef cpu86}
-  {$ifdef beos}
-    set_source_info(system_i386_beos_info);
-  {$endif beos}
-{$endif cpu86}
-end.
-{
-  $Log$
-  Revision 1.2  2002-08-12 15:08:39  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.1  2002/07/26 21:15:38  florian
-    * rewrote the system handling
-}

+ 0 - 257
compiler/i_fbsd.pas

@@ -1,257 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support information structures for FreeBSD/NetBSD
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
-}
-{ This unit implements support information structures for FreeBSD/NetBSD. }
-unit i_fbsd;
-
-  interface
-
-    uses
-       systems;
-
-    const
-       system_i386_freebsd_info : tsysteminfo =
-          (
-            system       : system_i386_FreeBSD;
-            name         : 'FreeBSD/ELF for i386';
-            shortname    : 'FreeBSD';
-            flags        : [];
-            cpu          : cpu_i386;
-            unit_env     : 'BSDUNITS';
-            extradefines : 'UNIX;BSD';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '';
-            defext       : '.def';
-            scriptext    : '.sh';
-            smartext     : '.sl';
-            unitext      : '.ppu';
-            unitlibext   : '.ppl';
-            asmext       : '.s';
-            objext       : '.o';
-            resext       : '.res';
-            resobjext    : '.or';
-            sharedlibext : '.so';
-            staticlibext : '.a';
-            staticlibprefix : 'libp';
-            sharedlibprefix : 'lib';
-            sharedClibext : '.so';
-            staticClibext : '.a';
-            staticClibprefix : 'lib';
-            sharedClibprefix : 'lib';
-            Cprefix      : '';
-            newline      : #10;
-            dirsep       : '/';
-            files_case_relevent : true;
-            assem        : as_i386_elf32;
-            assemextern  : as_gas;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_gnu_ar;
-            res          : res_none;
-            script       : script_unix;
-            endian       : endian_little;
-            alignment    :
-              (
-                procalign       : 4;
-                loopalign       : 4;
-                jumpalign       : 0;
-                constalignmin   : 0;
-                constalignmax   : 4;
-                varalignmin     : 0;
-                varalignmax     : 4;
-                localalignmin   : 0;
-                localalignmax   : 4;
-                paraalign       : 4;
-                recordalignmin  : 0;
-                recordalignmax  : 2;
-                maxCrecordalign : 4
-              );
-            first_parm_offset : 8;
-            heapsize    : 256*1024;
-            stacksize   : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
-          );
-
-       system_i386_netbsd_info : tsysteminfo =
-          (
-            system       : system_i386_NetBSD;
-            name         : 'NetBSD for i386';
-            shortname    : 'NetBSD';
-            flags        : [tf_under_development];
-            cpu          : cpu_i386;
-            unit_env     : 'BSDUNITS';
-            extradefines : 'UNIX;BSD';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '';
-            defext       : '.def';
-            scriptext    : '.sh';
-            smartext     : '.sl';
-            unitext      : '.ppu';
-            unitlibext   : '.ppl';
-            asmext       : '.s';
-            objext       : '.o';
-            resext       : '.res';
-            resobjext    : '.or';
-            sharedlibext : '.so';
-            staticlibext : '.a';
-            staticlibprefix : 'libp';
-            sharedlibprefix : 'lib';
-            sharedClibext : '.so';
-            staticClibext : '.a';
-            staticClibprefix : 'lib';
-            sharedClibprefix : 'lib';
-            Cprefix      : '_';
-            newline      : #10;
-            dirsep       : '/';
-            files_case_relevent : true;
-            assem        : as_gas;
-            assemextern  : as_gas;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_gnu_ar;
-            res          : res_none;
-            script       : script_unix;
-            endian       : endian_little;
-            alignment    :
-              (
-                procalign       : 4;
-                loopalign       : 4;
-                jumpalign       : 0;
-                constalignmin   : 0;
-                constalignmax   : 1;
-                varalignmin     : 0;
-                varalignmax     : 1;
-                localalignmin   : 0;
-                localalignmax   : 1;
-                paraalign       : 4;
-                recordalignmin  : 0;
-                recordalignmax  : 2;
-                maxCrecordalign : 4
-              );
-            first_parm_offset : 8;
-            heapsize    : 256*1024;
-            stacksize   : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
-          );
-
-       system_m68k_netbsd_info : tsysteminfo =
-          (
-            system       : system_m68k_NetBSD;
-            name         : 'NetBSD for m68k';
-            shortname    : 'NetBSD';
-            flags        : [tf_under_development];
-            cpu          : cpu_m68k;
-            unit_env     : 'BSDUNITS';
-            extradefines : 'UNIX;BSD';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '';
-            defext       : '.def';
-            scriptext    : '.sh';
-            smartext     : '.sl';
-            unitext      : '.ppu';
-            unitlibext   : '.ppl';
-            asmext       : '.s';
-            objext       : '.o';
-            resext       : '.res';
-            resobjext    : '.or';
-            sharedlibext : '.so';
-            staticlibext : '.a';
-            staticlibprefix : 'libp';
-            sharedlibprefix : 'lib';
-            sharedClibext : '.so';
-            staticClibext : '.a';
-            staticClibprefix : 'lib';
-            sharedClibprefix : 'lib';
-            Cprefix      : '';
-            newline      : #10;
-            dirsep       : '/';
-            files_case_relevent : true;
-            assem        : as_gas;
-            assemextern  : as_gas;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_gnu_ar;
-            res          : res_none;
-            script       : script_unix;
-            endian       : endian_big;
-            alignment    :
-              (
-                procalign       : 4;
-                loopalign       : 4;
-                jumpalign       : 0;
-                constalignmin   : 0;
-                constalignmax   : 1;
-                varalignmin     : 0;
-                varalignmax     : 1;
-                localalignmin   : 0;
-                localalignmax   : 1;
-                paraalign       : 4;
-                recordalignmin  : 0;
-                recordalignmax  : 2;
-                maxCrecordalign : 4
-              );
-            first_parm_offset : 8;
-            heapsize    : 256*1024;
-            stacksize   : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
-          );
-
-  implementation
-
-initialization
-{$ifdef cpu86}
-  {$ifdef FreeBSD}
-     set_source_info(system_i386_FreeBSD_info);
-  {$endif}
-  {$ifdef NetBSD}
-     set_source_info(system_i386_NetBSD_info);
-  {$endif}
-{$endif cpu86}
-{$ifdef cpu68}
-  {$ifdef NetBSD}
-     set_source_info(system_m68k_NetBSD_info);
-  {$endif NetBSD}
-{$endif cpu68}
-end.
-{
-  $Log$
-  Revision 1.3  2002-08-13 18:01:51  carl
-    * rename swatoperands to swapoperands
-    + m68k first compilable version (still needs a lot of testing):
-        assembler generator, system information , inline
-        assembler reader.
-
-  Revision 1.2  2002/08/12 15:08:39  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.1  2002/07/26 21:15:38  florian
-    * rewrote the system handling
-}

+ 0 - 115
compiler/i_go32v2.pas

@@ -1,115 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support information structures for go32v2
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
-}
-{ This unit implements support information structures for go32v2. }
-unit i_go32v2;
-
-  interface
-
-    uses
-       systems;
-
-    const
-       system_i386_go32v2_info : tsysteminfo =
-          (
-            system       : system_i386_GO32V2;
-            name         : 'GO32 V2 DOS extender';
-            shortname    : 'Go32v2';
-            flags        : [];
-            cpu          : cpu_i386;
-            unit_env     : 'GO32V2UNITS';
-            extradefines : 'DPMI';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '.exe';
-            defext       : '.def';
-            scriptext    : '.bat';
-            smartext     : '.sl';
-            unitext      : '.ppu';
-            unitlibext   : '.ppl';
-            asmext       : '.s';
-            objext       : '.o';
-            resext       : '.res';
-            resobjext    : '.or';
-            sharedlibext : '.dll';
-            staticlibext : '.a';
-            staticlibprefix : '';
-            sharedlibprefix : '';
-            sharedClibext : '.dll';
-            staticClibext : '.a';
-            staticClibprefix : '';
-            sharedClibprefix : '';
-            Cprefix      : '_';
-            newline      : #13#10;
-            dirsep       : '\';
-            files_case_relevent : false;
-            assem        : as_i386_coff;
-            assemextern  : as_gas;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_gnu_ar;
-            res          : res_none;
-            script       : script_dos;
-            endian       : endian_little;
-            alignment    :
-              (
-                procalign       : 4;
-                loopalign       : 4;
-                jumpalign       : 0;
-                constalignmin   : 0;
-                constalignmax   : 4;
-                varalignmin     : 0;
-                varalignmax     : 4;
-                localalignmin   : 0;
-                localalignmax   : 4;
-                paraalign       : 2;
-                recordalignmin  : 0;
-                recordalignmax  : 2;
-                maxCrecordalign : 4
-              );
-            first_parm_offset : 8;
-            heapsize     : 2048*1024;
-            stacksize    : 262144;
-            DllScanSupported : false;
-            use_function_relative_addresses : true
-          );
-
-  implementation
-
-initialization
-{$ifdef cpu86}
-  {$ifdef go32v2}
-    set_source_info(system_i386_go32v2_info);
-  {$endif go32v2}
-{$endif cpu86}
-end.
-{
-  $Log$
-  Revision 1.2  2002-08-12 15:08:39  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.1  2002/07/26 21:15:38  florian
-    * rewrote the system handling
-}

+ 0 - 464
compiler/i_linux.pas

@@ -1,464 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support information structures for linux
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
-}
-{ This unit implements support information structures for linux. }
-unit i_linux;
-
-  interface
-
-    uses
-       systems;
-
-    const
-       system_i386_linux_info : tsysteminfo =
-          (
-            system       : system_i386_LINUX;
-            name         : 'Linux for i386';
-            shortname    : 'Linux';
-            flags        : [];
-            cpu          : cpu_i386;
-            unit_env     : 'LINUXUNITS';
-            extradefines : 'UNIX';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '';
-            defext       : '.def';
-            scriptext    : '.sh';
-            smartext     : '.sl';
-            unitext      : '.ppu';
-            unitlibext   : '.ppl';
-            asmext       : '.s';
-            objext       : '.o';
-            resext       : '.res';
-            resobjext    : '.or';
-            sharedlibext : '.so';
-            staticlibext : '.a';
-            staticlibprefix : 'libp';
-            sharedlibprefix : 'lib';
-            sharedClibext : '.so';
-            staticClibext : '.a';
-            staticClibprefix : 'lib';
-            sharedClibprefix : 'lib';
-            Cprefix      : '';
-            newline      : #10;
-            dirsep       : '/';
-            files_case_relevent : true;
-            assem        : as_i386_elf32;
-            assemextern  : as_gas;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_gnu_ar;
-            res          : res_none;
-            script       : script_unix;
-            endian       : endian_little;
-            alignment    :
-              (
-                procalign       : 4;
-                loopalign       : 4;
-                jumpalign       : 0;
-                constalignmin   : 0;
-                constalignmax   : 4;
-                varalignmin     : 0;
-                varalignmax     : 4;
-                localalignmin   : 0;
-                localalignmax   : 4;
-                paraalign       : 4;
-                recordalignmin  : 0;
-                recordalignmax  : 2;
-                maxCrecordalign : 4
-              );
-            first_parm_offset : 8;
-            heapsize     : 256*1024;
-            stacksize    : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
-          );
-
-       system_m68k_linux_info : tsysteminfo =
-          (
-            system       : system_m68k_linux;
-            name         : 'Linux for m68k';
-            shortname    : 'linux';
-            flags        : [];
-            cpu          : cpu_m68k;
-            unit_env     : 'LINUXUNITS';
-            extradefines : 'UNIX';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '';
-            defext       : '';
-            scriptext    : '.sh';
-            smartext     : '.sl';
-            unitext      : '.ppu';
-            unitlibext   : '.ppl';
-            asmext       : '.s';
-            objext       : '.o';
-            resext       : '.res';
-            resobjext    : '.or';
-            sharedlibext : '.so';
-            staticlibext : '.a';
-            staticlibprefix : 'libp';
-            sharedlibprefix : 'lib';
-            sharedClibext : '.so';
-            staticClibext : '.a';
-            staticClibprefix : 'lib';
-            sharedClibprefix : 'lib';
-            Cprefix      : '';
-            newline      : #10;
-            dirsep       : '/';
-            files_case_relevent : true;
-            assem        : as_gas;
-            assemextern  : as_gas;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_gnu_ar;
-            res          : res_none;
-            script       : script_unix;
-            endian       : endian_big;
-            alignment    :
-              (
-                procalign       : 4;
-                loopalign       : 4;
-                jumpalign       : 0;
-                constalignmin   : 0;
-                constalignmax   : 4;
-                varalignmin     : 0;
-                varalignmax     : 4;
-                localalignmin   : 0;
-                localalignmax   : 4;
-                paraalign       : 4;
-                recordalignmin  : 0;
-                recordalignmax  : 2;
-                maxCrecordalign : 4
-              );
-            first_parm_offset : 8;
-            heapsize     : 128*1024;
-            stacksize    : 32*1024*1024;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
-          );
-
-       system_powerpc_linux_info : tsysteminfo =
-          (
-            system       : system_powerpc_LINUX;
-            name         : 'Linux for PowerPC';
-            shortname    : 'linux';
-            flags        : [];
-            cpu          : cpu_powerpc;
-            unit_env     : '';
-            extradefines : 'UNIX';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '';
-            defext       : '.def';
-            scriptext    : '.sh';
-            smartext     : '.sl';
-            unitext      : '.ppu';
-            unitlibext   : '.ppl';
-            asmext       : '.s';
-            objext       : '.o';
-            resext       : '.res';
-            resobjext    : '.or';
-            sharedlibext : '.so';
-            staticlibext : '.s';
-            staticlibprefix : 'libp';
-            sharedlibprefix : 'lib';
-            sharedClibext : '.so';
-            staticClibext : '.a';
-            staticClibprefix : 'lib';
-            sharedClibprefix : 'lib';
-            Cprefix      : '';
-            newline      : #10;
-            dirsep       : '/';
-            files_case_relevent : true;
-            assem        : as_gas;
-            assemextern  : as_gas;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_gnu_ar;
-            res          : res_none;
-            script       : script_unix;
-            endian       : endian_big;
-            alignment    :
-              (
-                procalign       : 4;
-                loopalign       : 4;
-                jumpalign       : 0;
-                constalignmin   : 0;
-                constalignmax   : 4;
-                varalignmin     : 0;
-                varalignmax     : 4;
-                localalignmin   : 0;
-                localalignmax   : 4;
-                paraalign       : 4;
-                recordalignmin  : 0;
-                recordalignmax  : 2;
-                maxCrecordalign : 4
-              );
-            first_parm_offset : 8;
-            heapsize     : 256*1024;
-            stacksize    : 32*1024*1024;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
-          );
-
-       system_alpha_linux_info : tsysteminfo =
-          (
-            system       : system_alpha_LINUX;
-            name         : 'Linux for Alpha';
-            shortname    : 'linux';
-            flags        : [];
-            cpu          : cpu_alpha;
-            unit_env     : 'LINUXUNITS';
-            extradefines : 'UNIX';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '';
-            defext       : '.def';
-            scriptext    : '.sh';
-            smartext     : '.sl';
-            unitext      : '.ppu';
-            unitlibext   : '.ppl';
-            asmext       : '.s';
-            objext       : '.o';
-            resext       : '.res';
-            resobjext    : '.or';
-            sharedlibext : '.so';
-            staticlibext : '.a';
-            staticlibprefix : 'libp';
-            sharedlibprefix : 'lib';
-            sharedClibext : '.so';
-            staticClibext : '.a';
-            staticClibprefix : 'lib';
-            sharedClibprefix : 'lib';
-            Cprefix      : '';
-            newline      : #10;
-            dirsep       : '/';
-            files_case_relevent : true;
-            assem        : as_gas;
-            assemextern  : as_gas;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_gnu_ar;
-            res          : res_none;
-            script       : script_unix;
-            endian       : endian_little;
-            alignment    :
-              (
-                procalign       : 4;
-                loopalign       : 4;
-                jumpalign       : 0;
-                constalignmin   : 0;
-                constalignmax   : 4;
-                varalignmin     : 0;
-                varalignmax     : 4;
-                localalignmin   : 0;
-                localalignmax   : 4;
-                paraalign       : 4;
-                recordalignmin  : 0;
-                recordalignmax  : 2;
-                maxCrecordalign : 4
-              );
-            first_parm_offset : 8;
-            heapsize     : 256*1024;
-            stacksize    : 32*1024*1024;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
-          );
-
-       system_x86_64_linux_info : tsysteminfo =
-          (
-            system       : system_i386_LINUX;
-            name         : 'Linux for x86-64';
-            shortname    : 'linux';
-            flags        : [];
-            cpu          : cpu_x86_64;
-            unit_env     : 'LINUXUNITS';
-            extradefines : 'UNIX';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '';
-            defext       : '.def';
-            scriptext    : '.sh';
-            smartext     : '.sl';
-            unitext      : '.ppu';
-            unitlibext   : '.ppl';
-            asmext       : '.s';
-            objext       : '.o';
-            resext       : '.res';
-            resobjext    : '.or';
-            sharedlibext : '.so';
-            staticlibext : '.a';
-            staticlibprefix : 'libp';
-            sharedlibprefix : 'lib';
-            sharedClibext : '.so';
-            staticClibext : '.a';
-            staticClibprefix : 'lib';
-            sharedClibprefix : 'lib';
-            Cprefix      : '';
-            newline      : #10;
-            dirsep       : '/';
-            files_case_relevent : true;
-            assem        : as_i386_elf32;
-            assemextern  : as_gas;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_gnu_ar;
-            res          : res_none;
-            script       : script_unix;
-            endian       : endian_little;
-            alignment    :
-              (
-                procalign       : 4;
-                loopalign       : 4;
-                jumpalign       : 0;
-                constalignmin   : 0;
-                constalignmax   : 1;
-                varalignmin     : 0;
-                varalignmax     : 1;
-                localalignmin   : 0;
-                localalignmax   : 1;
-                paraalign       : 4;
-                recordalignmin  : 0;
-                recordalignmax  : 2;
-                maxCrecordalign : 4
-              );
-            first_parm_offset : 16;
-            heapsize     : 256*1024;
-            stacksize    : 16*1024;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
-          );
-
-       system_SPARC_linux_info : tsysteminfo =
-          (
-            system       : system_SPARC_Linux;
-            name         : 'Linux for SPARC';
-            shortname    : 'linux';
-            flags        : [];
-            cpu          : cpu_SPARC;
-            unit_env     : 'LINUXUNITS';
-            extradefines : 'UNIX';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '';
-            defext       : '.def';
-            scriptext    : '.sh';
-            smartext     : '.sl';
-            unitext      : '.ppu';
-            unitlibext   : '.ppl';
-            asmext       : '.s';
-            objext       : '.o';
-            resext       : '.res';
-            resobjext    : '.or';
-            sharedlibext : '.so';
-            staticlibext : '.a';
-            staticlibprefix : 'libp';
-            sharedlibprefix : 'lib';
-            sharedClibext : '.so';
-            staticClibext : '.a';
-            staticClibprefix : 'lib';
-            sharedClibprefix : 'lib';
-            Cprefix      : '';
-            newline      : #10;
-            dirsep       : '/';
-            files_case_relevent : true;
-            assem        : as_gas;
-            assemextern  : as_gas;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_gnu_ar;
-            res          : res_none;
-            script       : script_unix;
-            endian       : endian_little;
-            alignment    :
-              (
-                procalign       : 4;
-                loopalign       : 4;
-                jumpalign       : 0;
-                constalignmin   : 0;
-                constalignmax   : 4;
-                varalignmin     : 0;
-                varalignmax     : 4;
-                localalignmin   : 0;
-                localalignmax   : 4;
-                paraalign       : 4;
-                recordalignmin  : 0;
-                recordalignmax  : 2;
-                maxCrecordalign : 4
-              );
-            first_parm_offset : 8;
-            heapsize     : 256*1024;
-            stacksize    : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
-          );
-
-  implementation
-
-initialization
-{$ifdef CPU86}
-  {$ifdef linux}
-    { some FreeBSD versions define linux as well }
-    {$ifndef FreeBSD}
-      set_source_info(system_i386_linux_info);
-    {$endif FreeBSD}
-  {$endif}
-{$endif CPU86}
-{$ifdef CPU68}
-  {$ifdef linux}
-    set_source_info(system_m68k_linux_info);
-  {$endif linux}
-{$endif CPU68}
-{$ifdef CPU86_64}
-  {$ifdef linux}
-    set_source_info(system_x86_64_linux_info);
-  {$endif linux}
-{$endif CPU86_64}
-{$ifdef CPUALPHA}
-  {$ifdef linux}
-    set_source_info(system_sparc_linux_info);
-  {$endif linux}
-{$endif CPUALPHA}
-{$ifdef CPUSPARC}
-  {$ifdef linux}
-    set_source_info(system_sparc_linux_info);
-  {$endif linux}
-{$endif CPUSPARC}
-end.
-{
-  $Log$
-  Revision 1.3  2002-08-13 18:01:51  carl
-    * rename swatoperands to swapoperands
-    + m68k first compilable version (still needs a lot of testing):
-        assembler generator, system information , inline
-        assembler reader.
-
-  Revision 1.2  2002/08/12 15:08:39  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.1  2002/07/26 21:15:38  florian
-    * rewrote the system handling
-}

+ 0 - 118
compiler/i_macos.pas

@@ -1,118 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support information structures for MacOS
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
-}
-{ This unit implements support information structures for MacOS. }
-unit i_macos;
-
-  interface
-
-    uses
-       systems;
-     const
-       system_powerpc_macos_info : tsysteminfo =
-          (
-            system       : system_powerpc_MACOS;
-            name         : 'MacOs (PowerPC)';
-            shortname    : 'MacOSPPC';
-            flags        : [];
-            cpu          : cpu_powerpc;
-            unit_env     : '';
-            extradefines : '';
-            sourceext    : '.pp';
-            pasext       : '.p';
-            exeext       : '';
-            defext       : '';
-            scriptext    : '';
-            smartext     : '.sl';
-            unitext      : '.ppt';
-            unitlibext   : '.ppl';
-            asmext       : '.a';
-            objext       : '.o';
-            resext       : '.res';
-            resobjext    : '.or';
-            sharedlibext : 'Lib';
-            staticlibext : 'Lib';
-            staticlibprefix : '';
-            sharedlibprefix : '';
-            sharedClibext : 'Lib';
-            staticClibext : 'Lib';
-            staticClibprefix : '';
-            sharedClibprefix : '';
-            Cprefix      : '';
-            newline      : #10;
-            dirsep       : ':';
-            files_case_relevent : true;
-            assem        : as_powerpc_mpw;
-            assemextern  : as_powerpc_mpw;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_mpw_ar;
-            res          : res_mpw_res;
-            script       : script_unix;
-            endian       : endian_big;
-            alignment    :
-              (
-                procalign       : 4;
-                loopalign       : 4;
-                jumpalign       : 0;
-                constalignmin   : 0;
-                constalignmax   : 4;
-                varalignmin     : 0;
-                varalignmax     : 4;
-                localalignmin   : 8;
-                localalignmax   : 8;
-                paraalign       : 8;
-                recordalignmin  : 0;
-                recordalignmax  : 2;
-                maxCrecordalign : 16
-              );
-            first_parm_offset : 8;
-            heapsize     : 256*1024;
-            stacksize    : 262144;
-            DllScanSupported:true;
-            use_function_relative_addresses : true
-          );
-
-  implementation
-
-initialization
-{$ifdef cpupowerpc}
-  {$ifdef macos}
-    set_source_info(system_powerpc_macos_info);
-  {$endif macos}
-{$endif cpupowerpc}
-end.
-{
-  $Log$
-  Revision 1.3  2002-08-20 21:40:44  florian
-    + target macos for ppc added
-    + frame work for mpw assembler output
-
-  Revision 1.2  2002/08/12 15:08:39  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.1  2002/07/26 21:15:38  florian
-    * rewrote the system handling
-}

+ 0 - 115
compiler/i_nwm.pas

@@ -1,115 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support information structures for Netware modules
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
-}
-{ This unit implements support information structures for Netware modules. }
-unit i_nwm;
-
-  interface
-
-    uses
-       systems;
-
-    const
-       system_i386_netware_info : tsysteminfo =
-          (
-            system       : system_i386_netware;
-            name         : 'Netware for i386';
-            shortname    : 'Netware';
-            flags        : [];
-            cpu          : cpu_i386;
-            unit_env     : 'NETWAREUNITS';
-            extradefines : '';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '.nlm';
-            defext       : '.def';
-            scriptext    : '.sh';
-            smartext     : '.sl';
-            unitext      : '.ppn';
-            unitlibext   : '.ppl';
-            asmext       : '.s';
-            objext       : '.on';
-            resext       : '.res';
-            resobjext    : '.or';
-            sharedlibext : '.nlm';
-            staticlibext : '.a';
-            staticlibprefix : '';
-            sharedlibprefix : '';
-            sharedClibext : '.nlm';
-            staticClibext : '.a';
-            staticClibprefix : '';
-            sharedClibprefix : '';
-            Cprefix      : '';
-            newline      : #13#10;
-            dirsep       : '\';
-            files_case_relevent : false;
-            assem        : as_i386_elf32;
-            assemextern  : as_gas;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_gnu_ar;
-            res          : res_none;
-            script       : script_unix;
-            endian       : endian_little;
-            alignment    :
-              (
-                procalign       : 4;
-                loopalign       : 4;
-                jumpalign       : 0;
-                constalignmin   : 0;
-                constalignmax   : 1;
-                varalignmin     : 0;
-                varalignmax     : 1;
-                localalignmin   : 0;
-                localalignmax   : 1;
-                paraalign       : 4;
-                recordalignmin  : 0;
-                recordalignmax  : 2;
-                maxCrecordalign : 4
-              );
-            first_parm_offset : 8;
-            heapsize     : 256*1024;
-            stacksize    : 8192;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
-          );
-
-  implementation
-
-initialization
-{$ifdef CPU86}
-  {$ifdef netware}
-    set_source_info(target_i386_netware_info);
-  {$endif netware}
-{$endif CPU86}
-end.
-{
-  $Log$
-  Revision 1.2  2002-08-12 15:08:39  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.1  2002/07/26 21:15:38  florian
-    * rewrote the system handling
-}

+ 0 - 127
compiler/i_os2.pas

@@ -1,127 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support information structures for OS/2
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
-}
-{ This unit implements support information structures for OS/2. }
-unit i_os2;
-
-  interface
-
-    uses
-       systems;
-
-    const
-       res_emxbind_info : tresinfo =
-          (
-            id     : res_emxbind;
-            resbin : 'emxbind';
-            rescmd : '-b -r $RES $OBJ'
-            (* Not really used - see TLinkeros2.SetDefaultInfo in t_os2.pas. *)
-          );
-
-       system_i386_os2_info : tsysteminfo =
-          (
-            system       : system_i386_OS2;
-            name         : 'OS/2 via EMX';
-            shortname    : 'OS2';
-            flags        : [tf_need_export];
-            cpu          : cpu_i386;
-            unit_env     : 'OS2UNITS';
-            extradefines : '';
-            sourceext    : '.pas';
-            pasext       : '.pp';
-            exeext       : '.exe';
-            defext       : '.def';
-            scriptext    : '.cmd';
-            smartext     : '.sl';
-            unitext      : '.ppo';
-            unitlibext   : '.ppl';
-            asmext       : '.so2';
-            objext       : '.oo2';
-            resext       : '.res';
-            resobjext    : '.oor';
-            sharedlibext : '.ao2';
-            staticlibext : '.ao2';
-            staticlibprefix : '';
-            sharedlibprefix : '';
-            sharedClibext : 'dll';
-            staticClibext : '.a';
-            staticClibprefix : '';
-            sharedClibprefix : '';
-            Cprefix      : '_';
-            newline      : #13#10;
-            dirsep       : '\';
-            files_case_relevent : false;
-            assem        : as_i386_as_aout;
-            assemextern  : as_i386_as_aout;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_gnu_ar;
-            res          : res_emxbind;
-            script       : script_dos;
-            endian       : endian_little;
-            alignment    :
-              (
-                procalign       : 4;
-                loopalign       : 4;
-                jumpalign       : 0;
-                constalignmin   : 0;
-                constalignmax   : 4;
-                varalignmin     : 0;
-                varalignmax     : 4;
-                localalignmin   : 0;
-                localalignmax   : 4;
-                paraalign       : 4;
-                recordalignmin  : 0;
-                recordalignmax  : 2;
-                maxCrecordalign : 4
-              );
-            first_parm_offset : 8;
-            heapsize     : 256*1024;
-            stacksize    : 256*1024;
-            DllScanSupported:true;
-            use_function_relative_addresses : false
-          );
-
-
-  implementation
-
-initialization
-{$ifdef CPU86}
-  {$ifdef os2}
-    set_source_info(system_i386_os2_info);
-    { OS/2 via EMX can be run under DOS as well }
-    if (OS_Mode=osDOS) or (OS_Mode=osDPMI) then
-      source_info.scriptext := '.bat';
-  {$endif os2}
-{$endif CPU86}
-end.
-{
-  $Log$
-  Revision 1.2  2002-08-12 15:08:39  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.1  2002/07/26 21:15:38  florian
-    * rewrote the system handling
-}

+ 0 - 103
compiler/i_palmos.pas

@@ -1,103 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support information structures for PalmOS
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
-}
-{ This unit implements support information structures for PalmOS. }
-unit i_palmos;
-
-  interface
-
-    uses
-       systems;
-
-    const
-       system_m68k_palmos_info : tsysteminfo =
-          (
-            system       : system_m68k_PalmOS;
-            name         : 'PalmOS';
-            shortname    : 'palmos';
-            flags        : [tf_code_small,tf_static_a5_based];
-            cpu          : cpu_m68k;
-            short_name   : 'PALMOS';
-            unit_env     : 'PALMUNITS';
-            extradefines : '';
-            sharedlibext : '.so';
-            staticlibext : '.a';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '';
-            defext       : '';
-            scriptext    : '.sh';
-            smartext     : '.sl';
-            unitext      : '.ppu';
-            unitlibext   : '.ppl';
-            asmext       : '.s';
-            objext       : '.o';
-            resext       : '.res';
-            resobjext    : '.or';
-            staticlibprefix : 'libp';
-            sharedlibprefix : 'lib';
-            Cprefix      : '_';
-            newline      : #10;
-            dirsep       : '/';
-            files_case_relevent : true;
-            assem        : as_gas;
-            assemextern  : as_gas;
-            link         : ld_m68k_palmos;
-            linkextern   : ld_m68k_palmos;
-            ar           : ar_m68k_ar;
-            res          : res_none;
-            script       : script_unix;
-            endian       : endian_big;
-            stackalignment : 2;
-            maxCrecordalignment : 4;
-            heapsize     : 128*1024;
-            stacksize    : 8192;
-            DllScanSupported:false;
-            use_function_relative_addresses : false
-          );
-
-  implementation
-
-initialization
-{$ifdef cpu68}
-  {$ifdef palmos}
-    set_source_info(system_m68k_palmos_info);
-  {$endif palmos}
-{$endif cpu68}
-end.
-{
-  $Log$
-  Revision 1.3  2002-08-13 18:01:51  carl
-    * rename swatoperands to swapoperands
-    + m68k first compilable version (still needs a lot of testing):
-        assembler generator, system information , inline
-        assembler reader.
-
-  Revision 1.2  2002/08/12 15:08:39  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.1  2002/07/26 21:15:38  florian
-    * rewrote the system handling
-}

+ 0 - 116
compiler/i_sunos.pas

@@ -1,116 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support information structures for SunOS
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
-}
-{ This unit implements support information structures for SunOS. }
-unit i_sunos;
-
-  interface
-
-    uses
-       systems;
-
-    const
-       system_i386_sunos_info : tsysteminfo =
-          (
-            system       : system_i386_sunos;
-            name         : 'SunOS/ELF for i386';
-            shortname    : 'SunOS';
-            flags        : [tf_under_development];
-            cpu          : cpu_i386;
-            unit_env     : 'SUNOSUNITS';
-            extradefines : 'UNIX;SOLARIS;LIBC';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '';
-            defext       : '.def';
-            scriptext    : '.sh';
-            smartext     : '.sl';
-            unitext      : '.ppu';
-            unitlibext   : '.ppl';
-            asmext       : '.s';
-            objext       : '.o';
-            resext       : '.res';
-            resobjext    : '.or';
-            sharedlibext : '.so';
-            staticlibext : '.a';
-            staticlibprefix : 'libp';
-            sharedlibprefix : 'lib';
-            sharedClibext : '.so';
-            staticClibext : '.a';
-            staticClibprefix : 'lib';
-            sharedClibprefix : 'lib';
-            Cprefix      : '';
-            newline      : #10;
-            dirsep       : '/';
-            files_case_relevent : true;
-            assem        : as_gas;
-            assemextern  : as_gas;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_gnu_ar;
-            res          : res_none;
-            script       : script_unix;
-            endian       : endian_little;
-            alignment    :
-              (
-                procalign       : 4;
-                loopalign       : 4;
-                jumpalign       : 0;
-                constalignmin   : 0;
-                constalignmax   : 1;
-                varalignmin     : 0;
-                varalignmax     : 1;
-                localalignmin   : 0;
-                localalignmax   : 1;
-                paraalign       : 4;
-                recordalignmin  : 0;
-                recordalignmax  : 2;
-                maxCrecordalign : 4
-              );
-            first_parm_offset : 8;
-            heapsize     : 256*1024;
-            stacksize    : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
-          );
-
-
-  implementation
-
-initialization
-{$ifdef CPU86}
-  {$ifdef sunos}
-    set_source_info(system_i386_sunos_info);
-  {$endif sunos}
-{$endif CPU86}
-end.
-{
-  $Log$
-  Revision 1.2  2002-08-12 15:08:39  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.1  2002/07/26 21:15:38  florian
-    * rewrote the system handling
-}

+ 0 - 117
compiler/i_wdosx.pas

@@ -1,117 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support information structures for win32
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
-}
-{ This unit implements support information structures for wdosx. }
-unit i_wdosx;
-
-  interface
-
-    uses
-       systems;
-
-    const
-       system_i386_wdosx_info : tsysteminfo =
-          (
-            system       : system_i386_wdosx;
-            name         : 'WDOSX DOS extender';
-            shortname    : 'WDOSX';
-            flags        : [];
-            cpu          : cpu_i386;
-            unit_env     : 'WDOSXUNITS';
-            extradefines : 'MSWINDOWS';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '.exe';
-            defext       : '.def';
-            scriptext    : '.bat';
-            smartext     : '.sld';
-            unitext      : '.ppd';
-            unitlibext   : '.ppl';
-            asmext       : '.sd';
-            objext       : '.od';
-            resext       : '.rc';
-            resobjext    : '.odr';
-            sharedlibext : '.dll';
-            staticlibext : '.ad';
-            staticlibprefix : 'libp';
-            sharedlibprefix : '';
-            sharedClibext : '.dll';
-            staticClibext : '.a';
-            staticClibprefix : 'lib';
-            sharedClibprefix : '';
-            Cprefix      : '_';
-            newline      : #13#10;
-            dirsep       : '\';
-            files_case_relevent : false;
-            assem        : as_i386_pecoffwdosx;
-            assemextern  : as_i386_asw;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_gnu_arw;
-            res          : res_gnu_windres;
-            script       : script_dos;
-            endian       : endian_little;
-            alignment    :
-              (
-                procalign       : 4;
-                loopalign       : 4;
-                jumpalign       : 0;
-                constalignmin   : 0;
-                constalignmax   : 4;
-                varalignmin     : 0;
-                varalignmax     : 4;
-                localalignmin   : 0;
-                localalignmax   : 4;
-                paraalign       : 4;
-                recordalignmin  : 0;
-                recordalignmax  : 2;
-                maxCrecordalign : 16
-              );
-            first_parm_offset : 8;
-            heapsize     : 256*1024;
-            stacksize    : 32*1024*1024;
-            DllScanSupported:true;
-            use_function_relative_addresses : true
-          );
-
-  implementation
-
-initialization
-{$ifdef CPU86}
-  {$ifdef WIN32}
-    {$ifdef WDOSX}
-      set_source_info(system_i386_wdosx_info);
-    {$endif WDOSX}
-  {$endif WIN32}
-{$endif CPU86}
-end.
-{
-  $Log$
-  Revision 1.2  2002-08-12 15:08:39  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.1  2002/07/26 21:15:38  florian
-    * rewrote the system handling
-}

+ 0 - 132
compiler/i_win32.pas

@@ -1,132 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support information structures for win32
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
-}
-{ This unit implements support information structures for win32. }
-unit i_win32;
-
-  interface
-
-    uses
-       systems;
-
-    const
-      ar_gnu_arw_info : tarinfo =
-          (
-            id    : ar_gnu_arw;
-            arcmd : 'arw rs $LIB $FILES'
-          );
-
-    const
-      res_gnu_windres_info : tresinfo =
-          (
-            id     : res_gnu_windres;
-            resbin : 'windres';
-            rescmd : '--include $INC -O coff -o $OBJ $RES'
-          );
-
-    const
-       system_i386_win32_info : tsysteminfo =
-          (
-            system       : system_i386_WIN32;
-            name         : 'Win32 for i386';
-            shortname    : 'Win32';
-            flags        : [];
-            cpu          : cpu_i386;
-            unit_env     : 'WIN32UNITS';
-            extradefines : 'MSWINDOWS';
-            sourceext    : '.pp';
-            pasext       : '.pas';
-            exeext       : '.exe';
-            defext       : '.def';
-            scriptext    : '.bat';
-            smartext     : '.slw';
-            unitext      : '.ppw';
-            unitlibext   : '.ppl';
-            asmext       : '.sw';
-            objext       : '.ow';
-            resext       : '.rc';
-            resobjext    : '.owr';
-            sharedlibext : '.dll';
-            staticlibext : '.aw';
-            staticlibprefix : 'libp';
-            sharedlibprefix : '';
-            sharedClibext : '.dll';
-            staticClibext : '.a';
-            staticClibprefix : 'lib';
-            sharedClibprefix : '';
-            Cprefix      : '_';
-            newline      : #13#10;
-            dirsep       : '\';
-            files_case_relevent : false;
-            assem        : as_i386_pecoff;
-            assemextern  : as_i386_asw;
-            link         : nil;
-            linkextern   : nil;
-            ar           : ar_gnu_arw;
-            res          : res_gnu_windres;
-            script       : script_dos;
-            endian       : endian_little;
-            alignment    :
-              (
-                procalign       : 4;
-                loopalign       : 4;
-                jumpalign       : 0;
-                constalignmin   : 0;
-                constalignmax   : 4;
-                varalignmin     : 0;
-                varalignmax     : 4;
-                localalignmin   : 0;
-                localalignmax   : 4;
-                paraalign       : 4;
-                recordalignmin  : 0;
-                recordalignmax  : 2;
-                maxCrecordalign : 16
-              );
-            first_parm_offset : 8;
-            heapsize     : 256*1024;
-            stacksize    : 262144;
-            DllScanSupported:true;
-            use_function_relative_addresses : true
-          );
-
-  implementation
-
-initialization
-{$ifdef CPU86}
-  {$ifdef WIN32}
-    {$ifndef WDOSX}
-      set_source_info(system_i386_win32_info);
-    {$endif WDOSX}
-  {$endif WIN32}
-{$endif CPU86}
-end.
-{
-  $Log$
-  Revision 1.2  2002-08-12 15:08:39  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.1  2002/07/26 21:15:38  florian
-    * rewrote the system handling
-}

+ 0 - 70
compiler/targets/t_amiga.pas

@@ -1,70 +0,0 @@
-{
-    $Id$
-    Copyright (c) 2001-2002 by Peter Vreman
-
-    This unit implements support import,export,link routines
-    for the (i386) Amiga target
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************
-}
-unit t_amiga;
-
-{$i fpcdefs.inc}
-
-interface
-
-
-implementation
-
-    uses
-       link,
-       cutils,cclasses,
-       globtype,globals,systems,verbose,script,fmodule,i_amiga;
-
-{*****************************************************************************
-                                     Initialize
-*****************************************************************************}
-
-initialization
-  RegisterTarget(system_m68k_amiga_info);
-end.
-{
-  $Log$
-  Revision 1.12  2002-07-26 21:15:45  florian
-    * rewrote the system handling
-
-  Revision 1.11  2002/05/18 13:34:26  peter
-    * readded missing revisions
-
-  Revision 1.10  2002/05/16 19:46:53  carl
-  + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
-  + try to fix temp allocation (still in ifdef)
-  + generic constructor calls
-  + start of tassembler / tmodulebase class cleanup
-
-  Revision 1.8  2002/04/22 18:19:22  carl
-  - remove use_bound_instruction field
-
-  Revision 1.7  2002/04/20 21:43:18  carl
-  * fix stack size for some targets
-  + add offset to parameters from frame pointer info.
-  - remove some unused stuff
-
-  Revision 1.6  2002/04/15 19:16:57  carl
-  - remove size_of_pointer field
-
-}

+ 0 - 70
compiler/targets/t_atari.pas

@@ -1,70 +0,0 @@
-{
-    $Id$
-    Copyright (c) 2001-2002 by Peter Vreman
-
-    This unit implements support import,export,link routines
-    for the (i386) Amiga target
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************
-}
-unit t_atari;
-
-{$i fpcdefs.inc}
-
-interface
-
-
-implementation
-
-    uses
-       link,
-       cutils,cclasses,
-       globtype,globals,systems,verbose,script,fmodule,i_atari;
-
-{*****************************************************************************
-                                     Initialize
-*****************************************************************************}
-
-initialization
-  RegisterTarget(system_m68k_atari_info);
-end.
-{
-  $Log$
-  Revision 1.12  2002-07-26 21:15:45  florian
-    * rewrote the system handling
-
-  Revision 1.11  2002/05/18 13:34:26  peter
-    * readded missing revisions
-
-  Revision 1.10  2002/05/16 19:46:53  carl
-  + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
-  + try to fix temp allocation (still in ifdef)
-  + generic constructor calls
-  + start of tassembler / tmodulebase class cleanup
-
-  Revision 1.8  2002/04/22 18:19:22  carl
-  - remove use_bound_instruction field
-
-  Revision 1.7  2002/04/20 21:43:18  carl
-  * fix stack size for some targets
-  + add offset to parameters from frame pointer info.
-  - remove some unused stuff
-
-  Revision 1.6  2002/04/15 19:16:57  carl
-  - remove size_of_pointer field
-
-}

+ 0 - 528
compiler/targets/t_beos.pas

@@ -1,528 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support import,export,link routines
-    for the (i386) BeOS target.
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************
-}
-unit t_beos;
-
-{$i fpcdefs.inc}
-
-interface
-
-  uses
-    import,export,link;
-
-  type
-    timportlibbeos=class(timportlib)
-      procedure preparelib(const s:string);override;
-      procedure importprocedure(const func,module:string;index:longint;const name:string);override;
-      procedure importvariable(const varname,module:string;const name:string);override;
-      procedure generatelib;override;
-    end;
-
-    texportlibbeos=class(texportlib)
-      procedure preparelib(const s : string);override;
-      procedure exportprocedure(hp : texported_item);override;
-      procedure exportvar(hp : texported_item);override;
-      procedure generatelib;override;
-    end;
-
-    tlinkerbeos=class(texternallinker)
-    private
-      Function  WriteResponseFile(isdll:boolean;makelib:boolean) : Boolean;
-    public
-      constructor Create;override;
-      procedure SetDefaultInfo;override;
-      function  MakeExecutable:boolean;override;
-      function  MakeSharedLibrary:boolean;override;
-    end;
-
-
-implementation
-
-  uses
-    dos,
-    cutils,cclasses,
-    verbose,systems,globtype,globals,
-    symconst,script,
-    fmodule,aasmbase,aasmtai,aasmcpu,cpubase,symsym,i_beos;
-
-{*****************************************************************************
-                               TIMPORTLIBBEOS
-*****************************************************************************}
-
-procedure timportlibbeos.preparelib(const s : string);
-begin
-end;
-
-
-procedure timportlibbeos.importprocedure(const func,module : string;index : longint;const name : string);
-begin
-  { insert sharedlibrary }
-  current_module.linkothersharedlibs.add(SplitName(module),link_allways);
-  { do nothing with the procedure, only set the mangledname }
-  if name<>'' then
-    aktprocdef.setmangledname(name)
-  else
-    message(parser_e_empty_import_name);
-end;
-
-
-procedure timportlibbeos.importvariable(const varname,module:string;const name:string);
-begin
-  { insert sharedlibrary }
-  current_module.linkothersharedlibs.add(SplitName(module),link_allways);
-  { reset the mangledname and turn off the dll_var option }
-  aktvarsym.set_mangledname(name);
-  exclude(aktvarsym.varoptions,vo_is_dll_var);
-end;
-
-
-procedure timportlibbeos.generatelib;
-begin
-end;
-
-
-{*****************************************************************************
-                               TEXPORTLIBBEOS
-*****************************************************************************}
-
-procedure texportlibbeos.preparelib(const s:string);
-begin
-end;
-
-
-procedure texportlibbeos.exportprocedure(hp : texported_item);
-var
-  hp2 : texported_item;
-begin
-  { first test the index value }
-  if (hp.options and eo_index)<>0 then
-   begin
-     Message1(parser_e_no_export_with_index_for_target,'beos');
-     exit;
-   end;
-  { now place in correct order }
-  hp2:=texported_item(current_module._exports.first);
-  while assigned(hp2) and
-     (hp.name^>hp2.name^) do
-    hp2:=texported_item(hp2.next);
-  { insert hp there !! }
-  if assigned(hp2) and (hp2.name^=hp.name^) then
-    begin
-      { this is not allowed !! }
-      Message1(parser_e_export_name_double,hp.name^);
-      exit;
-    end;
-  if hp2=texported_item(current_module._exports.first) then
-    current_module._exports.concat(hp)
-  else if assigned(hp2) then
-    begin
-       hp.next:=hp2;
-       hp.previous:=hp2.previous;
-       if assigned(hp2.previous) then
-         hp2.previous.next:=hp;
-       hp2.previous:=hp;
-    end
-  else
-    current_module._exports.concat(hp);
-end;
-
-
-procedure texportlibbeos.exportvar(hp : texported_item);
-begin
-  hp.is_var:=true;
-  exportprocedure(hp);
-end;
-
-
-procedure texportlibbeos.generatelib;
-var
-  hp2 : texported_item;
-begin
-  hp2:=texported_item(current_module._exports.first);
-  while assigned(hp2) do
-   begin
-     if (not hp2.is_var) and
-        (hp2.sym.typ=procsym) then
-      begin
-        { the manglednames can already be the same when the procedure
-          is declared with cdecl }
-        if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then
-         begin
-{$ifdef i386}
-           { place jump in codesegment }
-           codesegment.concat(Tai_align.Create_op(4,$90));
-           codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
-           codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname)));
-           codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
-{$endif i386}
-         end;
-      end
-     else
-      Message1(parser_e_no_export_of_variables_for_target,'beos');
-     hp2:=texported_item(hp2.next);
-   end;
-end;
-
-
-{*****************************************************************************
-                                  TLINKERBEOS
-*****************************************************************************}
-
-Constructor TLinkerBeos.Create;
-var
-  s : string;
-  i : integer;
-begin
-  Inherited Create;
-  s:=GetEnv('BELIBRARIES');
-  { convert to correct format in case under unix system }
-  for i:=1 to length(s) do
-    if s[i] = ':' then
-      s[i] := ';';
-  { just in case we have a single path : add the ending ; }
-  { since that is what the compiler expects.              }
-  if pos(';',s) = 0 then
-    s:=s+';';
-  LibrarySearchPath.AddPath(s,true); {format:'path1;path2;...'}
-end;
-
-
-procedure TLinkerBeOS.SetDefaultInfo;
-begin
-  with Info do
-   begin
-     ExeCmd[1]:='sh $RES $EXE $OPT $STATIC $STRIP -L.';
-{     ExeCmd[1]:='sh $RES $EXE $OPT $DYNLINK $STATIC $STRIP -L.';}
-      DllCmd[1]:='sh $RES $EXE $OPT -L.';
-
-{     DllCmd[1]:='sh $RES $EXE $OPT -L. -g -nostart -soname=$EXE';
- }    DllCmd[2]:='strip --strip-unneeded $EXE';
-{     DynamicLinker:='/lib/ld-beos.so.2';}
-   end;
-end;
-
-
-function TLinkerBeOS.WriteResponseFile(isdll:boolean;makelib:boolean) : Boolean;
-Var
-  linkres  : TLinkRes;
-  i        : integer;
-  cprtobj,
-  prtobj   : string[80];
-  HPath    : TStringListItem;
-  s        : string;
-  linklibc : boolean;
-begin
-  WriteResponseFile:=False;
-{ set special options for some targets }
-  linklibc:=(SharedLibFiles.Find('root')<>nil);
-
-  prtobj:='prt0';
-  cprtobj:='cprt0';
-  if (cs_profile in aktmoduleswitches) or
-     (not SharedLibFiles.Empty) then
-   begin
-     AddSharedLibrary('root');
-     linklibc:=true;
-   end;
-
-  if (not linklibc) and makelib then
-   begin
-     linklibc:=true;
-     cprtobj:='dllprt.o';
-   end;
-
-  if linklibc then
-   prtobj:=cprtobj;
-
-  { Open link.res file }
-  LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);
-
-  if not isdll then
-   LinkRes.Add('ld -o $1 $2 $3 $4 $5 $6 $7 $8 $9 \')
-  else
-   LinkRes.Add('ld -o $1 -e 0 $2 $3 $4 $5 $6 $7 $8 $9\');
-
-  LinkRes.Add('-m elf_i386_be -shared -Bsymbolic \');
-
-  { Write path to search libraries }
-  HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
-  while assigned(HPath) do
-   begin
-     LinkRes.Add('-L'+HPath.Str+' \');
-     HPath:=TStringListItem(HPath.Next);
-   end;
-  HPath:=TStringListItem(LibrarySearchPath.First);
-  while assigned(HPath) do
-   begin
-     LinkRes.Add('-L'+HPath.Str+' \');
-     HPath:=TStringListItem(HPath.Next);
-   end;
-
-  { try to add crti and crtbegin if linking to C }
-  if linklibc then
-   begin
-     if librarysearchpath.FindFile('crti.o',s) then
-      LinkRes.AddFileName(s+' \');
-     if librarysearchpath.FindFile('crtbegin.o',s) then
-      LinkRes.AddFileName(s+' \');
-{      s:=librarysearchpath.FindFile('start_dyn.o',found)+'start_dyn.o';
-     if found then LinkRes.AddFileName(s+' \');}
-
-     if prtobj<>'' then
-      LinkRes.AddFileName(FindObjectFile(prtobj,'')+' \');
-
-     if isdll then
-      LinkRes.AddFileName(FindObjectFile('func.o','')+' \');
-
-     if librarysearchpath.FindFile('init_term_dyn.o',s) then
-      LinkRes.AddFileName(s+' \');
-   end
-  else
-   begin
-     if prtobj<>'' then
-      LinkRes.AddFileName(FindObjectFile(prtobj,'')+' \');
-   end;
-
-  { main objectfiles }
-  while not ObjectFiles.Empty do
-   begin
-     s:=ObjectFiles.GetFirst;
-     if s<>'' then
-      LinkRes.AddFileName(s+' \');
-   end;
-
-{  LinkRes.Add('-lroot \');
-  LinkRes.Add('/boot/develop/tools/gnupro/lib/gcc-lib/i586-beos/2.9-beos-991026/crtend.o \');
-  LinkRes.Add('/boot/develop/lib/x86/crtn.o \');}
-
-  { Write staticlibraries }
-  if not StaticLibFiles.Empty then
-   begin
-     While not StaticLibFiles.Empty do
-      begin
-        S:=StaticLibFiles.GetFirst;
-        LinkRes.AddFileName(s+' \')
-      end;
-   end;
-
-  { Write sharedlibraries like -l<lib> }
-  if not SharedLibFiles.Empty then
-   begin
-     While not SharedLibFiles.Empty do
-      begin
-        S:=SharedLibFiles.GetFirst;
-        if s<>'c' then
-         begin
-           i:=Pos(target_info.sharedlibext,S);
-           if i>0 then
-            Delete(S,i,255);
-           LinkRes.Add('-l'+s+' \');
-         end
-        else
-         begin
-           linklibc:=true;
-         end;
-      end;
-     { be sure that libc is the last lib }
-{     if linklibc then
-       LinkRes.Add('-lroot');}
-{     if linkdynamic and (Info.DynamicLinker<>'') then
-       LinkRes.AddFileName(Info.DynamicLinker);}
-   end;
-  if isdll then
-   LinkRes.Add('-lroot \');
-
-  { objects which must be at the end }
-  if linklibc then
-   begin
-     if librarysearchpath.FindFile('crtend.o',s) then
-      LinkRes.AddFileName(s+' \');
-     if librarysearchpath.FindFile('crtn.o',s) then
-      LinkRes.AddFileName(s+' \');
-   end;
-
-{ Write and Close response }
-  linkres.Add(' ');
-  linkres.writetodisk;
-  linkres.free;
-
-  WriteResponseFile:=True;
-end;
-
-
-function TLinkerBeOS.MakeExecutable:boolean;
-var
-  binstr,
-  cmdstr  : string;
-  success : boolean;
-{  DynLinkStr : string[60];}
-  StaticStr,
-  StripStr   : string[40];
-begin
-  if not(cs_link_extern in aktglobalswitches) then
-   Message1(exec_i_linking,current_module.exefilename^);
-
-{ Create some replacements }
-  StaticStr:='';
-  StripStr:='';
-{  DynLinkStr:='';}
-  if (cs_link_staticflag in aktglobalswitches) then
-   StaticStr:='-static';
-  if (cs_link_strip in aktglobalswitches) then
-   StripStr:='-s';
-{  If (cs_profile in aktmoduleswitches) or
-     ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
-   DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;}
-
-{ Write used files and libraries }
-  WriteResponseFile(false,false);
-
-{ Call linker }
-  SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.exefilename^);
-  Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
-  Replace(cmdstr,'$STATIC',StaticStr);
-  Replace(cmdstr,'$STRIP',StripStr);
-{  Replace(cmdstr,'$DYNLINK',DynLinkStr);}
-  success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
-
-{ Remove ReponseFile }
-  if (success) and not(cs_link_extern in aktglobalswitches) then
-   RemoveFile(outputexedir+Info.ResName);
-
-  MakeExecutable:=success;   { otherwise a recursive call to link method }
-end;
-
-
-Function TLinkerBeOS.MakeSharedLibrary:boolean;
-var
-  binstr,
-  cmdstr  : string;
-  success : boolean;
-begin
-  MakeSharedLibrary:=false;
-  if not(cs_link_extern in aktglobalswitches) then
-   Message1(exec_i_linking,current_module.sharedlibfilename^);
-
-{ Write used files and libraries }
-  WriteResponseFile(true,true);
-
-{ Call linker }
-  SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
-  Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
-  success:=DoExec(FindUtil(binstr),cmdstr,true,false);
-
-{ Strip the library ? }
-  if success and (cs_link_strip in aktglobalswitches) then
-   begin
-     SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
-     Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
-     success:=DoExec(FindUtil(binstr),cmdstr,true,false);
-   end;
-
-{ Remove ReponseFile }
-  if (success) and not(cs_link_extern in aktglobalswitches) then
-   RemoveFile(outputexedir+Info.ResName);
-
-  MakeSharedLibrary:=success;   { otherwise a recursive call to link method }
-end;
-
-
-{*****************************************************************************
-                                  Initialize
-*****************************************************************************}
-
-initialization
-{$ifdef i386}
-  RegisterExternalLinker(system_i386_beos_info,TLinkerbeos);
-  RegisterImport(system_i386_beos,timportlibbeos);
-  RegisterExport(system_i386_beos,texportlibbeos);
-  RegisterTarget(system_i386_beos_info);
-{$endif i386}
-end.
-{
-  $Log$
-  Revision 1.24  2002-09-03 16:26:28  daniel
-    * Make Tprocdef.defs protected
-
-  Revision 1.23  2002/08/12 15:08:44  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.22  2002/08/11 14:32:32  peter
-    * renamed current_library to objectlibrary
-
-  Revision 1.21  2002/08/11 13:24:19  peter
-    * saving of asmsymbols in ppu supported
-    * asmsymbollist global is removed and moved into a new class
-      tasmlibrarydata that will hold the info of a .a file which
-      corresponds with a single module. Added librarydata to tmodule
-      to keep the library info stored for the module. In the future the
-      objectfiles will also be stored to the tasmlibrarydata class
-    * all getlabel/newasmsymbol and friends are moved to the new class
-
-  Revision 1.20  2002/07/26 21:15:45  florian
-    * rewrote the system handling
-
-  Revision 1.19  2002/07/01 18:46:34  peter
-    * internal linker
-    * reorganized aasm layer
-
-  Revision 1.18  2002/05/18 13:34:26  peter
-    * readded missing revisions
-
-  Revision 1.17  2002/05/16 19:46:53  carl
-  + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
-  + try to fix temp allocation (still in ifdef)
-  + generic constructor calls
-  + start of tassembler / tmodulebase class cleanup
-
-  Revision 1.15  2002/04/22 18:19:22  carl
-  - remove use_bound_instruction field
-
-  Revision 1.14  2002/04/20 21:43:18  carl
-  * fix stack size for some targets
-  + add offset to parameters from frame pointer info.
-  - remove some unused stuff
-
-  Revision 1.13  2002/04/19 15:46:04  peter
-    * mangledname rewrite, tprocdef.mangledname is now created dynamicly
-      in most cases and not written to the ppu
-    * add mangeledname_prefix() routine to generate the prefix of
-      manglednames depending on the current procedure, object and module
-    * removed static procprefix since the mangledname is now build only
-      on demand from tprocdef.mangledname
-
-  Revision 1.12  2002/04/15 19:16:57  carl
-  - remove size_of_pointer field
-
-  Revision 1.11  2002/01/29 21:27:34  peter
-    * default alignment changed to 4 bytes for locals and static const,var
-
-}

+ 0 - 583
compiler/targets/t_fbsd.pas

@@ -1,583 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman (original Linux)
-              (c) 2000      by Marco van de Voort (FreeBSD mods)
-
-    This unit implements support import,export,link routines
-    for the (i386)FreeBSD target
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************
-}
-unit t_fbsd;
-
-{$i fpcdefs.inc}
-
-interface
-
-
-implementation
-
-  uses
-    cutils,cclasses,
-    verbose,systems,globtype,globals,
-    symconst,script,
-    fmodule,aasmbase,aasmtai,aasmcpu,cpubase,symsym,
-    import,export,link,i_fbsd;
-
-  type
-    timportlibfreebsd=class(timportlib)
-      procedure preparelib(const s:string);override;
-      procedure importprocedure(const func,module:string;index:longint;const name:string);override;
-      procedure importvariable(const varname,module:string;const name:string);override;
-      procedure generatelib;override;
-    end;
-
-    texportlibfreebsd=class(texportlib)
-      procedure preparelib(const s : string);override;
-      procedure exportprocedure(hp : texported_item);override;
-      procedure exportvar(hp : texported_item);override;
-      procedure generatelib;override;
-    end;
-
-    tlinkerfreebsd=class(texternallinker)
-    private
-      Glibc2,
-      Glibc21,
-      LdSupportsNoResponseFile : boolean;
-      Function  WriteResponseFile(isdll:boolean) : Boolean;
-    public
-      constructor Create;override;
-      procedure SetDefaultInfo;override;
-      function  MakeExecutable:boolean;override;
-      function  MakeSharedLibrary:boolean;override;
-    end;
-
-
-{*****************************************************************************
-                               TIMPORTLIBLINUX
-*****************************************************************************}
-
-procedure timportlibfreebsd.preparelib(const s : string);
-begin
-end;
-
-
-procedure timportlibfreebsd.importprocedure(const func,module : string;index : longint;const name : string);
-begin
-  { insert sharedlibrary }
-  current_module.linkothersharedlibs.add(SplitName(module),link_allways);
-  { do nothing with the procedure, only set the mangledname }
-  if name<>'' then
-    aktprocdef.setmangledname(name)
-  else
-    message(parser_e_empty_import_name);
-end;
-
-
-procedure timportlibfreebsd.importvariable(const varname,module:string;const name:string);
-begin
-  { insert sharedlibrary }
-  current_module.linkothersharedlibs.add(SplitName(module),link_allways);
-  { reset the mangledname and turn off the dll_var option }
-  aktvarsym.set_mangledname(name);
-  exclude(aktvarsym.varoptions,vo_is_dll_var);
-end;
-
-
-procedure timportlibfreebsd.generatelib;
-begin
-end;
-
-
-{*****************************************************************************
-                               TEXPORTLIBLINUX
-*****************************************************************************}
-
-procedure texportlibfreebsd.preparelib(const s:string);
-begin
-end;
-
-
-procedure texportlibfreebsd.exportprocedure(hp : texported_item);
-var
-  hp2 : texported_item;
-begin
-  { first test the index value }
-  if (hp.options and eo_index)<>0 then
-   begin
-     Message1(parser_e_no_export_with_index_for_target,'freebsd');
-     exit;
-   end;
-  { now place in correct order }
-  hp2:=texported_item(current_module._exports.first);
-  while assigned(hp2) and
-     (hp.name^>hp2.name^) do
-    hp2:=texported_item(hp2.next);
-  { insert hp there !! }
-  if assigned(hp2) and (hp2.name^=hp.name^) then
-    begin
-      { this is not allowed !! }
-      Message1(parser_e_export_name_double,hp.name^);
-      exit;
-    end;
-  if hp2=texported_item(current_module._exports.first) then
-    current_module._exports.concat(hp)
-  else if assigned(hp2) then
-    begin
-       hp.next:=hp2;
-       hp.previous:=hp2.previous;
-       if assigned(hp2.previous) then
-         hp2.previous.next:=hp;
-       hp2.previous:=hp;
-    end
-  else
-    current_module._exports.concat(hp);
-end;
-
-
-procedure texportlibfreebsd.exportvar(hp : texported_item);
-begin
-  hp.is_var:=true;
-  exportprocedure(hp);
-end;
-
-
-procedure texportlibfreebsd.generatelib;
-var
-  hp2 : texported_item;
-begin
-  hp2:=texported_item(current_module._exports.first);
-  while assigned(hp2) do
-   begin
-     if (not hp2.is_var) and
-        (hp2.sym.typ=procsym) then
-      begin
-        { the manglednames can already be the same when the procedure
-          is declared with cdecl }
-        if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then
-         begin
-{$ifdef i386}
-           { place jump in codesegment }
-           codesegment.concat(Tai_align.Create_op(4,$90));
-           codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
-           codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname)));
-           codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
-{$endif i386}
-         end;
-      end
-     else
-      Message1(parser_e_no_export_of_variables_for_target,'freebsd');
-     hp2:=texported_item(hp2.next);
-   end;
-end;
-
-
-{*****************************************************************************
-                                  TLINKERLINUX
-*****************************************************************************}
-
-Constructor TLinkerFreeBSD.Create;
-begin
-  Inherited Create;
-  LibrarySearchPath.AddPath('/lib;/usr/lib;/usr/X11R6/lib',true);
-end;
-
-
-procedure TLinkerFreeBSD.SetDefaultInfo;
-{
-  This will also detect which libc version will be used
-}
-begin
-  Glibc2:=false;
-  Glibc21:=false;
-{$ifdef NETBSD}
-{$ifdef M68K}
-  LdSupportsNoResponseFile:=true;
-{$else : not M68K}
-  LdSupportsNoResponseFile:=false;
-{$endif M68K}
-{$else : not NETBSD}
-  LdSupportsNoResponseFile:=false;
-{$endif NETBSD}
-  with Info do
-   begin
-     if LdSupportsNoResponseFile then
-       begin
-         ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $STRIP -L. -o $EXE `cat $RES`';
-         { We need external linking to interpret the `cat $RES` PM }
-         include(aktglobalswitches,cs_link_extern);
-       end
-     else
-       ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $STRIP -L. -o $EXE $RES';
-     DllCmd[1]:='ld $OPT -shared -L. -o $EXE $RES';
-     DllCmd[2]:='strip --strip-unneeded $EXE';
-     { first try glibc2 }
-{$ifdef GLIBC2} {Keep linux code in place. FBSD might go to a different
-                                glibc too once}
-     DynamicLinker:='/lib/ld-linux.so.2';
-     if FileExists(DynamicLinker) then
-      begin
-        Glibc2:=true;
-        { Check for 2.0 files, else use the glibc 2.1 stub }
-        if FileExists('/lib/ld-2.0.*') then
-         Glibc21:=false
-        else
-         Glibc21:=true;
-      end
-     else
-      DynamicLinker:='/lib/ld-linux.so.1';
-{$else}
-      DynamicLinker:='';
-{$endif}
-   end;
-end;
-
-
-Function TLinkerFreeBSD.WriteResponseFile(isdll:boolean) : Boolean;
-Var
-  linkres      : TLinkRes;
-  i            : longint;
-  cprtobj,
-  gprtobj,
-  prtobj       : string[80];
-  HPath        : TStringListItem;
-  s,s1,s2      : string;
-  linkdynamic,
-  linklibc     : boolean;
-  Fl1,Fl2      : Boolean;
-
-begin
-  WriteResponseFile:=False;
-{ set special options for some targets }
-  linkdynamic:=not(SharedLibFiles.empty);
-  linklibc:=(SharedLibFiles.Find('c')<>nil);
-  prtobj:='prt0';
-  cprtobj:='cprt0';
-  gprtobj:='gprt0';
-  if glibc21 then
-   begin
-     cprtobj:='cprt21';
-     gprtobj:='gprt21';
-   end;
-  if cs_profile in aktmoduleswitches then
-   begin
-     prtobj:=gprtobj;
-     if not glibc2 then
-      AddSharedLibrary('gmon');
-     AddSharedLibrary('c');
-     linklibc:=true;
-   end
-  else
-   begin
-     if linklibc then
-      prtobj:=cprtobj;
-   end;
-
-  { Open link.res file }
-  LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);
-
-  { Write path to search libraries }
-  HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
-  while assigned(HPath) do
-   begin
-     if LdSupportsNoResponseFile then
-       LinkRes.Add('-L'+HPath.Str)
-     else
-       LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
-     HPath:=TStringListItem(HPath.Next);
-   end;
-  HPath:=TStringListItem(LibrarySearchPath.First);
-  while assigned(HPath) do
-   begin
-     if LdSupportsNoResponseFile then
-       LinkRes.Add('-L'+HPath.Str)
-     else
-       LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
-     HPath:=TStringListItem(HPath.Next);
-   end;
-
-  if not LdSupportsNoResponseFile then
-    LinkRes.Add('INPUT(');
-  { add objectfiles, start with prt0 always }
-  if prtobj<>'' then
-   LinkRes.AddFileName(FindObjectFile(prtobj,''));
-  { try to add crti and crtbegin if linking to C }
-  if linklibc then
-   begin
-     if librarysearchpath.FindFile('crtbegin.o',s) then
-      LinkRes.AddFileName(s);
-     if librarysearchpath.FindFile('crti.o',s) then
-      LinkRes.AddFileName(s);
-   end;
-  { main objectfiles }
-  while not ObjectFiles.Empty do
-   begin
-     s:=ObjectFiles.GetFirst;
-     if s<>'' then
-      LinkRes.AddFileName(s);
-   end;
-  if not LdSupportsNoResponseFile then
-   LinkRes.Add(')');
-
-  { Write staticlibraries }
-  if not StaticLibFiles.Empty then
-   begin
-     if not LdSupportsNoResponseFile then
-       LinkRes.Add('GROUP(');
-     While not StaticLibFiles.Empty do
-      begin
-        S:=StaticLibFiles.GetFirst;
-        LinkRes.AddFileName(s)
-      end;
-     if not LdSupportsNoResponseFile then
-       LinkRes.Add(')');
-   end;
-
-  { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
-    here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
-  if not SharedLibFiles.Empty then
-   begin
-     if not LdSupportsNoResponseFile then
-       LinkRes.Add('INPUT(');
-     While not SharedLibFiles.Empty do
-      begin
-        S:=SharedLibFiles.GetFirst;
-        if s<>'c' then
-         begin
-           i:=Pos(target_info.sharedlibext,S);
-           if i>0 then
-            Delete(S,i,255);
-           LinkRes.Add('-l'+s);
-         end
-        else
-         begin
-           linklibc:=true;
-           linkdynamic:=false; { libc will include the ld-linux for us }
-         end;
-      end;
-     { be sure that libc is the last lib }
-     if linklibc then
-      LinkRes.Add('-lc');
-     { when we have -static for the linker the we also need libgcc }
-     if (cs_link_staticflag in aktglobalswitches) then
-      LinkRes.Add('-lgcc');
-     if linkdynamic and (Info.DynamicLinker<>'') then
-      LinkRes.AddFileName(Info.DynamicLinker);
-     if not LdSupportsNoResponseFile then
-       LinkRes.Add(')');
-   end;
-  { objects which must be at the end }
-  if linklibc then
-   begin
-     Fl1:=librarysearchpath.FindFile('crtend.o',s1);
-     Fl2:=librarysearchpath.FindFile('crtn.o',s2);
-     if Fl1 or Fl2 then
-      begin
-        LinkRes.Add('INPUT(');
-         If Fl1 Then
-        LinkRes.AddFileName(s1);
-        If Fl2 Then
-         LinkRes.AddFileName(s2);
-        LinkRes.Add(')');
-      end;
-   end;
-{ Write and Close response }
-  linkres.writetodisk;
-  linkres.Free;
-
-  WriteResponseFile:=True;
-end;
-
-
-function TLinkerFreeBSD.MakeExecutable:boolean;
-var
-  binstr,
-  cmdstr  : string;
-  success : boolean;
-  DynLinkStr : string[60];
-  StaticStr,
-  StripStr   : string[40];
-begin
-  if not(cs_link_extern in aktglobalswitches) then
-   Message1(exec_i_linking,current_module.exefilename^);
-
-{ Create some replacements }
-  StaticStr:='';
-  StripStr:='';
-  DynLinkStr:='';
-  if (cs_link_staticflag in aktglobalswitches) then
-    begin
-      if (target_info.system=system_m68k_netbsd) and
-         ((cs_link_on_target in aktglobalswitches) or
-          (target_info.system=source_info.system)) then
-        StaticStr:='-Bstatic'
-      else
-        StaticStr:='-static';
-    end;
-  if (cs_link_strip in aktglobalswitches) then
-   StripStr:='-s';
-  If (cs_profile in aktmoduleswitches) or
-     ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
-   DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;
-
-{ Write used files and libraries }
-  WriteResponseFile(false);
-
-{ Call linker }
-  SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.exefilename^);
-  Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
-  Replace(cmdstr,'$STATIC',StaticStr);
-  Replace(cmdstr,'$STRIP',StripStr);
-  Replace(cmdstr,'$DYNLINK',DynLinkStr);
-  success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
-
-{ Remove ReponseFile }
-  if (success) and not(cs_link_extern in aktglobalswitches) then
-   RemoveFile(outputexedir+Info.ResName);
-
-  MakeExecutable:=success;   { otherwise a recursive call to link method }
-end;
-
-
-Function TLinkerFreeBSD.MakeSharedLibrary:boolean;
-var
-  binstr,
-  cmdstr  : string;
-  success : boolean;
-begin
-  MakeSharedLibrary:=false;
-  if not(cs_link_extern in aktglobalswitches) then
-   Message1(exec_i_linking,current_module.sharedlibfilename^);
-
-{ Write used files and libraries }
-  WriteResponseFile(true);
-
-{ Call linker }
-  SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
-  Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
-  success:=DoExec(FindUtil(binstr),cmdstr,true,false);
-
-{ Strip the library ? }
-  if success and (cs_link_strip in aktglobalswitches) then
-   begin
-     SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
-     Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
-     success:=DoExec(FindUtil(binstr),cmdstr,true,false);
-   end;
-
-{ Remove ReponseFile }
-  if (success) and not(cs_link_extern in aktglobalswitches) then
-   RemoveFile(outputexedir+Info.ResName);
-
-  MakeSharedLibrary:=success;   { otherwise a recursive call to link method }
-end;
-
-
-{*****************************************************************************
-                                     Initialize
-*****************************************************************************}
-
-initialization
-{$ifdef i386}
-  RegisterExternalLinker(system_i386_FreeBSD_info,TLinkerFreeBSD);
-  RegisterImport(system_i386_freebsd,timportlibfreebsd);
-  RegisterExport(system_i386_freebsd,texportlibfreebsd);
-  RegisterTarget(system_i386_freebsd_info);
-  RegisterImport(system_i386_netbsd,timportlibfreebsd);
-  RegisterExport(system_i386_netbsd,texportlibfreebsd);
-  RegisterTarget(system_i386_netbsd_info);
-{$endif i386}
-{$ifdef m68k}
-  RegisterExternalLinker(system_m68k_FreeBSD_info,TLinkerFreeBSD);
-  RegisterImport(system_m68k_netbsd,timportlibfreebsd);
-  RegisterExport(system_m68k_netbsd,texportlibfreebsd);
-  RegisterTarget(system_m68k_netbsd_info);
-{$endif m68k}
-end.
-{
-  $Log$
-  Revision 1.29  2002-09-03 16:26:28  daniel
-    * Make Tprocdef.defs protected
-
-  Revision 1.28  2002/08/12 15:08:44  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.27  2002/08/11 14:32:32  peter
-    * renamed current_library to objectlibrary
-
-  Revision 1.26  2002/08/11 13:24:19  peter
-    * saving of asmsymbols in ppu supported
-    * asmsymbollist global is removed and moved into a new class
-      tasmlibrarydata that will hold the info of a .a file which
-      corresponds with a single module. Added librarydata to tmodule
-      to keep the library info stored for the module. In the future the
-      objectfiles will also be stored to the tasmlibrarydata class
-    * all getlabel/newasmsymbol and friends are moved to the new class
-
-  Revision 1.25  2002/07/26 21:15:45  florian
-    * rewrote the system handling
-
-  Revision 1.24  2002/07/24 13:51:34  marco
-   * Fixed small error
-
-  Revision 1.23  2002/07/24 13:10:22  marco
-   * urgent fix.
-
-  Revision 1.22  2002/07/01 18:46:34  peter
-    * internal linker
-    * reorganized aasm layer
-
-  Revision 1.21  2002/05/18 13:34:26  peter
-    * readded missing revisions
-
-  Revision 1.20  2002/05/16 19:46:53  carl
-  + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
-  + try to fix temp allocation (still in ifdef)
-  + generic constructor calls
-  + start of tassembler / tmodulebase class cleanup
-
-  Revision 1.18  2002/04/22 18:19:22  carl
-  - remove use_bound_instruction field
-
-  Revision 1.17  2002/04/20 21:43:18  carl
-  * fix stack size for some targets
-  + add offset to parameters from frame pointer info.
-  - remove some unused stuff
-
-  Revision 1.16  2002/04/19 15:46:04  peter
-    * mangledname rewrite, tprocdef.mangledname is now created dynamicly
-      in most cases and not written to the ppu
-    * add mangeledname_prefix() routine to generate the prefix of
-      manglednames depending on the current procedure, object and module
-    * removed static procprefix since the mangledname is now build only
-      on demand from tprocdef.mangledname
-
-  Revision 1.15  2002/04/15 19:16:57  carl
-  - remove size_of_pointer field
-
-  Revision 1.14  2002/01/29 21:27:34  peter
-    * default alignment changed to 4 bytes for locals and static const,var
-
-}

+ 0 - 410
compiler/targets/t_go32v2.pas

@@ -1,410 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support import,export,link routines
-    for the (i386) Go32v2 target
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************
-}
-unit t_go32v2;
-
-{$i fpcdefs.inc}
-
-interface
-
-
-implementation
-
-    uses
-       link,
-       cutils,cclasses,
-       globtype,globals,systems,verbose,script,fmodule,i_go32v2,ogcoff;
-
-  type
-    tlinkergo32v2=class(texternallinker)
-    private
-       Function  WriteResponseFile(isdll:boolean) : Boolean;
-       Function  WriteScript(isdll:boolean) : Boolean;
-    public
-       constructor Create;override;
-       procedure SetDefaultInfo;override;
-       function  MakeExecutable:boolean;override;
-    end;
-
-
-{****************************************************************************
-                               TLinkerGo32v2
-****************************************************************************}
-
-Constructor TLinkerGo32v2.Create;
-begin
-  Inherited Create;
-  { allow duplicated libs (PM) }
-  SharedLibFiles.doubles:=true;
-  StaticLibFiles.doubles:=true;
-end;
-
-
-procedure TLinkerGo32v2.SetDefaultInfo;
-begin
-  with Info do
-   begin
-     ExeCmd[1]:='ld $SCRIPT $OPT $STRIP -o $EXE @$RES';
-   end;
-end;
-
-
-Function TLinkerGo32v2.WriteResponseFile(isdll:boolean) : Boolean;
-Var
-  linkres  : TLinkRes;
-  i        : longint;
-  s        : string;
-  linklibc : boolean;
-begin
-  WriteResponseFile:=False;
-
-  { Open link.res file }
-  LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);
-
-  { Write staticlibraries }
-  if not StaticLibFiles.Empty then
-   begin
-     LinkRes.Add('-(');
-     While not StaticLibFiles.Empty do
-      begin
-        S:=StaticLibFiles.GetFirst;
-        LinkRes.AddFileName(GetShortName(s))
-      end;
-     LinkRes.Add('-)');
-   end;
-
-  { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
-    here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
-  linklibc:=false;
-  While not SharedLibFiles.Empty do
-   begin
-     S:=SharedLibFiles.GetFirst;
-     if s<>'c' then
-      begin
-        i:=Pos(target_info.sharedlibext,S);
-        if i>0 then
-         Delete(S,i,255);
-        LinkRes.Add('-l'+s);
-      end
-     else
-      begin
-        LinkRes.Add('-l'+s);
-        linklibc:=true;
-      end;
-   end;
-  { be sure that libc&libgcc is the last lib }
-  if linklibc then
-   begin
-     LinkRes.Add('-lc');
-     LinkRes.Add('-lgcc');
-   end;
-
-{ Write and Close response }
-  linkres.writetodisk;
-  LinkRes.Free;
-
-  WriteResponseFile:=True;
-end;
-
-
-Function TLinkerGo32v2.WriteScript(isdll:boolean) : Boolean;
-Var
-  scriptres  : TLinkRes;
-  HPath    : TStringListItem;
-  s        : string;
-begin
-  WriteScript:=False;
-
-  { Open link.res file }
-  ScriptRes:=TLinkRes.Create(outputexedir+Info.ScriptName);
-  ScriptRes.Add('OUTPUT_FORMAT("coff-go32-exe")');
-  ScriptRes.Add('ENTRY(start)');
-
-  ScriptRes.Add('SECTIONS');
-  ScriptRes.Add('{');
-  ScriptRes.Add('  .text  0x1000+SIZEOF_HEADERS : {');
-  ScriptRes.Add('  . = ALIGN(16);');
-  { add objectfiles, start with prt0 always }
-  ScriptRes.Add('  '+GetShortName(FindObjectFile('prt0',''))+'(.text)');
-  while not ObjectFiles.Empty do
-   begin
-     s:=ObjectFiles.GetFirst;
-     if s<>'' then
-       begin
-          ScriptRes.Add('  . = ALIGN(16);');
-          ScriptRes.Add('  '+GetShortName(s)+'(.text)');
-       end;
-   end;
-  ScriptRes.Add('    *(.text)');
-  ScriptRes.Add('    etext  =  . ; _etext = .;');
-  ScriptRes.Add('    . = ALIGN(0x200);');
-  ScriptRes.Add('  }');
-  ScriptRes.Add('    .data  ALIGN(0x200) : {');
-  ScriptRes.Add('      djgpp_first_ctor = . ;');
-  ScriptRes.Add('      *(.ctor)');
-  ScriptRes.Add('      djgpp_last_ctor = . ;');
-  ScriptRes.Add('      djgpp_first_dtor = . ;');
-  ScriptRes.Add('      *(.dtor)');
-  ScriptRes.Add('      djgpp_last_dtor = . ;');
-  ScriptRes.Add('      *(.data)');
-  ScriptRes.Add('      *(.gcc_exc)');
-  ScriptRes.Add('      ___EH_FRAME_BEGIN__ = . ;');
-  ScriptRes.Add('      *(.eh_fram)');
-  ScriptRes.Add('      ___EH_FRAME_END__ = . ;');
-  ScriptRes.Add('      LONG(0)');
-  ScriptRes.Add('       edata  =  . ; _edata = .;');
-  ScriptRes.Add('       . = ALIGN(0x200);');
-  ScriptRes.Add('    }');
-  ScriptRes.Add('    .bss  SIZEOF(.data) + ADDR(.data) :');
-  ScriptRes.Add('    {');
-  ScriptRes.Add('      _object.2 = . ;');
-  ScriptRes.Add('      . += 24 ;');
-  ScriptRes.Add('      *(.bss)');
-  ScriptRes.Add('      *(COMMON)');
-  ScriptRes.Add('       end = . ; _end = .;');
-  ScriptRes.Add('       . = ALIGN(0x200);');
-  ScriptRes.Add('    }');
-  ScriptRes.Add('  }');
-
-  { Write path to search libraries }
-  HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
-  while assigned(HPath) do
-   begin
-     ScriptRes.Add('SEARCH_DIR("'+GetShortName(HPath.Str)+'")');
-     HPath:=TStringListItem(HPath.Next);
-   end;
-  HPath:=TStringListItem(LibrarySearchPath.First);
-  while assigned(HPath) do
-   begin
-     ScriptRes.Add('SEARCH_DIR("'+GetShortName(HPath.Str)+'")');
-     HPath:=TStringListItem(HPath.Next);
-   end;
-
-{ Write and Close response }
-  ScriptRes.WriteToDisk;
-  ScriptRes.Free;
-
-  WriteScript:=True;
-end;
-
-
-
-function TLinkerGo32v2.MakeExecutable:boolean;
-var
-  binstr,
-  cmdstr  : string;
-  success : boolean;
-  StripStr : string[40];
-begin
-  if not(cs_link_extern in aktglobalswitches) then
-   Message1(exec_i_linking,current_module.exefilename^);
-
-{ Create some replacements }
-  StripStr:='';
-  if (cs_link_strip in aktglobalswitches) then
-   StripStr:='-s';
-
-  { Write used files and libraries and our own ld script }
-  WriteScript(false);
-  WriteResponsefile(false);
-
-{ Call linker }
-  SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename^));
-  Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
-  Replace(cmdstr,'$STRIP',StripStr);
-  Replace(cmdstr,'$SCRIPT','--script='+maybequoted(outputexedir+Info.ScriptName));
-  success:=DoExec(FindUtil(BinStr),cmdstr,true,false);
-
-{ Remove ReponseFile }
-  if (success) and not(cs_link_extern in aktglobalswitches) then
-   begin
-     RemoveFile(outputexedir+Info.ResName);
-     RemoveFile(outputexedir+Info.ScriptName);
-   end;
-
-  MakeExecutable:=success;   { otherwise a recursive call to link method }
-end;
-
-
-{$ifdef notnecessary}
-procedure tlinkergo32v2.postprocessexecutable(const n : string);
-type
-  tcoffheader=packed record
-    mach   : word;
-    nsects : word;
-    time   : longint;
-    sympos : longint;
-    syms   : longint;
-    opthdr : word;
-    flag   : word;
-  end;
-  tcoffsechdr=packed record
-    name     : array[0..7] of char;
-    vsize    : longint;
-    rvaofs   : longint;
-    datalen  : longint;
-    datapos  : longint;
-    relocpos : longint;
-    lineno1  : longint;
-    nrelocs  : word;
-    lineno2  : word;
-    flags    : longint;
-  end;
-  psecfill=^TSecfill;
-  TSecfill=record
-    fillpos,
-    fillsize : longint;
-    next : psecfill;
-  end;
-var
-  f : file;
-  coffheader : tcoffheader;
-  firstsecpos,
-  maxfillsize,
-  l : longint;
-  coffsec : tcoffsechdr;
-  secroot,hsecroot : psecfill;
-  zerobuf : pointer;
-begin
-  { when -s is used quit, because there is no .exe }
-  if cs_link_extern in aktglobalswitches then
-   exit;
-  { open file }
-  assign(f,n);
-  {$I-}
-   reset(f,1);
-  if ioresult<>0 then
-    Message1(execinfo_f_cant_open_executable,n);
-  { read headers }
-  seek(f,2048);
-  blockread(f,coffheader,sizeof(tcoffheader));
-  { read section info }
-  maxfillsize:=0;
-  firstsecpos:=0;
-  secroot:=nil;
-  for l:=1to coffheader.nSects do
-   begin
-     blockread(f,coffsec,sizeof(tcoffsechdr));
-     if coffsec.datapos>0 then
-      begin
-        if secroot=nil then
-         firstsecpos:=coffsec.datapos;
-        new(hsecroot);
-        hsecroot^.fillpos:=coffsec.datapos+coffsec.vsize;
-        hsecroot^.fillsize:=coffsec.datalen-coffsec.vsize;
-        hsecroot^.next:=secroot;
-        secroot:=hsecroot;
-        if secroot^.fillsize>maxfillsize then
-         maxfillsize:=secroot^.fillsize;
-      end;
-   end;
-  if firstsecpos>0 then
-   begin
-     l:=firstsecpos-filepos(f);
-     if l>maxfillsize then
-      maxfillsize:=l;
-   end
-  else
-   l:=0;
-  { get zero buffer }
-  getmem(zerobuf,maxfillsize);
-  fillchar(zerobuf^,maxfillsize,0);
-  { zero from sectioninfo until first section }
-  blockwrite(f,zerobuf^,l);
-  { zero section alignments }
-  while assigned(secroot) do
-   begin
-     seek(f,secroot^.fillpos);
-     blockwrite(f,zerobuf^,secroot^.fillsize);
-     hsecroot:=secroot;
-     secroot:=secroot^.next;
-     dispose(hsecroot);
-   end;
-  freemem(zerobuf,maxfillsize);
-  close(f);
-  {$I+}
-  i:=ioresult;
-  postprocessexecutable:=true;
-end;
-{$endif}
-
-
-{*****************************************************************************
-                                     Initialize
-*****************************************************************************}
-
-initialization
-  RegisterExternalLinker(system_i386_go32v2_info,TLinkerGo32v2);
-  RegisterInternalLinker(system_i386_go32v2_info,TCoffLinker);
-  RegisterTarget(system_i386_go32v2_info);
-end.
-{
-  $Log$
-  Revision 1.25  2002-08-12 15:08:44  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.24  2002/07/26 21:15:46  florian
-    * rewrote the system handling
-
-  Revision 1.23  2002/07/01 18:46:35  peter
-    * internal linker
-    * reorganized aasm layer
-
-  Revision 1.22  2002/05/18 13:34:26  peter
-    * readded missing revisions
-
-  Revision 1.21  2002/05/16 19:46:53  carl
-  + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
-  + try to fix temp allocation (still in ifdef)
-  + generic constructor calls
-  + start of tassembler / tmodulebase class cleanup
-
-  Revision 1.19  2002/04/22 18:19:22  carl
-  - remove use_bound_instruction field
-
-  Revision 1.18  2002/04/20 21:43:18  carl
-  * fix stack size for some targets
-  + add offset to parameters from frame pointer info.
-  - remove some unused stuff
-
-  Revision 1.17  2002/04/15 19:44:23  peter
-    * fixed stackcheck that would be called recursively when a stack
-      error was found
-    * generic changeregsize(reg,size) for i386 register resizing
-    * removed some more routines from cga unit
-    * fixed returnvalue handling
-    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
-
-  Revision 1.16  2002/04/15 19:16:57  carl
-  - remove size_of_pointer field
-
-  Revision 1.15  2002/01/29 21:27:34  peter
-    * default alignment changed to 4 bytes for locals and static const,var
-
-}

+ 0 - 603
compiler/targets/t_linux.pas

@@ -1,603 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support import,export,link routines
-    for the (i386) Linux target
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************
-}
-unit t_linux;
-
-{$i fpcdefs.inc}
-
-interface
-
-  uses
-    import,export,link;
-
-  type
-    timportliblinux=class(timportlib)
-      procedure preparelib(const s:string);override;
-      procedure importprocedure(const func,module:string;index:longint;const name:string);override;
-      procedure importvariable(const varname,module:string;const name:string);override;
-      procedure generatelib;override;
-    end;
-
-    texportliblinux=class(texportlib)
-      procedure preparelib(const s : string);override;
-      procedure exportprocedure(hp : texported_item);override;
-      procedure exportvar(hp : texported_item);override;
-      procedure generatelib;override;
-    end;
-
-    tlinkerlinux=class(texternallinker)
-    private
-      Glibc2,
-      Glibc21 : boolean;
-      Function  WriteResponseFile(isdll:boolean) : Boolean;
-    public
-      constructor Create;override;
-      procedure SetDefaultInfo;override;
-      function  MakeExecutable:boolean;override;
-      function  MakeSharedLibrary:boolean;override;
-    end;
-
-
-implementation
-
-  uses
-    cutils,cclasses,
-    verbose,systems,globtype,globals,
-    symconst,script,
-    fmodule,symsym
-{$ifdef i386}
-    ,aasmbase,aasmtai,aasmcpu,cpubase
-{$endif i386}
-    ,i_linux
-    ;
-
-{*****************************************************************************
-                               TIMPORTLIBLINUX
-*****************************************************************************}
-
-procedure timportliblinux.preparelib(const s : string);
-begin
-end;
-
-
-procedure timportliblinux.importprocedure(const func,module : string;index : longint;const name : string);
-begin
-  { insert sharedlibrary }
-  current_module.linkothersharedlibs.add(SplitName(module),link_allways);
-  { do nothing with the procedure, only set the mangledname }
-  if name<>'' then
-   begin
-     aktprocdef.setmangledname(name);
-     aktprocdef.has_mangledname:=true;
-   end
-  else
-    message(parser_e_empty_import_name);
-end;
-
-
-procedure timportliblinux.importvariable(const varname,module:string;const name:string);
-begin
-  { insert sharedlibrary }
-  current_module.linkothersharedlibs.add(SplitName(module),link_allways);
-  { reset the mangledname and turn off the dll_var option }
-  aktvarsym.set_mangledname(name);
-  exclude(aktvarsym.varoptions,vo_is_dll_var);
-end;
-
-
-procedure timportliblinux.generatelib;
-begin
-end;
-
-
-{*****************************************************************************
-                               TEXPORTLIBLINUX
-*****************************************************************************}
-
-procedure texportliblinux.preparelib(const s:string);
-begin
-end;
-
-
-procedure texportliblinux.exportprocedure(hp : texported_item);
-var
-  hp2 : texported_item;
-begin
-  { first test the index value }
-  if (hp.options and eo_index)<>0 then
-   begin
-     Message1(parser_e_no_export_with_index_for_target,'linux');
-     exit;
-   end;
-  { now place in correct order }
-  hp2:=texported_item(current_module._exports.first);
-  while assigned(hp2) and
-     (hp.name^>hp2.name^) do
-    hp2:=texported_item(hp2.next);
-  { insert hp there !! }
-  if assigned(hp2) and (hp2.name^=hp.name^) then
-    begin
-      { this is not allowed !! }
-      Message1(parser_e_export_name_double,hp.name^);
-      exit;
-    end;
-  if hp2=texported_item(current_module._exports.first) then
-    current_module._exports.concat(hp)
-  else if assigned(hp2) then
-    begin
-       hp.next:=hp2;
-       hp.previous:=hp2.previous;
-       if assigned(hp2.previous) then
-         hp2.previous.next:=hp;
-       hp2.previous:=hp;
-    end
-  else
-    current_module._exports.concat(hp);
-end;
-
-
-procedure texportliblinux.exportvar(hp : texported_item);
-begin
-  hp.is_var:=true;
-  exportprocedure(hp);
-end;
-
-
-procedure texportliblinux.generatelib;
-var
-  hp2 : texported_item;
-begin
-  hp2:=texported_item(current_module._exports.first);
-  while assigned(hp2) do
-   begin
-     if (not hp2.is_var) and
-        (hp2.sym.typ=procsym) then
-      begin
-        { the manglednames can already be the same when the procedure
-          is declared with cdecl }
-        if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then
-         begin
-{$ifdef i386}
-           { place jump in codesegment }
-           codesegment.concat(Tai_align.Create_op(4,$90));
-           codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
-           codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname)));
-           codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
-{$endif i386}
-         end;
-      end
-     else
-      Message1(parser_e_no_export_of_variables_for_target,'linux');
-     hp2:=texported_item(hp2.next);
-   end;
-end;
-
-
-{*****************************************************************************
-                                  TLINKERLINUX
-*****************************************************************************}
-
-Constructor TLinkerLinux.Create;
-begin
-  Inherited Create;
-  LibrarySearchPath.AddPath('/lib;/usr/lib;/usr/X11R6/lib',true);
-end;
-
-
-procedure TLinkerLinux.SetDefaultInfo;
-{
-  This will also detect which libc version will be used
-}
-begin
-  Glibc2:=false;
-  Glibc21:=false;
-  with Info do
-   begin
-     ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $STRIP -L. -o $EXE $RES';
-     DllCmd[1]:='ld $OPT $INIT $FINI $SONAME -shared -L. -o $EXE $RES';
-     DllCmd[2]:='strip --strip-unneeded $EXE';
-     { first try glibc2 }
-     DynamicLinker:='/lib/ld-linux.so.2';
-     if FileExists(DynamicLinker) then
-      begin
-        Glibc2:=true;
-        { Check for 2.0 files, else use the glibc 2.1 stub }
-        if FileExists('/lib/ld-2.0.*') then
-         Glibc21:=false
-        else
-         Glibc21:=true;
-      end
-     else
-      DynamicLinker:='/lib/ld-linux.so.1';
-   end;
-end;
-
-
-Function TLinkerLinux.WriteResponseFile(isdll:boolean) : Boolean;
-Var
-  linkres      : TLinkRes;
-  i            : longint;
-  cprtobj,
-  gprtobj,
-  prtobj       : string[80];
-  HPath        : TStringListItem;
-  s,s1,s2      : string;
-  found1,
-  found2,
-  linkdynamic,
-  linklibc     : boolean;
-begin
-  WriteResponseFile:=False;
-{ set special options for some targets }
-  linkdynamic:=not(SharedLibFiles.empty);
-  linklibc:=(SharedLibFiles.Find('c')<>nil);
-  if isdll then
-   begin
-     prtobj:='dllprt0';
-     cprtobj:='dllprt0';
-     gprtobj:='dllprt0';
-   end
-  else
-   begin
-     prtobj:='prt0';
-     cprtobj:='cprt0';
-     gprtobj:='gprt0';
-     if glibc21 then
-      begin
-        cprtobj:='cprt21';
-        gprtobj:='gprt21';
-      end;
-   end;
-  if cs_profile in aktmoduleswitches then
-   begin
-     prtobj:=gprtobj;
-     if not glibc2 then
-      AddSharedLibrary('gmon');
-     AddSharedLibrary('c');
-     linklibc:=true;
-   end
-  else
-   begin
-     if linklibc then
-      prtobj:=cprtobj;
-   end;
-
-  { Open link.res file }
-  LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);
-
-  { Write path to search libraries }
-  HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
-  while assigned(HPath) do
-   begin
-     LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
-     HPath:=TStringListItem(HPath.Next);
-   end;
-  HPath:=TStringListItem(LibrarySearchPath.First);
-  while assigned(HPath) do
-   begin
-     LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
-     HPath:=TStringListItem(HPath.Next);
-   end;
-
-  LinkRes.Add('INPUT(');
-  { add objectfiles, start with prt0 always }
-  if prtobj<>'' then
-   LinkRes.AddFileName(FindObjectFile(prtobj,''));
-  { try to add crti and crtbegin if linking to C }
-  if linklibc then
-   begin
-     if librarysearchpath.FindFile('crtbegin.o',s) then
-      LinkRes.AddFileName(s);
-     if librarysearchpath.FindFile('crti.o',s) then
-      LinkRes.AddFileName(s);
-   end;
-  { main objectfiles }
-  while not ObjectFiles.Empty do
-   begin
-     s:=ObjectFiles.GetFirst;
-     if s<>'' then
-      LinkRes.AddFileName(s);
-   end;
-  LinkRes.Add(')');
-
-  { Write staticlibraries }
-  if not StaticLibFiles.Empty then
-   begin
-     LinkRes.Add('GROUP(');
-     While not StaticLibFiles.Empty do
-      begin
-        S:=StaticLibFiles.GetFirst;
-        LinkRes.AddFileName(s)
-      end;
-     LinkRes.Add(')');
-   end;
-
-  { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
-    here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
-  if not SharedLibFiles.Empty then
-   begin
-     LinkRes.Add('INPUT(');
-     While not SharedLibFiles.Empty do
-      begin
-        S:=SharedLibFiles.GetFirst;
-        if s<>'c' then
-         begin
-           i:=Pos(target_info.sharedlibext,S);
-           if i>0 then
-            Delete(S,i,255);
-           LinkRes.Add('-l'+s);
-         end
-        else
-         begin
-           linklibc:=true;
-           linkdynamic:=false; { libc will include the ld-linux for us }
-         end;
-      end;
-     { be sure that libc is the last lib }
-     if linklibc then
-      LinkRes.Add('-lc');
-     { when we have -static for the linker the we also need libgcc }
-     if (cs_link_staticflag in aktglobalswitches) then
-      LinkRes.Add('-lgcc');
-     if linkdynamic and (Info.DynamicLinker<>'') then
-      LinkRes.AddFileName(Info.DynamicLinker);
-     LinkRes.Add(')');
-   end;
-
-  { objects which must be at the end }
-  if linklibc then
-   begin
-     found1:=librarysearchpath.FindFile('crtend.o',s1);
-     found2:=librarysearchpath.FindFile('crtn.o',s2);
-     if found1 or found2 then
-      begin
-        LinkRes.Add('INPUT(');
-        if found1 then
-         LinkRes.AddFileName(s1);
-        if found2 then
-         LinkRes.AddFileName(s2);
-        LinkRes.Add(')');
-      end;
-   end;
-{ Write and Close response }
-  linkres.writetodisk;
-  linkres.Free;
-
-  WriteResponseFile:=True;
-end;
-
-
-function TLinkerLinux.MakeExecutable:boolean;
-var
-  binstr,
-  cmdstr  : string;
-  success : boolean;
-  DynLinkStr : string[60];
-  StaticStr,
-  StripStr   : string[40];
-begin
-  if not(cs_link_extern in aktglobalswitches) then
-   Message1(exec_i_linking,current_module.exefilename^);
-
-{ Create some replacements }
-  StaticStr:='';
-  StripStr:='';
-  DynLinkStr:='';
-  if (cs_link_staticflag in aktglobalswitches) then
-   StaticStr:='-static';
-  if (cs_link_strip in aktglobalswitches) then
-   StripStr:='-s';
-  If (cs_profile in aktmoduleswitches) or
-     ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
-   DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;
-
-{ Write used files and libraries }
-  WriteResponseFile(false);
-
-{ Call linker }
-  SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.exefilename^);
-  Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
-  Replace(cmdstr,'$STATIC',StaticStr);
-  Replace(cmdstr,'$STRIP',StripStr);
-  Replace(cmdstr,'$DYNLINK',DynLinkStr);
-  success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
-
-{ Remove ReponseFile }
-  if (success) and not(cs_link_extern in aktglobalswitches) then
-   RemoveFile(outputexedir+Info.ResName);
-
-  MakeExecutable:=success;   { otherwise a recursive call to link method }
-end;
-
-
-Function TLinkerLinux.MakeSharedLibrary:boolean;
-var
-  InitStr,
-  FiniStr,
-  SoNameStr : string[80];
-  binstr,
-  cmdstr  : string;
-  success : boolean;
-begin
-  MakeSharedLibrary:=false;
-  if not(cs_link_extern in aktglobalswitches) then
-   Message1(exec_i_linking,current_module.sharedlibfilename^);
-
-{ Write used files and libraries }
-  WriteResponseFile(true);
-
- { Create some replacements }
-  InitStr:='-init FPC_LIB_START';
-  FiniStr:='-fini FPC_LIB_EXIT';
-  SoNameStr:='-soname '+SplitFileName(current_module.sharedlibfilename^);
-
-{ Call linker }
-  SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
-  Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
-  Replace(cmdstr,'$INIT',InitStr);
-  Replace(cmdstr,'$FINI',FiniStr);
-  Replace(cmdstr,'$SONAME',SoNameStr);
-  success:=DoExec(FindUtil(binstr),cmdstr,true,false);
-
-{ Strip the library ? }
-  if success and (cs_link_strip in aktglobalswitches) then
-   begin
-     SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
-     Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
-     success:=DoExec(FindUtil(binstr),cmdstr,true,false);
-   end;
-
-{ Remove ReponseFile }
-  if (success) and not(cs_link_extern in aktglobalswitches) then
-   RemoveFile(outputexedir+Info.ResName);
-
-  MakeSharedLibrary:=success;   { otherwise a recursive call to link method }
-end;
-
-
-{*****************************************************************************
-                                  Initialize
-*****************************************************************************}
-
-initialization
-{$ifdef i386}
-  RegisterExternalLinker(system_i386_linux_info,TLinkerLinux);
-  RegisterImport(system_i386_linux,timportliblinux);
-  RegisterExport(system_i386_linux,texportliblinux);
-  RegisterTarget(system_i386_linux_info);
-{$endif i386}
-{$ifdef m68k}
-  RegisterExternalLinker(system_m68k_linux_info,TLinkerLinux);
-  RegisterImport(system_m68k_linux,timportliblinux);
-  RegisterExport(system_m68k_linux,texportliblinux);
-  RegisterTarget(system_m68k_linux_info);
-{$endif m68k}
-{$ifdef powerpc}
-  RegisterExternalLinker(system_powerpc_linux_info,TLinkerLinux);
-  RegisterImport(system_powerpc_linux,timportliblinux);
-  RegisterExport(system_powerpc_linux,texportliblinux);
-  RegisterTarget(system_powerpc_linux_info);
-{$endif powerpc}
-{$ifdef alpha}
-  RegisterExternalLinker(system_alpha_linux_info,TLinkerLinux);
-  RegisterImport(system_alpha_linux,timportliblinux);
-  RegisterExport(system_alpha_linux,texportliblinux);
-  RegisterTarget(system_alpha_linux_info);
-{$endif alpha}
-{$ifdef x86_64}
-  RegisterExternalLinker(system_x86_64_linux_info,TLinkerLinux);
-  RegisterImport(system_x86_64_linux,timportliblinux);
-  RegisterExport(system_x86_64_linux,texportliblinux);
-  RegisterTarget(system_x86_64_linux_info);
-{$endif x86_64}
-{$ifdef SPARC}
-  RegisterExternalLinker(system_sparc_linux_info,TLinkerLinux);
-  RegisterImport(system_SPARC_linux,timportliblinux);
-  RegisterExport(system_SPARC_linux,texportliblinux);
-  RegisterTarget(system_SPARC_linux_info);
-{$endif SPARC}
-end.
-
-{
-  $Log$
-  Revision 1.33  2002-09-03 16:26:28  daniel
-    * Make Tprocdef.defs protected
-
-  Revision 1.32  2002/08/12 15:08:44  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.31  2002/08/11 14:32:32  peter
-    * renamed current_library to objectlibrary
-
-  Revision 1.30  2002/08/11 13:24:19  peter
-    * saving of asmsymbols in ppu supported
-    * asmsymbollist global is removed and moved into a new class
-      tasmlibrarydata that will hold the info of a .a file which
-      corresponds with a single module. Added librarydata to tmodule
-      to keep the library info stored for the module. In the future the
-      objectfiles will also be stored to the tasmlibrarydata class
-    * all getlabel/newasmsymbol and friends are moved to the new class
-
-  Revision 1.29  2002/07/26 21:15:46  florian
-    * rewrote the system handling
-
-  Revision 1.28  2002/07/04 20:43:02  florian
-    * first x86-64 patches
-
-  Revision 1.27  2002/07/01 18:46:35  peter
-    * internal linker
-    * reorganized aasm layer
-
-  Revision 1.26  2002/05/18 13:34:26  peter
-    * readded missing revisions
-
-  Revision 1.25  2002/05/16 19:46:53  carl
-  + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
-  + try to fix temp allocation (still in ifdef)
-  + generic constructor calls
-  + start of tassembler / tmodulebase class cleanup
-
-  Revision 1.22  2002/05/06 19:46:36  carl
-  + added more patches from Mazen for SPARC port
-
-  Revision 1.21  2002/04/22 18:19:22  carl
-  - remove use_bound_instruction field
-
-  Revision 1.20  2002/04/20 21:43:18  carl
-  * fix stack size for some targets
-  + add offset to parameters from frame pointer info.
-  - remove some unused stuff
-
-  Revision 1.19  2002/04/19 15:46:05  peter
-    * mangledname rewrite, tprocdef.mangledname is now created dynamicly
-      in most cases and not written to the ppu
-    * add mangeledname_prefix() routine to generate the prefix of
-      manglednames depending on the current procedure, object and module
-    * removed static procprefix since the mangledname is now build only
-      on demand from tprocdef.mangledname
-
-  Revision 1.18  2002/04/15 19:44:23  peter
-    * fixed stackcheck that would be called recursively when a stack
-      error was found
-    * generic changeregsize(reg,size) for i386 register resizing
-    * removed some more routines from cga unit
-    * fixed returnvalue handling
-    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
-
-  Revision 1.17  2002/04/15 19:16:57  carl
-  - remove size_of_pointer field
-
-  Revision 1.16  2002/01/29 21:27:34  peter
-    * default alignment changed to 4 bytes for locals and static const,var
-
-  Revision 1.15  2002/01/09 07:38:37  michael
-  + Patch from Peter for library imports
-}

+ 0 - 79
compiler/targets/t_macos.pas

@@ -1,79 +0,0 @@
-{
-    $Id$
-    Copyright (c) 2001-2002 by Peter Vreman
-
-    This unit implements support import,export,link routines
-    for the (i386) Amiga target
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************
-}
-unit t_macos;
-
-{$i fpcdefs.inc}
-
-interface
-
-
-implementation
-
-    uses
-       link,
-       cutils,cclasses,
-       globtype,globals,systems,verbose,script,fmodule,i_macos;
-
-{*****************************************************************************
-                                  Initialize
-*****************************************************************************}
-
-initialization
-{$ifdef m68k}
-  RegisterTarget(system_m68k_macos_info);
-{$endif m68k}
-{$ifdef powerpc}
-  RegisterTarget(system_powerpc_macos_info);
-{$endif powerpc}
-end.
-{
-  $Log$
-  Revision 1.13  2002-08-20 21:40:44  florian
-    + target macos for ppc added
-    + frame work for mpw assembler output
-
-  Revision 1.12  2002/07/26 21:15:46  florian
-    * rewrote the system handling
-
-  Revision 1.11  2002/05/18 13:34:27  peter
-    * readded missing revisions
-
-  Revision 1.10  2002/05/16 19:46:53  carl
-  + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
-  + try to fix temp allocation (still in ifdef)
-  + generic constructor calls
-  + start of tassembler / tmodulebase class cleanup
-
-  Revision 1.8  2002/04/22 18:19:22  carl
-  - remove use_bound_instruction field
-
-  Revision 1.7  2002/04/20 21:43:18  carl
-  * fix stack size for some targets
-  + add offset to parameters from frame pointer info.
-  - remove some unused stuff
-
-  Revision 1.6  2002/04/15 19:16:57  carl
-  - remove size_of_pointer field
-
-}

+ 0 - 559
compiler/targets/t_nwm.pas

@@ -1,559 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support import,export,link routines
-    for the (i386) Netware target
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-    First Implementation 10 Sept 2000 Armin Diehl
-
-    Currently generating NetWare-NLM's only work under Linux and win32.
-    (see http://home.arcor.de/armin.diehl/fpcnw for binutils working
-    with win32) while not included in fpc-releases.
-
-    The following compiler-swiches are supported for NetWare:
-    $DESCRIPTION    : NLM-Description, will be displayed at load-time
-    $M              : For Stack-Size, Heap-Size will be ignored
-    $VERSION x.x.x  : Sets Major, Minor and Revision
-    $SCREENNAME     : Sets the ScreenName
-    $THREADNAME     : Sets cirrent threadname
-
-    Sorry, Displaying copyright does not work with nlmconv from gnu bunutils
-    but there is a patch available.
-
-    Exports will be handled like in win32:
-    procedure bla;
-    begin
-    end;
-
-    exports foo name 'Bar';
-
-    The path to the import-Files (from netware-sdk, see developer.novell.com)
-    must be specified by the library-path. All external modules are defined
-    as autoload. (Note: the import-files have to be in unix-format for exe2nlm)
-    By default, the most import files are included in freepascal.
-
-    i.e. Procedure ConsolePrintf (p:pchar); cdecl; external 'clib.nlm';
-    sets IMPORT @clib.imp and MODULE clib.
-
-    If you dont have nlmconv, compile gnu-binutils with
-       ./configure --enable-targets=i386-linux,i386-netware
-       make all
-
-    Debugging is currently only possible at assembler level with nwdbg, written
-    by Jan Beulich. (or with my modified RDebug) Nwdbg supports symbols but it's
-    not a source-level debugger. You can get nwdbg from developer.novell.com.
-    To enter the debugger from your program, call _EnterDebugger (defined in unit system).
-
-    A sample program:
-
-    Program Hello;
-    (*$DESCRIPTION HelloWorldNlm*)
-    (*$VERSION 1.2.3*)
-    (*$ScreenName Hello*)
-    (*$M 8192,8192*)
-    begin
-      writeLn ('hello world');
-    end.
-
-    compile with:
-    ppc386 -Tnetware hello
-
-    ToDo:
-      - No duplicate imports and autoloads
-      - No debug symbols
-      - libc support (needs new target)
-      - prelude support (needs new compiler switch)
-      - a lot of additional units from nwsdk
-
-****************************************************************************
-}
-unit t_nwm;
-
-{$i fpcdefs.inc}
-
-interface
-
-
-implementation
-
-  uses
-    cutils,
-    verbose,systems,globtype,globals,
-    symconst,script,
-    fmodule,aasmbase,aasmtai,aasmcpu,cpubase,symsym,
-    import,export,link,i_nwm;
-
-  type
-    timportlibnetware=class(timportlib)
-      procedure preparelib(const s:string);override;
-      procedure importprocedure(const func,module:string;index:longint;const name:string);override;
-      procedure importvariable(const varname,module:string;const name:string);override;
-      procedure generatelib;override;
-    end;
-
-    texportlibnetware=class(texportlib)
-      procedure preparelib(const s : string);override;
-      procedure exportprocedure(hp : texported_item);override;
-      procedure exportvar(hp : texported_item);override;
-      procedure generatelib;override;
-    end;
-
-    tlinkernetware=class(texternallinker)
-    private
-      Function  WriteResponseFile(isdll:boolean) : Boolean;
-    public
-      constructor Create;override;
-      procedure SetDefaultInfo;override;
-      function  MakeExecutable:boolean;override;
-    end;
-
-
-{*****************************************************************************
-                               TIMPORTLIBNETWARE
-*****************************************************************************}
-
-procedure timportlibnetware.preparelib(const s : string);
-begin
-end;
-
-
-procedure timportlibnetware.importprocedure(const func,module : string;index : longint;const name : string);
-begin
-  { insert sharedlibrary }
-  current_module.linkothersharedlibs.add(SplitName(module),link_allways);
-  { do nothing with the procedure, only set the mangledname }
-  if name<>'' then
-   begin
-     aktprocdef.setmangledname(name);
-     aktprocdef.has_mangledname:=true;
-   end
-  else
-    message(parser_e_empty_import_name);
-end;
-
-
-procedure timportlibnetware.importvariable(const varname,module:string;const name:string);
-begin
-  { insert sharedlibrary }
-  current_module.linkothersharedlibs.add(SplitName(module),link_allways);
-  { reset the mangledname and turn off the dll_var option }
-  aktvarsym.set_mangledname(name);
-  exclude(aktvarsym.varoptions,vo_is_dll_var);
-end;
-
-
-procedure timportlibnetware.generatelib;
-begin
-end;
-
-
-{*****************************************************************************
-                               TEXPORTLIBNETWARE
-*****************************************************************************}
-
-procedure texportlibnetware.preparelib(const s:string);
-begin
-end;
-
-
-procedure texportlibnetware.exportprocedure(hp : texported_item);
-var
-  hp2 : texported_item;
-begin
-  { first test the index value }
-  if (hp.options and eo_index)<>0 then
-   begin
-     Comment(V_Error,'can''t export with index under netware');
-     exit;
-   end;
-  { use pascal name is none specified }
-  if (hp.options and eo_name)=0 then
-    begin
-       hp.name:=stringdup(hp.sym.name);
-       hp.options:=hp.options or eo_name;
-    end;
-  { now place in correct order }
-  hp2:=texported_item(current_module._exports.first);
-  while assigned(hp2) and
-     (hp.name^>hp2.name^) do
-    hp2:=texported_item(hp2.next);
-  { insert hp there !! }
-  if assigned(hp2) and (hp2.name^=hp.name^) then
-    begin
-      { this is not allowed !! }
-      Message1(parser_e_export_name_double,hp.name^);
-      exit;
-    end;
-  if hp2=texported_item(current_module._exports.first) then
-    current_module._exports.insert(hp)
-  else if assigned(hp2) then
-    begin
-       hp.next:=hp2;
-       hp.previous:=hp2.previous;
-       if assigned(hp2.previous) then
-         hp2.previous.next:=hp;
-       hp2.previous:=hp;
-    end
-  else
-    current_module._exports.concat(hp);
-end;
-
-
-procedure texportlibnetware.exportvar(hp : texported_item);
-begin
-  hp.is_var:=true;
-  exportprocedure(hp);
-end;
-
-
-procedure texportlibnetware.generatelib;
-var
-  hp2 : texported_item;
-begin
-  hp2:=texported_item(current_module._exports.first);
-  while assigned(hp2) do
-   begin
-     if (not hp2.is_var) and
-        (hp2.sym.typ=procsym) then
-      begin
-        { the manglednames can already be the same when the procedure
-          is declared with cdecl }
-        if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then
-         begin
-{$ifdef i386}
-           { place jump in codesegment }
-           codesegment.concat(Tai_align.Create_op(4,$90));
-           codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
-           codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname)));
-           codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
-{$endif i386}
-         end;
-      end
-     else
-      //Comment(V_Error,'Exporting of variables is not supported under netware');
-      Message1(parser_e_no_export_of_variables_for_target,'netware');
-     hp2:=texported_item(hp2.next);
-   end;
-end;
-
-
-{*****************************************************************************
-                                  TLINKERNETWARE
-*****************************************************************************}
-
-Constructor TLinkerNetware.Create;
-begin
-  Inherited Create;
-end;
-
-
-procedure TLinkerNetware.SetDefaultInfo;
-begin
-  with Info do
-   begin
-     ExeCmd[1]:='nlmconv -T$RES';
-     {DllCmd[2]:='strip --strip-unneeded $EXE';}
-   end;
-end;
-
-
-Function TLinkerNetware.WriteResponseFile(isdll:boolean) : Boolean;
-Var
-  linkres      : TLinkRes;
-  i            : longint;
-  s,s2         : string;
-  ProgNam      : string [80];
-  NlmNam       : string [80];
-  hp2          : texported_item;  { for exports }
-  p            : byte;
-begin
-  WriteResponseFile:=False;
-
-  ProgNam := current_module.exefilename^;
-  i:=Pos(target_info.exeext,ProgNam);
-  if i>0 then
-    Delete(ProgNam,i,255);
-  NlmNam := ProgNam + target_info.exeext;
-
-  { Open link.res file }
-  LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);
-
-  p := Pos ('"', Description);
-  while (p > 0) do
-  begin
-    delete (Description,p,1);
-    p := Pos ('"', Description);
-  end;
-  if Description <> '' then
-    LinkRes.Add('DESCRIPTION "' + Description + '"');
-  LinkRes.Add('VERSION '+tostr(dllmajor)+','+tostr(dllminor)+','+tostr(dllrevision));
-
-  p := Pos ('"', nwscreenname);
-  while (p > 0) do
-  begin
-    delete (nwscreenname,p,1);
-    p := Pos ('"', nwscreenname);
-  end;
-  p := Pos ('"', nwthreadname);
-  while (p > 0) do
-  begin
-    delete (nwthreadname,p,1);
-    p := Pos ('"', nwthreadname);
-  end;
-  p := Pos ('"', nwcopyright);
-  while (p > 0) do
-  begin
-    delete (nwcopyright,p,1);
-    p := Pos ('"', nwcopyright);
-  end;
-
-  if nwscreenname <> '' then
-    LinkRes.Add('SCREENNAME "' + nwscreenname + '"');
-  if nwthreadname <> '' then
-    LinkRes.Add('THREADNAME "' + nwthreadname + '"');
-  if nwcopyright <> '' then
-    LinkRes.Add('COPYRIGHT "' + nwcopyright + '"');
-
-  if stacksize > 1024 then
-  begin
-    str (stacksize, s);
-    LinkRes.Add ('STACKSIZE '+s);
-  end;
-
-  { add objectfiles, start with nwpre always }
-  LinkRes.Add ('INPUT '+FindObjectFile('nwpre',''));
-
-  { main objectfiles }
-  while not ObjectFiles.Empty do
-   begin
-     s:=ObjectFiles.GetFirst;
-     if s<>'' then
-      LinkRes.Add ('INPUT ' + FindObjectFile (s,''));
-   end;
-
-  { output file (nlm) }
-  LinkRes.Add ('OUTPUT ' + NlmNam);
-
-  { start and stop-procedures }
-  LinkRes.Add ('START _Prelude');  { defined in rtl/netware/nwpre.pp }
-  LinkRes.Add ('EXIT _Stop');
-  LinkRes.Add ('CHECK FPC_NW_CHECKFUNCTION');
-
-  if not (cs_link_strip in aktglobalswitches) then
-    LinkRes.Add ('DEBUG');
-
-  { Write staticlibraries, is that correct ? }
-  if not StaticLibFiles.Empty then
-   begin
-     While not StaticLibFiles.Empty do
-      begin
-        S:=lower (StaticLibFiles.GetFirst);
-        if s<>'' then
-         begin
-       {ad: that's a hack !
-        whith -XX we get the .a files as static libs (in addition to the
-        imported libraries}
-       if (pos ('.a',s) <> 0) OR (pos ('.A', s) <> 0) then
-       begin
-         LinkRes.Add ('INPUT '+FindObjectFile(s,''));
-       end else
-       begin
-             i:=Pos(target_info.staticlibext,S);
-             if i>0 then
-               Delete(S,i,255);
-             S := S + '.imp';
-             librarysearchpath.FindFile(S,s);
-             LinkRes.Add('IMPORT @'+s);
-       end;
-         end
-      end;
-   end;
-
-  if not SharedLibFiles.Empty then
-   begin
-     While not SharedLibFiles.Empty do
-      begin
-        {becuase of upper/lower case mix, we may get duplicate
-         names but nlmconv ignores that.
-         Here we are setting the import-files for nlmconv. I.e. for
-         the module clib or clib.nlm we add IMPORT @clib.imp and also
-         the module clib.nlm (autoload)
-         ? may it be better to set autoload's via StaticLibFiles ? }
-        S:=lower (SharedLibFiles.GetFirst);
-        if s<>'' then
-         begin
-           s2:=s;
-           i:=Pos(target_info.sharedlibext,S);
-           if i>0 then
-             Delete(S,i,255);
-           S := S + '.imp';
-           librarysearchpath.FindFile(S,s);
-           LinkRes.Add('IMPORT @'+s);
-           LinkRes.Add('MODULE '+s2);
-         end
-      end;
-   end;
-
-  { write exports }
-  hp2:=texported_item(current_module._exports.first);
-  while assigned(hp2) do
-   begin
-     if not hp2.is_var then
-      begin
-        { Export the Symbol }
-        Comment(V_Debug,'Exporting '+hp2.name^);
-        LinkRes.Add ('EXPORT '+hp2.name^);
-      end
-     else
-      { really, i think it is possible }
-      Comment(V_Error,'Exporting of variables is not supported under netware');
-     hp2:=texported_item(hp2.next);
-   end;
-
-{ Write and Close response }
-  linkres.writetodisk;
-  LinkRes.Free;
-
-  WriteResponseFile:=True;
-end;
-
-
-function TLinkerNetware.MakeExecutable:boolean;
-var
-  binstr,
-  cmdstr  : string;
-  success : boolean;
-  DynLinkStr : string[60];
-  StaticStr,
-  StripStr   : string[40];
-begin
-  if not(cs_link_extern in aktglobalswitches) then
-   Message1(exec_i_linking,current_module.exefilename^);
-
-{ Create some replacements }
-  StaticStr:='';
-  StripStr:='';
-  DynLinkStr:='';
-
-{ Write used files and libraries }
-  WriteResponseFile(false);
-
-{ Call linker }
-  SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.exefilename^);
-  Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
-  Replace(cmdstr,'$STATIC',StaticStr);
-  Replace(cmdstr,'$STRIP',StripStr);
-  Replace(cmdstr,'$DYNLINK',DynLinkStr);
-  success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
-
-  { Remove ReponseFile }
-  if (success) and not(cs_link_extern in aktglobalswitches) then
-    RemoveFile(outputexedir+Info.ResName);
-
-  MakeExecutable:=success;   { otherwise a recursive call to link method }
-end;
-
-
-{*****************************************************************************
-                                     Initialize
-*****************************************************************************}
-
-
-initialization
-  RegisterExternalLinker(system_i386_netware_info,TLinkerNetware);
-  RegisterImport(system_i386_netware,TImportLibNetware);
-  RegisterExport(system_i386_netware,TExportLibNetware);
-  RegisterTarget(system_i386_netware_info);
-end.
-{
-  $Log$
-  Revision 1.30  2002-09-03 16:26:29  daniel
-    * Make Tprocdef.defs protected
-
-  Revision 1.29  2002/08/12 15:08:44  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.28  2002/08/11 14:32:32  peter
-    * renamed current_library to objectlibrary
-
-  Revision 1.27  2002/08/11 13:24:20  peter
-    * saving of asmsymbols in ppu supported
-    * asmsymbollist global is removed and moved into a new class
-      tasmlibrarydata that will hold the info of a .a file which
-      corresponds with a single module. Added librarydata to tmodule
-      to keep the library info stored for the module. In the future the
-      objectfiles will also be stored to the tasmlibrarydata class
-    * all getlabel/newasmsymbol and friends are moved to the new class
-
-  Revision 1.26  2002/07/26 21:15:46  florian
-    * rewrote the system handling
-
-  Revision 1.25  2002/07/01 18:46:35  peter
-    * internal linker
-    * reorganized aasm layer
-
-  Revision 1.24  2002/05/18 13:34:27  peter
-    * readded missing revisions
-
-  Revision 1.23  2002/05/16 19:46:53  carl
-  + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
-  + try to fix temp allocation (still in ifdef)
-  + generic constructor calls
-  + start of tassembler / tmodulebase class cleanup
-
-  Revision 1.21  2002/04/22 18:19:22  carl
-  - remove use_bound_instruction field
-
-  Revision 1.20  2002/04/20 21:43:18  carl
-  * fix stack size for some targets
-  + add offset to parameters from frame pointer info.
-  - remove some unused stuff
-
-  Revision 1.19  2002/04/19 15:46:05  peter
-    * mangledname rewrite, tprocdef.mangledname is now created dynamicly
-      in most cases and not written to the ppu
-    * add mangeledname_prefix() routine to generate the prefix of
-      manglednames depending on the current procedure, object and module
-    * removed static procprefix since the mangledname is now build only
-      on demand from tprocdef.mangledname
-
-  Revision 1.18  2002/04/15 19:16:57  carl
-  - remove size_of_pointer field
-
-  Revision 1.17  2002/03/30 09:09:47  armin
-  + support check-function for netware
-
-  Revision 1.16  2002/03/29 17:19:51  armin
-  + allow exports for netware
-
-  Revision 1.15  2002/03/19 20:23:57  armin
-  + smart linking now works with netware
-
-  Revision 1.14  2002/03/04 17:54:59  peter
-    * allow oridinal labels again
-
-  Revision 1.13  2002/03/03 13:00:39  hajny
-    * importprocedure fix by Armin Diehl
-
-}

+ 0 - 563
compiler/targets/t_os2.pas

@@ -1,563 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Daniel Mantione
-    Portions Copyright (c) 1998-2002 Eberhard Mattes
-
-    Unit to write out import libraries and def files for OS/2
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************
-}
-{
-   A lot of code in this unit has been ported from C to Pascal from the
-   emximp utility, part of the EMX development system. Emximp is copyrighted
-   by Eberhard Mattes. Note: Eberhard doesn't know much about the Pascal
-   port, please send questions to Daniel Mantione
-   <[email protected]>.
-}
-unit t_os2;
-
-{$i fpcdefs.inc}
-
-interface
-
-
-implementation
-
-  uses
-{$ifdef Delphi}
-     sysutils,
-     dmisc,
-{$else Delphi}
-     strings,
-     dos,
-{$endif Delphi}
-     cutils,cclasses,
-     globtype,comphook,systems,symsym,
-     globals,verbose,fmodule,script,
-     import,link,i_os2;
-
-  type
-    timportlibos2=class(timportlib)
-      procedure preparelib(const s:string);override;
-      procedure importprocedure(const func,module:string;index:longint;const name:string);override;
-      procedure generatelib;override;
-    end;
-
-    tlinkeros2=class(texternallinker)
-    private
-       Function  WriteResponseFile(isdll:boolean) : Boolean;
-    public
-       constructor Create;override;
-       procedure SetDefaultInfo;override;
-       function  MakeExecutable:boolean;override;
-    end;
-
-
-const   profile_flag:boolean=false;
-
-const   n_ext   = 1;
-        n_abs   = 2;
-        n_text  = 4;
-        n_data  = 6;
-        n_bss   = 8;
-        n_imp1  = $68;
-        n_imp2  = $6a;
-
-type    reloc=packed record     {This is the layout of a relocation table
-                                 entry.}
-            address:longint;    {Fixup location}
-            remaining:longint;
-            {Meaning of bits for remaining:
-             0..23:              Symbol number or segment
-             24:                 Self-relative fixup if non-zero
-             25..26:             Fixup size (0: 1 byte, 1: 2, 2: 4 bytes)
-             27:                 Reference to symbol or segment
-             28..31              Not used}
-        end;
-
-        nlist=packed record     {This is the layout of a symbol table entry.}
-            strofs:longint;     {Offset in string table}
-            typ:byte;           {Type of the symbol}
-            other:byte;         {Other information}
-            desc:word;          {More information}
-            value:longint;      {Value (address)}
-        end;
-
-        a_out_header=packed record
-            magic:word;         {Magic word, must be $0107}
-            machtype:byte;      {Machine type}
-            flags:byte;         {Flags}
-            text_size:longint;  {Length of text, in bytes}
-            data_size:longint;  {Length of initialized data, in bytes}
-            bss_size:longint;   {Length of uninitialized data, in bytes}
-            sym_size:longint;   {Length of symbol table, in bytes}
-            entry:longint;      {Start address (entry point)}
-            trsize:longint;     {Length of relocation info for text, bytes}
-            drsize:longint;     {Length of relocation info for data, bytes}
-        end;
-
-        ar_hdr=packed record
-            ar_name:array[0..15] of char;
-            ar_date:array[0..11] of char;
-            ar_uid:array[0..5] of char;
-            ar_gid:array[0..5] of char;
-            ar_mode:array[0..7] of char;
-            ar_size:array[0..9] of char;
-            ar_fmag:array[0..1] of char;
-        end;
-
-var aout_str_size:longint;
-    aout_str_tab:array[0..2047] of byte;
-    aout_sym_count:longint;
-    aout_sym_tab:array[0..5] of nlist;
-
-    aout_text:array[0..63] of byte;
-    aout_text_size:longint;
-
-    aout_treloc_tab:array[0..1] of reloc;
-    aout_treloc_count:longint;
-
-    aout_size:longint;
-    seq_no:longint;
-
-    ar_member_size:longint;
-
-    out_file:file;
-
-procedure write_ar(const name:string;size:longint);
-
-var ar:ar_hdr;
-    time:datetime;
-    dummy:word;
-    numtime:longint;
-    tmp:string[19];
-
-
-begin
-    ar_member_size:=size;
-    fillchar(ar.ar_name,sizeof(ar.ar_name),' ');
-    move(name[1],ar.ar_name,length(name));
-    getdate(time.year,time.month,time.day,dummy);
-    gettime(time.hour,time.min,time.sec,dummy);
-    packtime(time,numtime);
-    str(numtime,tmp);
-    fillchar(ar.ar_date,sizeof(ar.ar_date),' ');
-    move(tmp[1],ar.ar_date,length(tmp));
-    ar.ar_uid:='0     ';
-    ar.ar_gid:='0     ';
-    ar.ar_mode:='100666'#0#0;
-    str(size,tmp);
-    fillchar(ar.ar_size,sizeof(ar.ar_size),' ');
-    move(tmp[1],ar.ar_size,length(tmp));
-    ar.ar_fmag:='`'#10;
-    blockwrite(out_file,ar,sizeof(ar));
-end;
-
-procedure finish_ar;
-
-var a:byte;
-
-begin
-    a:=0;
-    if odd(ar_member_size) then
-        blockwrite(out_file,a,1);
-end;
-
-procedure aout_init;
-
-begin
-  aout_str_size:=sizeof(longint);
-  aout_sym_count:=0;
-  aout_text_size:=0;
-  aout_treloc_count:=0;
-end;
-
-function aout_sym(const name:string;typ,other:byte;desc:word;
-                  value:longint):longint;
-
-begin
-    if aout_str_size+length(name)+1>sizeof(aout_str_tab) then
-        Do_halt($da);
-    if aout_sym_count>=sizeof(aout_sym_tab) div sizeof(aout_sym_tab[0]) then
-        Do_halt($da);
-    aout_sym_tab[aout_sym_count].strofs:=aout_str_size;
-    aout_sym_tab[aout_sym_count].typ:=typ;
-    aout_sym_tab[aout_sym_count].other:=other;
-    aout_sym_tab[aout_sym_count].desc:=desc;
-    aout_sym_tab[aout_sym_count].value:=value;
-    strPcopy(@aout_str_tab[aout_str_size],name);
-    aout_str_size:=aout_str_size+length(name)+1;
-    aout_sym:=aout_sym_count;
-    inc(aout_sym_count);
-end;
-
-procedure aout_text_byte(b:byte);
-
-begin
-    if aout_text_size>=sizeof(aout_text) then
-        Do_halt($da);
-    aout_text[aout_text_size]:=b;
-    inc(aout_text_size);
-end;
-
-procedure aout_text_dword(d:longint);
-
-type li_ar=array[0..3] of byte;
-
-begin
-    aout_text_byte(li_ar(d)[0]);
-    aout_text_byte(li_ar(d)[1]);
-    aout_text_byte(li_ar(d)[2]);
-    aout_text_byte(li_ar(d)[3]);
-end;
-
-procedure aout_treloc(address,symbolnum,pcrel,len,ext:longint);
-
-begin
-    if aout_treloc_count>=sizeof(aout_treloc_tab) div sizeof(reloc) then
-        Do_halt($da);
-    aout_treloc_tab[aout_treloc_count].address:=address;
-    aout_treloc_tab[aout_treloc_count].remaining:=symbolnum+pcrel shl 24+
-     len shl 25+ext shl 27;
-    inc(aout_treloc_count);
-end;
-
-procedure aout_finish;
-
-begin
-    while (aout_text_size and 3)<>0 do
-        aout_text_byte ($90);
-    aout_size:=sizeof(a_out_header)+aout_text_size+aout_treloc_count*
-     sizeof(reloc)+aout_sym_count*sizeof(aout_sym_tab[0])+aout_str_size;
-end;
-
-procedure aout_write;
-
-var ao:a_out_header;
-
-begin
-    ao.magic:=$0107;
-    ao.machtype:=0;
-    ao.flags:=0;
-    ao.text_size:=aout_text_size;
-    ao.data_size:=0;
-    ao.bss_size:=0;
-    ao.sym_size:=aout_sym_count*sizeof(aout_sym_tab[0]);
-    ao.entry:=0;
-    ao.trsize:=aout_treloc_count*sizeof(reloc);
-    ao.drsize:=0;
-    blockwrite(out_file,ao,sizeof(ao));
-    blockwrite(out_file,aout_text,aout_text_size);
-    blockwrite(out_file,aout_treloc_tab,sizeof(reloc)*aout_treloc_count);
-    blockwrite(out_file,aout_sym_tab,sizeof(aout_sym_tab[0])*aout_sym_count);
-    longint((@aout_str_tab)^):=aout_str_size;
-    blockwrite(out_file,aout_str_tab,aout_str_size);
-end;
-
-procedure timportlibos2.preparelib(const s:string);
-
-{This code triggers a lot of bugs in the compiler.
-const   armag='!<arch>'#10;
-        ar_magic:array[1..length(armag)] of char=armag;}
-const   ar_magic:array[1..8] of char='!<arch>'#10;
-var
-  libname : string;
-begin
-    libname:=FixFileName(s+'.ao2');
-    seq_no:=1;
-    current_module.linkunitstaticlibs.add(libname,link_allways);
-    assign(out_file,current_module.outputpath^+libname);
-    rewrite(out_file,1);
-    blockwrite(out_file,ar_magic,sizeof(ar_magic));
-end;
-
-procedure timportlibos2.importprocedure(const func,module:string;index:longint;const name:string);
-{func       = Name of function to import.
- module     = Name of DLL to import from.
- index      = Index of function in DLL. Use 0 to import by name.
- name       = Name of function in DLL. Ignored when index=0;}
-var tmp1,tmp2,tmp3:string;
-    sym_mcount,sym_import:longint;
-    fixup_mcount,fixup_import:longint;
-begin
-    { force the current mangledname }
-    aktprocdef.has_mangledname:=true;
-
-    aout_init;
-    tmp2:=func;
-    if profile_flag and not (copy(func,1,4)='_16_') then
-        begin
-            {sym_entry:=aout_sym(func,n_text+n_ext,0,0,aout_text_size);}
-            sym_mcount:=aout_sym('__mcount',n_ext,0,0,0);
-            {Use, say, "_$U_DosRead" for "DosRead" to import the
-             non-profiled function.}
-            tmp2:='__$U_'+func;
-            sym_import:=aout_sym(tmp2,n_ext,0,0,0);
-            aout_text_byte($55);    {push ebp}
-            aout_text_byte($89);    {mov ebp, esp}
-            aout_text_byte($e5);
-            aout_text_byte($e8);    {call _mcount}
-            fixup_mcount:=aout_text_size;
-            aout_text_dword(0-(aout_text_size+4));
-            aout_text_byte($5d);    {pop ebp}
-            aout_text_byte($e9);    {jmp _$U_DosRead}
-            fixup_import:=aout_text_size;
-            aout_text_dword(0-(aout_text_size+4));
-
-            aout_treloc(fixup_mcount,sym_mcount,1,2,1);
-            aout_treloc (fixup_import, sym_import,1,2,1);
-        end;
-    str(seq_no,tmp1);
-    tmp1:='IMPORT#'+tmp1;
-    if name='' then
-        begin
-            str(index,tmp3);
-            tmp3:=func+'='+module+'.'+tmp3;
-        end
-    else
-        tmp3:=func+'='+module+'.'+name;
-    aout_sym(tmp2,n_imp1+n_ext,0,0,0);
-    aout_sym(tmp3,n_imp2+n_ext,0,0,0);
-    aout_finish;
-    write_ar(tmp1,aout_size);
-    aout_write;
-    finish_ar;
-    inc(seq_no);
-end;
-
-procedure timportlibos2.generatelib;
-
-begin
-    close(out_file);
-end;
-
-
-{****************************************************************************
-                               TLinkeros2
-****************************************************************************}
-
-Constructor TLinkeros2.Create;
-begin
-  Inherited Create;
-  { allow duplicated libs (PM) }
-  SharedLibFiles.doubles:=true;
-  StaticLibFiles.doubles:=true;
-end;
-
-
-procedure TLinkeros2.SetDefaultInfo;
-begin
-  with Info do
-   begin
-     ExeCmd[1]:='ld $OPT -o $EXE.out @$RES';
-     ExeCmd[2]:='emxbind -b $STRIP $APPTYPE $RSRC -k$STACKKB -h$HEAPMB -o $EXE.exe $EXE.out -aim -s$DOSHEAPKB';
-     ExeCmd[3]:='del $EXE.out';
-   end;
-end;
-
-
-Function TLinkeros2.WriteResponseFile(isdll:boolean) : Boolean;
-Var
-  linkres  : TLinkRes;
-  i        : longint;
-  HPath    : TStringListItem;
-  s        : string;
-begin
-  WriteResponseFile:=False;
-
-  { Open link.res file }
-  LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);
-
-  { Write path to search libraries }
-  HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
-  while assigned(HPath) do
-   begin
-     LinkRes.Add('-L'+HPath.Str);
-     HPath:=TStringListItem(HPath.Next);
-   end;
-  HPath:=TStringListItem(LibrarySearchPath.First);
-  while assigned(HPath) do
-   begin
-     LinkRes.Add('-L'+HPath.Str);
-     HPath:=TStringListItem(HPath.Next);
-   end;
-
-  { add objectfiles, start with prt0 always }
-  LinkRes.AddFileName(FindObjectFile('prt0',''));
-  while not ObjectFiles.Empty do
-   begin
-     s:=ObjectFiles.GetFirst;
-     if s<>'' then
-      LinkRes.AddFileName(s);
-   end;
-
-  { Write staticlibraries }
-  { No group !! This will not work correctly PM }
-  While not StaticLibFiles.Empty do
-   begin
-     S:=StaticLibFiles.GetFirst;
-     LinkRes.AddFileName(s)
-   end;
-
-  { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
-    here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
-  While not SharedLibFiles.Empty do
-   begin
-     S:=SharedLibFiles.GetFirst;
-     i:=Pos(target_info.sharedlibext,S);
-     if i>0 then
-      Delete(S,i,255);
-     LinkRes.Add('-l'+s);
-   end;
-
-{ Write and Close response }
-  linkres.writetodisk;
-  LinkRes.Free;
-
-  WriteResponseFile:=True;
-end;
-
-
-function TLinkeros2.MakeExecutable:boolean;
-var
-  binstr,
-  cmdstr  : string;
-  success : boolean;
-  i       : longint;
-  AppTypeStr,
-  StripStr: string[40];
-  RsrcStr : string;
-begin
-  if not(cs_link_extern in aktglobalswitches) then
-   Message1(exec_i_linking,current_module.exefilename^);
-
-{ Create some replacements }
-  if (cs_link_strip in aktglobalswitches) then
-   StripStr := '-s'
-  else
-   StripStr := '';
-  if (usewindowapi) or (AppType = app_gui) then
-   AppTypeStr := '-p'
-  else if AppType = app_fs then
-   AppTypeStr := '-f'
-  else AppTypeStr := '-w';
-  if not (Current_module.ResourceFiles.Empty) then
-   RsrcStr := '-r ' + Current_module.ResourceFiles.GetFirst
-  else
-   RsrcStr := '';
-(* Only one resource file supported, discard everything else
-   (should be already empty anyway, however. *)
-  Current_module.ResourceFiles.Clear;
-{ Write used files and libraries }
-  WriteResponseFile(false);
-
-{ Call linker }
-  success:=false;
-  for i:=1 to 3 do
-   begin
-     SplitBinCmd(Info.ExeCmd[i],binstr,cmdstr);
-     if binstr<>'' then
-      begin
-        { Is this really required? Not anymore according to my EMX docs }
-        Replace(cmdstr,'$HEAPMB',tostr((heapsize+1048575) shr 20));
-        {Size of the stack when an EMX program runs in OS/2.}
-        Replace(cmdstr,'$STACKKB',tostr((stacksize+1023) shr 10));
-        {When an EMX program runs in DOS, the heap and stack share the
-         same memory pool. The heap grows upwards, the stack grows downwards.}
-        Replace(cmdstr,'$DOSHEAPKB',tostr((stacksize+heapsize+1023) shr 10));
-        Replace(cmdstr,'$STRIP',StripStr);
-        Replace(cmdstr,'$APPTYPE',AppTypeStr);
-        Replace(cmdstr,'$RES',outputexedir+Info.ResName);
-        Replace(cmdstr,'$OPT',Info.ExtraOptions);
-        Replace(cmdstr,'$RSRC',RsrcStr);
-        Replace(cmdstr,'$EXE',current_module.exefilename^);
-        if i<>3 then
-         success:=DoExec(FindUtil(binstr),cmdstr,(i=1),false)
-        else
-         success:=DoExec(binstr,cmdstr,(i=1),true);
-(* We still want to have the PPAS script complete, right?
-        if not success then
-         break;
-*)
-      end;
-   end;
-
-{ Remove ReponseFile }
-  if (success) and not(cs_link_extern in aktglobalswitches) then
-   RemoveFile(outputexedir+Info.ResName);
-
-  MakeExecutable:=success;   { otherwise a recursive call to link method }
-end;
-
-
-{*****************************************************************************
-                                     Initialize
-*****************************************************************************}
-
-initialization
-  RegisterExternalLinker(system_i386_os2_info,TLinkerOS2);
-  RegisterImport(system_i386_os2,TImportLibOS2);
-  RegisterRes(res_emxbind_info);
-  RegisterTarget(system_i386_os2_info);
-end.
-{
-  $Log$
-  Revision 1.24  2002-08-12 15:08:44  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.23  2002/07/26 21:15:46  florian
-    * rewrote the system handling
-
-  Revision 1.22  2002/07/01 18:46:35  peter
-    * internal linker
-    * reorganized aasm layer
-
-  Revision 1.21  2002/05/18 13:34:27  peter
-    * readded missing revisions
-
-  Revision 1.20  2002/05/16 19:46:53  carl
-  + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
-  + try to fix temp allocation (still in ifdef)
-  + generic constructor calls
-  + start of tassembler / tmodulebase class cleanup
-
-  Revision 1.18  2002/04/22 18:19:22  carl
-  - remove use_bound_instruction field
-
-  Revision 1.17  2002/04/20 21:43:18  carl
-  * fix stack size for some targets
-  + add offset to parameters from frame pointer info.
-  - remove some unused stuff
-
-  Revision 1.16  2002/04/15 19:16:57  carl
-  - remove size_of_pointer field
-
-  Revision 1.15  2002/04/04 19:06:13  peter
-    * removed unused units
-    * use tlocation.size in cg.a_*loc*() routines
-
-  Revision 1.14  2002/01/29 21:27:34  peter
-    * default alignment changed to 4 bytes for locals and static const,var
-
-  Revision 1.12  2002/01/27 12:58:42  hajny
-    * fix for a problem with importprocedure
-
-}

+ 0 - 242
compiler/targets/t_palmos.pas

@@ -1,242 +0,0 @@
-{
-    $Id$
-    Copyright (c) 2001-2002 by Peter Vreman
-
-    This unit implements support import,export,link routines
-    for the (i386) Amiga target
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************
-}
-unit t_palmos;
-
-{$i fpcdefs.inc}
-
-interface
-
-  uses
-    link;
-
-  type
-    tlinkerPalmOS=class(texternallinker)
-    private
-       Function  WriteResponseFile : Boolean;
-    public
-       constructor Create;override;
-       procedure SetDefaultInfo;override;
-       function  MakeExecutable:boolean;override;
-    end;
-
-
-implementation
-
-    uses
-       cutils,cclasses,
-       globtype,globals,systems,verbose,script,fmodule,i_palmos;
-
-{****************************************************************************
-                               TLinkerPalmOS
-****************************************************************************}
-
-Constructor TLinkerPalmOS.Create;
-begin
-  Inherited Create;
-  { allow duplicated libs (PM) }
-  SharedLibFiles.doubles:=true;
-  StaticLibFiles.doubles:=true;
-end;
-
-
-procedure TLinkerPalmOS.SetDefaultInfo;
-begin
-  with Info do
-   begin
-     ExeCmd[1]:='ldpalm $OPT $STRIP -N -dy -T $SCRIPT -o $EXE @$RES';
-     ExeCmd[2]:='build-prc $EXE.prc "$APPNAME" $APPID $EXE *.bin';
-   end;
-end;
-
-
-Function TLinkerPalmOS.WriteResponseFile : Boolean;
-Var
-  linkres  : TLinkRes;
-  i        : longint;
-  HPath    : PStringQueueItem;
-  s        : string;
-  linklibc : boolean;
-begin
-  WriteResponseFile:=False;
-
-  { Open link.res file }
-  LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);
-
-  { Write path to search libraries }
-  HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
-  while assigned(HPath) do
-   begin
-     LinkRes.Add('-L'+HPath.Str);
-     HPath:=TStringListItem(HPath.Next);
-   end;
-  HPath:=TStringListItem(LibrarySearchPath.First);
-  while assigned(HPath) do
-   begin
-     LinkRes.Add('-L'+HPath.Str);
-     HPath:=TStringListItem(HPath.Next);
-   end;
-
-  { add objectfiles, start with crt0 always  }
-  { using crt0, we should stick C compatible }
-  LinkRes.AddFileName(FindObjectFile('crt0',''));
-
-  { main objectfiles }
-  while not ObjectFiles.Empty do
-   begin
-     s:=ObjectFiles.GetFirst;
-     if s<>'' then
-      LinkRes.AddFileName(s);
-   end;
-
-  { Write staticlibraries }
-  if not StaticLibFiles.Empty then
-   begin
-     LinkRes.Add('-(');
-     While not StaticLibFiles.Empty do
-      begin
-        S:=StaticLibFiles.GetFirst;
-        LinkRes.AddFileName(s)
-      end;
-     LinkRes.Add('-)');
-   end;
-
-  { currently the PalmOS target must be linked always against the C lib }
-  LinkRes.Add('-lcrt');
-
-  { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
-    here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
-  linklibc:=false;
-  While not SharedLibFiles.Empty do
-   begin
-     S:=SharedLibFiles.GetFirst;
-     if s<>'c' then
-      begin
-        i:=Pos(target_info.sharedlibext,S);
-        if i>0 then
-         Delete(S,i,255);
-        LinkRes.Add('-l'+s);
-      end
-     else
-      linklibc:=true;
-   end;
-  { be sure that libc is the last lib }
-  if linklibc then
-   begin
-     LinkRes.Add('-lc');
-     LinkRes.Add('-lgcc');
-   end;
-
-{ Write and Close response }
-  linkres.writetodisk;
-  linkres.Free;
-
-  WriteResponseFile:=True;
-end;
-
-
-function TLinkerPalmOS.MakeExecutable:boolean;
-var
-  binstr,
-  cmdstr  : string;
-  success : boolean;
-  StripStr : string[40];
-  i : longint;
-begin
-  if not(cs_link_extern in aktglobalswitches) then
-    Message1(exec_i_linking,current_module^.exefilename^);
-
-  { Create some replacements }
-  StripStr:='';
-  if (cs_link_strip in aktglobalswitches) then
-   StripStr:='-s';
-
-  { Write used files and libraries }
-  WriteResponseFile;
-
-{ Call linker }
-  success:=false;
-  for i:=1 to 2 do
-   begin
-     SplitBinCmd(Info.ExeCmd[i],binstr,cmdstr);
-     if binstr<>'' then
-      begin
-        Replace(cmdstr,'$EXE',MaybeQuote(current_module.exefilename^));
-        Replace(cmdstr,'$OPT',Info.ExtraOptions);
-        Replace(cmdstr,'$RES',outputexedir+Info.ResName);
-        Replace(cmdstr,'$STRIP',StripStr);
-        Replace(cmdstr,'$SCRIPT',FindUtil('palm.ld'));
-        Replace(cmdstr,'$APPNAME',palmos_applicationname);
-        Replace(cmdstr,'$APPID',palmos_applicationid);
-        success:=DoExec(FindUtil(binstr),cmdstr,(i=1),false);
-        if not success then
-         break;
-      end;
-   end;
-
-  { Remove ReponseFile }
-  if (success) and not(cs_link_extern in aktglobalswitches) then
-   RemoveFile(outputexedir+Info.ResName);
-
-  MakeExecutable:=success;   { otherwise a recursive call to link method }
-end;
-
-{*****************************************************************************
-                                     Initialize
-*****************************************************************************}
-
-initialization
-{$ifdef m68k}
-  RegisterTarget(target_m68k_palmos_info);
-{$endif m68k}
-end.
-{
-  $Log$
-  Revision 1.14  2002-07-26 21:15:46  florian
-    * rewrote the system handling
-
-  Revision 1.13  2002/07/01 18:46:35  peter
-    * internal linker
-    * reorganized aasm layer
-
-  Revision 1.12  2002/05/18 13:34:27  peter
-    * readded missing revisions
-
-  Revision 1.11  2002/05/16 19:46:53  carl
-  + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
-  + try to fix temp allocation (still in ifdef)
-  + generic constructor calls
-  + start of tassembler / tmodulebase class cleanup
-
-  Revision 1.9  2002/04/22 18:19:22  carl
-  - remove use_bound_instruction field
-
-  Revision 1.8  2002/04/20 21:43:18  carl
-  * fix stack size for some targets
-  + add offset to parameters from frame pointer info.
-  - remove some unused stuff
-
-  Revision 1.7  2002/04/15 19:16:57  carl
-  - remove size_of_pointer field
-
-}

+ 0 - 549
compiler/targets/t_sunos.pas

@@ -1,549 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support import,export,link routines
-    for the (i386) sunos target
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************
-}
-unit t_sunos;
-
-{$i fpcdefs.inc}
-
-interface
-
-{ copy from t_linux
-// Up to now we use gld since the solaris ld seems not support .res-files}
-{-$DEFINE LinkTest} { DON't del link.res and write Info }
-{$DEFINE GnuLd} {The other is not implemented }
-
-implementation
-
-  uses
-    cutils,cclasses,
-    verbose,systems,globtype,globals,
-    symconst,script,
-    fmodule,aasmbase,aasmtai,aasmcpu,cpubase,symsym,
-    import,export,link,i_sunos;
-
-  type
-    timportlibsunos=class(timportlib)
-      procedure preparelib(const s:string);override;
-      procedure importprocedure(const func,module:string;index:longint;const name:string);override;
-      procedure importvariable(const varname,module:string;const name:string);override;
-      procedure generatelib;override;
-    end;
-
-    texportlibsunos=class(texportlib)
-      procedure preparelib(const s : string);override;
-      procedure exportprocedure(hp : texported_item);override;
-      procedure exportvar(hp : texported_item);override;
-      procedure generatelib;override;
-    end;
-
-    tlinkersunos=class(texternallinker)
-    private
-      Glibc2,
-      Glibc21 : boolean;
-      Function  WriteResponseFile(isdll:boolean) : Boolean;
-    public
-      constructor Create;override;
-      procedure SetDefaultInfo;override;
-      function  MakeExecutable:boolean;override;
-      function  MakeSharedLibrary:boolean;override;
-    end;
-
-
-{*****************************************************************************
-                               TIMPORTLIBsunos
-*****************************************************************************}
-
-procedure timportlibsunos.preparelib(const s : string);
-begin
-{$ifDef LinkTest}
-  WriteLN('Prepare import: ',s);
-{$EndIf}
-end;
-
-
-procedure timportlibsunos.importprocedure(const func,module : string;index : longint;const name : string);
-begin
-  { insert sharedlibrary }
-{$ifDef LinkTest}
-  WriteLN('Import: f:',func,' m:',module,' n:',name);
-{$EndIf}
-  current_module.linkothersharedlibs.add(SplitName(module),link_allways);
-  { do nothing with the procedure, only set the mangledname }
-  if name<>'' then
-    aktprocdef.setmangledname(name)
-  else
-    message(parser_e_empty_import_name);
-end;
-
-
-procedure timportlibsunos.importvariable(const varname,module:string;const name:string);
-begin
-  { insert sharedlibrary }
-  current_module.linkothersharedlibs.add(SplitName(module),link_allways);
-  { reset the mangledname and turn off the dll_var option }
-  aktvarsym.set_mangledname(name);
-  exclude(aktvarsym.varoptions,vo_is_dll_var);
-end;
-
-
-procedure timportlibsunos.generatelib;
-begin
-end;
-
-
-{*****************************************************************************
-                               TEXPORTLIBsunos
-*****************************************************************************}
-
-procedure texportlibsunos.preparelib(const s:string);
-begin
-end;
-
-
-procedure texportlibsunos.exportprocedure(hp : texported_item);
-var
-  hp2 : texported_item;
-begin
-  { first test the index value }
-  if (hp.options and eo_index)<>0 then
-   begin
-     Message1(parser_e_no_export_with_index_for_target,'SunOS');
-     exit;
-   end;
-  { use pascal name is none specified }
-  if (hp.options and eo_name)=0 then
-    begin
-       hp.name:=stringdup(hp.sym.name);
-       hp.options:=hp.options or eo_name;
-    end;
-  { now place in correct order }
-  hp2:=texported_item(current_module._exports.first);
-  while assigned(hp2) and
-     (hp.name^>hp2.name^) do
-    hp2:=texported_item(hp2.next);
-  { insert hp there !! }
-  if assigned(hp2) and (hp2.name^=hp.name^) then
-    begin
-      { this is not allowed !! }
-      Message1(parser_e_export_name_double,hp.name^);
-      exit;
-    end;
-  if hp2=texported_item(current_module._exports.first) then
-    current_module._exports.insert(hp)
-  else if assigned(hp2) then
-    begin
-       hp.next:=hp2;
-       hp.previous:=hp2.previous;
-       if assigned(hp2.previous) then
-         hp2.previous.next:=hp;
-       hp2.previous:=hp;
-    end
-  else
-    current_module._exports.concat(hp);
-end;
-
-
-procedure texportlibsunos.exportvar(hp : texported_item);
-begin
-  hp.is_var:=true;
-  exportprocedure(hp);
-end;
-
-
-procedure texportlibsunos.generatelib;
-var
-  hp2 : texported_item;
-begin
-  hp2:=texported_item(current_module._exports.first);
-  while assigned(hp2) do
-   begin
-     if (not hp2.is_var) and
-        (hp2.sym.typ=procsym) then
-      begin
-        { the manglednames can already be the same when the procedure
-          is declared with cdecl }
-        if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then
-         begin
-{$ifdef i386}
-           { place jump in codesegment }
-           codesegment.concat(Tai_align.Create_op(4,$90));
-           codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
-           codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname)));
-           codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
-{$endif i386}
-         end;
-      end
-     else
-      Message1(parser_e_no_export_of_variables_for_target,'SunOS');
-     hp2:=texported_item(hp2.next);
-   end;
-end;
-
-
-{*****************************************************************************
-                                  TLINKERSUNOS
-*****************************************************************************}
-
-Constructor TLinkersunos.Create;
-begin
-  Inherited Create;
-  LibrarySearchPath.AddPath('/lib;/usr/lib;/usr/X11R6/lib;/opt/sfw/lib',true);
-{$ifdef  LinkTest}
-     if (cs_link_staticflag in aktglobalswitches) then  WriteLN('ForceLinkStaticFlag');
-     if (cs_link_static in aktglobalswitches) then  WriteLN('LinkStatic-Flag');
-     if (cs_link_shared in aktglobalswitches) then  WriteLN('LinkSynamicFlag');
-{$EndIf}
-end;
-
-
-procedure TLinkersunos.SetDefaultInfo;
-{
-  This will also detect which libc version will be used
-}
-begin
-  Glibc2:=false;
-  Glibc21:=false;
-  with Info do
-   begin
-{$IFDEF GnuLd}
-     ExeCmd[1]:='gld $OPT $DYNLINK $STATIC $STRIP -L. -o $EXE $RES';
-     DllCmd[1]:='gld $OPT -shared -L. -o $EXE $RES';
-     DllCmd[2]:='strip --strip-unneeded $EXE';
-     DynamicLinker:=''; { Gnu uses the default }
-     Glibc21:=false;
-{$ELSE}
-    Not Implememted
-{$ENDIF}
-(* Linux Stuff not needed?
-     { first try glibc2 } // muss noch gendert werden
-     if FileExists(DynamicLinker) then
-      begin
-        Glibc2:=true;
-        { Check for 2.0 files, else use the glibc 2.1 stub }
-        if FileExists('/lib/ld-2.0.*') then
-         Glibc21:=false
-        else
-         Glibc21:=true;
-      end
-     else
-      DynamicLinker:='/lib/ld-linux.so.1';
-*)
-   end;
-
-end;
-
-
-Function TLinkersunos.WriteResponseFile(isdll:boolean) : Boolean;
-Var
-  linkres      : TLinkRes;
-  i            : longint;
-  cprtobj,
-  gprtobj,
-  prtobj       : string[80];
-  HPath        : TStringListItem;
-  s,s2         : string;
-  linkdynamic,
-  linklibc     : boolean;
-begin
-  WriteResponseFile:=False;
-{ set special options for some targets }
-  linkdynamic:=not(SharedLibFiles.empty);
-{  linkdynamic:=false; // da nicht getestet }
-  linklibc:=(SharedLibFiles.Find('c')<>nil);
-  prtobj:='prt0';
-  cprtobj:='cprt0';
-  gprtobj:='gprt0';
-  if cs_profile in aktmoduleswitches then
-   begin
-     prtobj:=gprtobj;
-     if not glibc2 then
-      AddSharedLibrary('gmon');
-     AddSharedLibrary('c');
-     linklibc:=true;
-   end
-  else
-   begin
-     if linklibc then
-       prtobj:=cprtobj
-      else
-       AddSharedLibrary('c'); { quick hack: this sunos implementation needs alwys libc }
-   end;
-
-  { Open link.res file }
-  LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);
-
-  { Write path to search libraries }
-  HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
-  while assigned(HPath) do
-   begin
-     LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
-     HPath:=TStringListItem(HPath.Next);
-   end;
-  HPath:=TStringListItem(LibrarySearchPath.First);
-  while assigned(HPath) do
-   begin
-     LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
-     HPath:=TStringListItem(HPath.Next);
-   end;
-
-  LinkRes.Add('INPUT(');
-  { add objectfiles, start with prt0 always }
-  if prtobj<>'' then
-   LinkRes.AddFileName(FindObjectFile(prtobj,''));
-  { try to add crti and crtbegin if linking to C }
-  if linklibc then { Needed in sunos? }
-   begin
-{     if librarysearchpath.FindFile('crtbegin.o',s) then
-      LinkRes.AddFileName(s);}
-     if librarysearchpath.FindFile('crti.o',s) then
-      LinkRes.AddFileName(s);
-   end;
-  { main objectfiles }
-  while not ObjectFiles.Empty do
-   begin
-     s:=ObjectFiles.GetFirst;
-     if s<>'' then
-      LinkRes.AddFileName(s);
-   end;
-  LinkRes.Add(')');
-
-  { Write staticlibraries }
-  if not StaticLibFiles.Empty then
-   begin
-     LinkRes.Add('GROUP(');
-     While not StaticLibFiles.Empty do
-      begin
-        S:=StaticLibFiles.GetFirst;
-        LinkRes.AddFileName(s)
-      end;
-     LinkRes.Add(')');
-   end;
-
-  { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
-    here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
-  if not SharedLibFiles.Empty then
-   begin
-     LinkRes.Add('INPUT(');
-     While not SharedLibFiles.Empty do
-      begin
-        S:=SharedLibFiles.GetFirst;
-        if s<>'c' then
-         begin
-           i:=Pos(target_info.sharedlibext,S);
-           if i>0 then
-            Delete(S,i,255);
-           LinkRes.Add('-l'+s);
-         end
-        else
-         begin
-           linklibc:=true;
-           linkdynamic:=false; { libc will include the ld-sunos (war ld-linux) for us }
-         end;
-      end;
-     { be sure that libc is the last lib }
-     if linklibc then
-      LinkRes.Add('-lc');
-     { when we have -static for the linker the we also need libgcc }
-     if (cs_link_staticflag in aktglobalswitches) then begin
-      LinkRes.Add('-lgcc');
-     end;
-     if linkdynamic and (Info.DynamicLinker<>'') then { gld has a default, DynamicLinker is not set in sunos }
-       LinkRes.AddFileName(Info.DynamicLinker);
-     LinkRes.Add(')');
-   end;
-  { objects which must be at the end }
-  if linklibc then {needed in sunos ? }
-   begin
-     if {librarysearchpath.FindFile('crtend.o',s1) or}
-        librarysearchpath.FindFile('crtn.o',s2) then
-      begin
-        LinkRes.Add('INPUT(');
-{        LinkRes.AddFileName(s1);}
-        LinkRes.AddFileName(s2);
-        LinkRes.Add(')');
-      end;
-   end;
-{ Write and Close response }
-  linkres.writetodisk;
-  LinkRes.Free;
-
-  WriteResponseFile:=True;
-end;
-
-
-function TLinkersunos.MakeExecutable:boolean;
-var
-  binstr,
-  cmdstr  : string;
-  success : boolean;
-  DynLinkStr : string[60];
-  StaticStr,
-  StripStr   : string[40];
-begin
-  if not(cs_link_extern in aktglobalswitches) then
-   Message1(exec_i_linking,current_module.exefilename^);
-
-{ Create some replacements }
-  StaticStr:='';
-  StripStr:='';
-  DynLinkStr:='';
-  if (cs_link_staticflag in aktglobalswitches) then
-    StaticStr:='-Bstatic';
-  if (cs_link_strip in aktglobalswitches) then
-   StripStr:='-s';
-  If (cs_profile in aktmoduleswitches) or
-     ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
-   DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;
-  { sunos sets DynamicLinker, but gld will (hopefully) defaults to -Bdynamic and add the default-linker }
-{ Write used files and libraries }
-  WriteResponseFile(false);
-
-{ Call linker }
-  SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.exefilename^);
-  Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
-  Replace(cmdstr,'$STATIC',StaticStr);
-  Replace(cmdstr,'$STRIP',StripStr);
-  Replace(cmdstr,'$DYNLINK',DynLinkStr);
-  success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
-
-{ Remove ReponseFile }
-{$IFNDEF LinkTest}
-  if (success) and not(cs_link_extern in aktglobalswitches) then
-   RemoveFile(outputexedir+Info.ResName);
-{$ENDIF}
-  MakeExecutable:=success;   { otherwise a recursive call to link method }
-end;
-
-
-Function TLinkersunos.MakeSharedLibrary:boolean;
-var
-  binstr,
-  cmdstr  : string;
-  success : boolean;
-begin
-  MakeSharedLibrary:=false;
-  if not(cs_link_extern in aktglobalswitches) then
-   Message1(exec_i_linking,current_module.sharedlibfilename^);
-
-{ Write used files and libraries }
-  WriteResponseFile(true);
-
-{ Call linker }
-  SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
-  Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
-  success:=DoExec(FindUtil(binstr),cmdstr,true,false);
-
-{ Strip the library ? }
-  if success and (cs_link_strip in aktglobalswitches) then
-   begin
-     SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
-     Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
-     success:=DoExec(FindUtil(binstr),cmdstr,true,false);
-   end;
-
-{ Remove ReponseFile }
-{$IFNDEF LinkTest}
-  if (success) and not(cs_link_extern in aktglobalswitches) then
-   RemoveFile(outputexedir+Info.ResName);
-{$ENDIF}
-  MakeSharedLibrary:=success;   { otherwise a recursive call to link method }
-end;
-
-
-{*****************************************************************************
-                                     Initialize
-*****************************************************************************}
-
-initialization
-  RegisterExternalLinker(system_i386_sunos_info,TLinkerSunos);
-  RegisterImport(system_i386_sunos,TImportLibSunos);
-  RegisterExport(system_i386_sunos,TExportLibSunos);
-  RegisterTarget(system_i386_sunos_info);
-end.
-{
-  $Log$
-  Revision 1.29  2002-09-03 16:26:29  daniel
-    * Make Tprocdef.defs protected
-
-  Revision 1.28  2002/08/12 15:08:44  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.27  2002/08/11 14:32:32  peter
-    * renamed current_library to objectlibrary
-
-  Revision 1.26  2002/08/11 13:24:20  peter
-    * saving of asmsymbols in ppu supported
-    * asmsymbollist global is removed and moved into a new class
-      tasmlibrarydata that will hold the info of a .a file which
-      corresponds with a single module. Added librarydata to tmodule
-      to keep the library info stored for the module. In the future the
-      objectfiles will also be stored to the tasmlibrarydata class
-    * all getlabel/newasmsymbol and friends are moved to the new class
-
-  Revision 1.25  2002/07/26 21:15:46  florian
-    * rewrote the system handling
-
-  Revision 1.24  2002/07/01 18:46:35  peter
-    * internal linker
-    * reorganized aasm layer
-
-  Revision 1.23  2002/05/18 13:34:27  peter
-    * readded missing revisions
-
-  Revision 1.22  2002/05/16 19:46:53  carl
-  + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
-  + try to fix temp allocation (still in ifdef)
-  + generic constructor calls
-  + start of tassembler / tmodulebase class cleanup
-
-  Revision 1.20  2002/04/22 18:19:22  carl
-  - remove use_bound_instruction field
-
-  Revision 1.19  2002/04/20 21:43:18  carl
-  * fix stack size for some targets
-  + add offset to parameters from frame pointer info.
-  - remove some unused stuff
-
-  Revision 1.18  2002/04/19 15:46:05  peter
-    * mangledname rewrite, tprocdef.mangledname is now created dynamicly
-      in most cases and not written to the ppu
-    * add mangeledname_prefix() routine to generate the prefix of
-      manglednames depending on the current procedure, object and module
-    * removed static procprefix since the mangledname is now build only
-      on demand from tprocdef.mangledname
-
-  Revision 1.17  2002/04/15 19:16:57  carl
-  - remove size_of_pointer field
-
-  Revision 1.16  2002/03/04 19:10:14  peter
-    * removed compiler warnings
-
-}

+ 0 - 152
compiler/targets/t_wdosx.pas

@@ -1,152 +0,0 @@
-{
-    $Id$
-    Copyright (c) 2001-2002 Pavel ??????
-
-    This unit implements support import,export,link routines
-    for the (i386) WDOSX target
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
-}
-unit t_wdosx;
-
-{$i fpcdefs.inc}
-
-interface
-
-
-implementation
-
-    uses
-       cutils,
-       fmodule,globals,systems,
-       import,export,link,t_win32,i_wdosx;
-
-  type
-    timportlibwdosx=class(timportlibwin32)
-      procedure GetDefExt(var N:longint;var P:pStr4);override;
-    end;
-
-    texportlibwdosx=texportlibwin32;
-
-    tlinkerwdosx=class(tlinkerwin32)
-    public
-       function  MakeExecutable:boolean;override;
-    end;
-
-    tDLLScannerWdosx=class(tDLLScannerWin32)
-    public
-      procedure GetDefExt(var N:longint;var P:pStr4);override;
-    end;
-
-const
- DefaultDLLExtensions:array[1..2]of string[4]=('.WDL','.DLL');
-
-
-{*****************************************************************************
-                             TIMPORTLIBWDOSX
-*****************************************************************************}
-    procedure timportlibwdosx.GetDefExt(var N:longint;var P:pStr4);
-     begin
-      N:=sizeof(DefaultDLLExtensions)div sizeof(DefaultDLLExtensions[1]);
-      pointer(P):=@DefaultDLLExtensions;
-     end;
-
-{*****************************************************************************
-                             TLINKERWDOSX
-*****************************************************************************}
-function TLinkerWdosx.MakeExecutable:boolean;
-begin
- Result:=inherited;
- if Result then
-  DoExec(FindUtil('stubit'),current_module.exefilename^,false,false);
-end;
-
-{****************************************************************************
-                            TDLLScannerWdosx
-****************************************************************************}
-    procedure tDLLScannerWdosx.GetDefExt(var N:longint;var P:pStr4);
-     begin
-      N:=sizeof(DefaultDLLExtensions)div sizeof(DefaultDLLExtensions[1]);
-      pointer(P):=@DefaultDLLExtensions;
-     end;
-
-{*****************************************************************************
-                                     Initialize
-*****************************************************************************}
-
-initialization
-  RegisterExternalLinker(system_i386_wdosx_info,TLinkerWdosx);
-  RegisterImport(system_i386_wdosx,TImportLibWdosx);
-  RegisterExport(system_i386_wdosx,TExportLibWdosx);
-  RegisterDLLScanner(system_i386_wdosx,TDLLScannerWdosx);
-    {RegisterAr(ar_gnu_arw_info);}
-    {RegisterRes(res_gnu_windres_info);}
-  RegisterTarget(system_i386_wdosx_info);
-end.
-
-{
-  $Log$
-  Revision 1.10  2002-08-12 15:08:44  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.9  2002/07/26 21:15:46  florian
-    * rewrote the system handling
-
-  Revision 1.8  2002/05/18 13:34:27  peter
-    * readded missing revisions
-
-  Revision 1.7  2002/05/16 19:46:53  carl
-  + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
-  + try to fix temp allocation (still in ifdef)
-  + generic constructor calls
-  + start of tassembler / tmodulebase class cleanup
-
-  Revision 1.5  2002/05/12 16:53:18  peter
-    * moved entry and exitcode to ncgutil and cgobj
-    * foreach gets extra argument for passing local data to the
-      iterator function
-    * -CR checks also class typecasts at runtime by changing them
-      into as
-    * fixed compiler to cycle with the -CR option
-    * fixed stabs with elf writer, finally the global variables can
-      be watched
-    * removed a lot of routines from cga unit and replaced them by
-      calls to cgobj
-    * u32bit-s32bit updates for and,or,xor nodes. When one element is
-      u32bit then the other is typecasted also to u32bit without giving
-      a rangecheck warning/error.
-    * fixed pascal calling method with reversing also the high tree in
-      the parast, detected by tcalcst3 test
-
-  Revision 1.4  2002/04/22 18:19:22  carl
-  - remove use_bound_instruction field
-
-  Revision 1.3  2002/04/20 21:43:18  carl
-  * fix stack size for some targets
-  + add offset to parameters from frame pointer info.
-  - remove some unused stuff
-
-  Revision 1.2  2002/04/15 19:16:57  carl
-  - remove size_of_pointer field
-
-  Revision 1.1  2002/04/04 18:09:49  carl
-  + added wdosx patch from Pavel
-
-}

+ 0 - 1636
compiler/targets/t_win32.pas

@@ -1,1636 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support import,export,link routines
-    for the (i386) Win32 target
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
-}
-unit t_win32;
-
-{$i fpcdefs.inc}
-
-interface
-    uses
-{$ifdef Delphi}
-       dmisc,
-{$else Delphi}
-       dos,
-{$endif Delphi}
-       cutils,cclasses,
-       aasmbase,aasmtai,aasmcpu,fmodule,globtype,globals,systems,verbose,
-       symconst,symsym,
-       script,gendef,
-       cpubase,
-{$ifdef GDB}
-       gdb,
-{$endif}
-       import,export,link,rgobj,i_win32;
-
-
-  const
-     MAX_DEFAULT_EXTENSIONS = 3;
-
-  type
-     tStr4=array[1..MAX_DEFAULT_EXTENSIONS]of string[4];
-     pStr4=^tStr4;
-
-    timportlibwin32=class(timportlib)
-      procedure GetDefExt(var N:longint;var P:pStr4);virtual;
-      procedure preparelib(const s:string);override;
-      procedure importprocedure(const func,module:string;index:longint;const name:string);override;
-      procedure importvariable(const varname,module:string;const name:string);override;
-      procedure generatelib;override;
-      procedure generatenasmlib;virtual;
-      procedure generatesmartlib;override;
-    end;
-
-    texportlibwin32=class(texportlib)
-      st : string;
-      last_index : longint;
-      procedure preparelib(const s:string);override;
-      procedure exportprocedure(hp : texported_item);override;
-      procedure exportvar(hp : texported_item);override;
-      procedure generatelib;override;
-      procedure generatenasmlib;virtual;
-    end;
-
-    tlinkerwin32=class(texternallinker)
-    private
-       Function  WriteResponseFile(isdll:boolean) : Boolean;
-       Function  PostProcessExecutable(const fn:string;isdll:boolean) : Boolean;
-    public
-       Constructor Create;override;
-       Procedure SetDefaultInfo;override;
-       function  MakeExecutable:boolean;override;
-       function  MakeSharedLibrary:boolean;override;
-    end;
-
-    tDLLScannerWin32=class(tDLLScanner)
-    private
-      cstring : array[0..127]of char;
-      function DOSstubOK(var x:cardinal):boolean;
-      function FindDLL(const s:string;var founddll:string):boolean;
-      function ExtractDllName(Const Name : string) : string;
-    public
-      procedure GetDefExt(var N:longint;var P:pStr4);virtual;
-      function isSuitableFileType(x:cardinal):longbool;override;
-      function GetEdata(HeaderEntry:cardinal):longbool;override;
-      function Scan(const binname:string):longbool;override;
-    end;
-implementation
-
-    function DllName(Const Name : string;NdefExt:longint;DefExt:pStr4) : string;
-      var n : string;
-          i:longint;
-      begin
-         n:=Upper(SplitExtension(Name));
-         for i:=1 to NdefExt do
-          if n=DefExt^[i]then
-           begin
-            DllName:=Name;
-            exit;
-           end
-         else
-           DllName:=Name+target_info.sharedlibext;
-      end;
-
-const
- DefaultDLLExtensions:array[1..MAX_DEFAULT_EXTENSIONS]of string[4]=('.DLL','.DRV','.EXE');
-
-
-{*****************************************************************************
-                             TIMPORTLIBWIN32
-*****************************************************************************}
-    procedure timportlibwin32.GetDefExt(var N:longint;var P:pStr4);
-     begin
-      N:=sizeof(DefaultDLLExtensions)div sizeof(DefaultDLLExtensions[1]);
-      pointer(P):=@DefaultDLLExtensions;
-     end;
-
-    procedure timportlibwin32.preparelib(const s : string);
-      begin
-         if not(assigned(importssection)) then
-           importssection:=TAAsmoutput.create;
-      end;
-
-
-    procedure timportlibwin32.importprocedure(const func,module : string;index : longint;const name : string);
-      var
-         hp1 : timportlist;
-         hp2 : timported_item;
-         hs  : string;
-         PP:pStr4;NN:longint;
-      begin
-         { force the current mangledname }
-         aktprocdef.has_mangledname:=true;
-         { append extension if required }
-         GetDefExt(NN,PP);
-         hs:=DllName(module,NN,PP);
-         { search for the module }
-         hp1:=timportlist(current_module.imports.first);
-         while assigned(hp1) do
-           begin
-              if hs=hp1.dllname^ then
-                break;
-              hp1:=timportlist(hp1.next);
-           end;
-         { generate a new item ? }
-         if not(assigned(hp1)) then
-           begin
-              hp1:=timportlist.create(hs);
-              current_module.imports.concat(hp1);
-           end;
-         { search for reuse of old import item }
-         hp2:=timported_item(hp1.imported_items.first);
-         while assigned(hp2) do
-          begin
-            if hp2.func^=func then
-             break;
-            hp2:=timported_item(hp2.next);
-          end;
-         if not assigned(hp2) then
-          begin
-            hp2:=timported_item.create(func,name,index);
-            hp1.imported_items.concat(hp2);
-          end;
-      end;
-
-
-    procedure timportlibwin32.importvariable(const varname,module:string;const name:string);
-      var
-         hp1 : timportlist;
-         hp2 : timported_item;
-         hs  : string;
-         NN:longint;PP:pStr4;
-      begin
-         GetDefExt(NN,PP);
-         hs:=DllName(module,NN,PP);
-         { search for the module }
-         hp1:=timportlist(current_module.imports.first);
-         while assigned(hp1) do
-           begin
-              if hs=hp1.dllname^ then
-                break;
-              hp1:=timportlist(hp1.next);
-           end;
-         { generate a new item ? }
-         if not(assigned(hp1)) then
-           begin
-              hp1:=timportlist.create(hs);
-              current_module.imports.concat(hp1);
-           end;
-         hp2:=timported_item.create_var(varname,name);
-         hp1.imported_items.concat(hp2);
-      end;
-
-    procedure timportlibwin32.generatenasmlib;
-      var
-         hp1 : timportlist;
-         hp2 : timported_item;
-         p : pchar;
-      begin
-         importssection.concat(tai_section.create(sec_code));
-         hp1:=timportlist(current_module.imports.first);
-         while assigned(hp1) do
-           begin
-             hp2:=timported_item(hp1.imported_items.first);
-             while assigned(hp2) do
-               begin
-                 if (aktoutputformat=as_i386_tasm) or
-                    (aktoutputformat=as_i386_masm) then
-                   p:=strpnew(#9+'EXTRN '+hp2.func^)
-                 else
-                   p:=strpnew(#9+'EXTERN '+hp2.func^);
-                 importssection.concat(tai_direct.create(p));
-                 p:=strpnew(#9+'import '+hp2.func^+' '+hp1.dllname^+' '+hp2.name^);
-                 importssection.concat(tai_direct.create(p));
-                 hp2:=timported_item(hp2.next);
-               end;
-             hp1:=timportlist(hp1.next);
-           end;
-      end;
-
-
-    const
-     MainAsmFormats=[as_i386_asw,as_i386_pecoff,as_i386_pecoffwdosx];
-    procedure timportlibwin32.generatesmartlib;
-      var
-         hp1 : timportlist;
-{$ifdef GDB}
-         importname : string;
-         suffix : integer;
-{$endif GDB}
-         hp2 : timported_item;
-         lhead,lname,lcode,
-         lidata4,lidata5 : tasmlabel;
-         href : treference;
-      begin
-         if not(aktoutputformat in MainAsmFormats)then
-          begin
-            generatenasmlib;
-            exit;
-          end;
-         hp1:=timportlist(current_module.imports.first);
-         while assigned(hp1) do
-           begin
-           { Get labels for the sections }
-             objectlibrary.getdatalabel(lhead);
-             objectlibrary.getdatalabel(lname);
-             objectlibrary.getaddrlabel(lidata4);
-             objectlibrary.getaddrlabel(lidata5);
-           { create header for this importmodule }
-             importsSection.concat(Tai_cut.Create_begin);
-             importsSection.concat(Tai_section.Create(sec_idata2));
-             importsSection.concat(Tai_label.Create(lhead));
-             { pointer to procedure names }
-             importsSection.concat(Tai_const_symbol.Create_rva(lidata4));
-             { two empty entries follow }
-             importsSection.concat(Tai_const.Create_32bit(0));
-             importsSection.concat(Tai_const.Create_32bit(0));
-             { pointer to dll name }
-             importsSection.concat(Tai_const_symbol.Create_rva(lname));
-             { pointer to fixups }
-             importsSection.concat(Tai_const_symbol.Create_rva(lidata5));
-             { first write the name references }
-             importsSection.concat(Tai_section.Create(sec_idata4));
-             importsSection.concat(Tai_const.Create_32bit(0));
-             importsSection.concat(Tai_label.Create(lidata4));
-             { then the addresses and create also the indirect jump }
-             importsSection.concat(Tai_section.Create(sec_idata5));
-             importsSection.concat(Tai_const.Create_32bit(0));
-             importsSection.concat(Tai_label.Create(lidata5));
-
-             { create procedures }
-             hp2:=timported_item(hp1.imported_items.first);
-             while assigned(hp2) do
-               begin
-                 { insert cuts }
-                 importsSection.concat(Tai_cut.Create);
-                 { create indirect jump }
-                 if not hp2.is_var then
-                  begin
-                    objectlibrary.getlabel(lcode);
-                    reference_reset_symbol(href,lcode,0);
-                    { place jump in codesegment, insert a code section in the
-                      imporTSection to reduce the amount of .s files (PFV) }
-                    importsSection.concat(Tai_section.Create(sec_code));
-{$IfDef GDB}
-                    if (cs_debuginfo in aktmoduleswitches) then
-                     importsSection.concat(Tai_stab_function_name.Create(nil));
-{$EndIf GDB}
-                    importsSection.concat(Tai_symbol.Createname_global(hp2.func^,0));
-                    importsSection.concat(Taicpu.Op_ref(A_JMP,S_NO,href));
-                    importsSection.concat(Tai_align.Create_op(4,$90));
-                  end;
-                 { create head link }
-                 importsSection.concat(Tai_section.Create(sec_idata7));
-                 importsSection.concat(Tai_const_symbol.Create_rva(lhead));
-                 { fixup }
-                 objectlibrary.getlabel(tasmlabel(hp2.lab));
-                 importsSection.concat(Tai_section.Create(sec_idata4));
-                 importsSection.concat(Tai_const_symbol.Create_rva(hp2.lab));
-                 { add jump field to imporTSection }
-                 importsSection.concat(Tai_section.Create(sec_idata5));
-                 if hp2.is_var then
-                  importsSection.concat(Tai_symbol.Createname_global(hp2.func^,0))
-                 else
-                  importsSection.concat(Tai_label.Create(lcode));
-{$ifdef GDB}
-                 if (cs_debuginfo in aktmoduleswitches) then
-                  begin
-                    if assigned(hp2.name) then
-                      begin
-                        importname:='__imp_'+hp2.name^;
-                        suffix:=0;
-                        while assigned(objectlibrary.getasmsymbol(importname)) do
-                         begin
-                           inc(suffix);
-                           importname:='__imp_'+hp2.name^+'_'+tostr(suffix);
-                         end;
-                        importssection.concat(tai_symbol.createname(importname,4));
-                      end
-                    else
-                      begin
-                        importname:='__imp_by_ordinal'+tostr(hp2.ordnr);
-                        suffix:=0;
-                        while assigned(objectlibrary.getasmsymbol(importname)) do
-                         begin
-                           inc(suffix);
-                           importname:='__imp_by_ordinal'+tostr(hp2.ordnr)+'_'+tostr(suffix);
-                         end;
-                        importssection.concat(tai_symbol.createname(importname,4));
-                      end;
-                  end;
-{$endif GDB}
-                 if hp2.name^<>'' then
-                  importsSection.concat(Tai_const_symbol.Create_rva(hp2.lab))
-                 else
-                  importsSection.concat(Tai_const.Create_32bit($80000000 or hp2.ordnr));
-                 { finally the import information }
-                 importsSection.concat(Tai_section.Create(sec_idata6));
-                 importsSection.concat(Tai_label.Create(hp2.lab));
-                 importsSection.concat(Tai_const.Create_16bit(hp2.ordnr));
-                 importsSection.concat(Tai_string.Create(hp2.name^+#0));
-                 importsSection.concat(Tai_align.Create_op(2,0));
-                 hp2:=timported_item(hp2.next);
-               end;
-
-              { write final section }
-              importsSection.concat(Tai_cut.Create_end);
-              { end of name references }
-              importsSection.concat(Tai_section.Create(sec_idata4));
-              importsSection.concat(Tai_const.Create_32bit(0));
-              { end if addresses }
-              importsSection.concat(Tai_section.Create(sec_idata5));
-              importsSection.concat(Tai_const.Create_32bit(0));
-              { dllname }
-              importsSection.concat(Tai_section.Create(sec_idata7));
-              importsSection.concat(Tai_label.Create(lname));
-              importsSection.concat(Tai_string.Create(hp1.dllname^+#0));
-
-              hp1:=timportlist(hp1.next);
-           end;
-       end;
-
-
-    procedure timportlibwin32.generatelib;
-      var
-         hp1 : timportlist;
-         hp2 : timported_item;
-         l1,l2,l3,l4 : tasmlabel;
-{$ifdef GDB}
-         importname : string;
-         suffix : integer;
-{$endif GDB}
-         href : treference;
-      begin
-         if not(aktoutputformat in MainAsmFormats)then
-          begin
-            generatenasmlib;
-            exit;
-          end;
-         hp1:=timportlist(current_module.imports.first);
-         while assigned(hp1) do
-           begin
-              { align codesegment for the jumps }
-              importsSection.concat(Tai_section.Create(sec_code));
-              importsSection.concat(Tai_align.Create_op(4,$90));
-              { Get labels for the sections }
-              objectlibrary.getlabel(l1);
-              objectlibrary.getlabel(l2);
-              objectlibrary.getlabel(l3);
-              importsSection.concat(Tai_section.Create(sec_idata2));
-              { pointer to procedure names }
-              importsSection.concat(Tai_const_symbol.Create_rva(l2));
-              { two empty entries follow }
-              importsSection.concat(Tai_const.Create_32bit(0));
-              importsSection.concat(Tai_const.Create_32bit(0));
-              { pointer to dll name }
-              importsSection.concat(Tai_const_symbol.Create_rva(l1));
-              { pointer to fixups }
-              importsSection.concat(Tai_const_symbol.Create_rva(l3));
-
-              { only create one section for each else it will
-                create a lot of idata* }
-
-              { first write the name references }
-              importsSection.concat(Tai_section.Create(sec_idata4));
-              importsSection.concat(Tai_label.Create(l2));
-
-              hp2:=timported_item(hp1.imported_items.first);
-              while assigned(hp2) do
-                begin
-                   objectlibrary.getlabel(tasmlabel(hp2.lab));
-                   if hp2.name^<>'' then
-                     importsSection.concat(Tai_const_symbol.Create_rva(hp2.lab))
-                   else
-                     importsSection.concat(Tai_const.Create_32bit($80000000 or hp2.ordnr));
-                   hp2:=timported_item(hp2.next);
-                end;
-              { finalize the names ... }
-              importsSection.concat(Tai_const.Create_32bit(0));
-
-              { then the addresses and create also the indirect jump }
-              importsSection.concat(Tai_section.Create(sec_idata5));
-              importsSection.concat(Tai_label.Create(l3));
-              hp2:=timported_item(hp1.imported_items.first);
-              while assigned(hp2) do
-                begin
-                   if not hp2.is_var then
-                    begin
-                      objectlibrary.getlabel(l4);
-                      { create indirect jump }
-                      reference_reset_symbol(href,l4,0);
-                      { place jump in codesegment }
-                      importsSection.concat(Tai_section.Create(sec_code));
-                      importsSection.concat(Tai_symbol.Createname_global(hp2.func^,0));
-                      importsSection.concat(Taicpu.Op_ref(A_JMP,S_NO,href));
-                      importsSection.concat(Tai_align.Create_op(4,$90));
-                      { add jump field to imporTSection }
-                      importsSection.concat(Tai_section.Create(sec_idata5));
-{$ifdef GDB}
-                      if (cs_debuginfo in aktmoduleswitches) then
-                       begin
-                         if assigned(hp2.name) then
-                          begin
-                            importname:='__imp_'+hp2.name^;
-                            suffix:=0;
-                            while assigned(objectlibrary.getasmsymbol(importname)) do
-                             begin
-                               inc(suffix);
-                               importname:='__imp_'+hp2.name^+'_'+tostr(suffix);
-                             end;
-                            importssection.concat(tai_symbol.createname(importname,4));
-                          end
-                         else
-                          begin
-                            importname:='__imp_by_ordinal'+tostr(hp2.ordnr);
-                            suffix:=0;
-                            while assigned(objectlibrary.getasmsymbol(importname)) do
-                             begin
-                               inc(suffix);
-                               importname:='__imp_by_ordinal'+tostr(hp2.ordnr)+'_'+tostr(suffix);
-                             end;
-                            importssection.concat(tai_symbol.createname(importname,4));
-                          end;
-                       end;
-{$endif GDB}
-                      importsSection.concat(Tai_label.Create(l4));
-                    end
-                   else
-                    begin
-                      importsSection.concat(Tai_symbol.Createname_global(hp2.func^,0));
-                    end;
-                   importsSection.concat(Tai_const_symbol.Create_rva(hp2.lab));
-                   hp2:=timported_item(hp2.next);
-                end;
-              { finalize the addresses }
-              importsSection.concat(Tai_const.Create_32bit(0));
-
-              { finally the import information }
-              importsSection.concat(Tai_section.Create(sec_idata6));
-              hp2:=timported_item(hp1.imported_items.first);
-              while assigned(hp2) do
-                begin
-                   importsSection.concat(Tai_label.Create(hp2.lab));
-                   { the ordinal number }
-                   importsSection.concat(Tai_const.Create_16bit(hp2.ordnr));
-                   importsSection.concat(Tai_string.Create(hp2.name^+#0));
-                   importsSection.concat(Tai_align.Create_op(2,0));
-                   hp2:=timported_item(hp2.next);
-                end;
-              { create import dll name }
-              importsSection.concat(Tai_section.Create(sec_idata7));
-              importsSection.concat(Tai_label.Create(l1));
-              importsSection.concat(Tai_string.Create(hp1.dllname^+#0));
-
-              hp1:=timportlist(hp1.next);
-           end;
-      end;
-
-
-{*****************************************************************************
-                             TEXPORTLIBWIN32
-*****************************************************************************}
-
-    procedure texportlibwin32.preparelib(const s:string);
-      begin
-         if not(assigned(exportssection)) then
-           exportssection:=TAAsmoutput.create;
-         last_index:=0;
-         objectlibrary.getdatalabel(edatalabel);
-      end;
-
-
-
-    procedure texportlibwin32.exportvar(hp : texported_item);
-      begin
-         { same code used !! PM }
-         exportprocedure(hp);
-      end;
-
-
-    procedure texportlibwin32.exportprocedure(hp : texported_item);
-      { must be ordered at least for win32 !! }
-      var
-        hp2 : texported_item;
-      begin
-        { first test the index value }
-        if (hp.options and eo_index)<>0 then
-          begin
-             if (hp.index<=0) or (hp.index>$ffff) then
-               begin
-                 message1(parser_e_export_invalid_index,tostr(hp.index));
-                 exit;
-               end;
-             if (hp.index<=last_index) then
-               begin
-                 message1(parser_e_export_ordinal_double,tostr(hp.index));
-                 { disregard index value }
-                 inc(last_index);
-                 hp.index:=last_index;
-                 exit;
-               end
-             else
-               begin
-                 last_index:=hp.index;
-               end;
-          end
-        else
-          begin
-             inc(last_index);
-             hp.index:=last_index;
-          end;
-        { now place in correct order }
-        hp2:=texported_item(current_module._exports.first);
-        while assigned(hp2) and
-           (hp.name^>hp2.name^) do
-          hp2:=texported_item(hp2.next);
-        { insert hp there !! }
-        if assigned(hp2) and (hp2.name^=hp.name^) then
-          begin
-             { this is not allowed !! }
-             message1(parser_e_export_name_double,hp.name^);
-             exit;
-          end;
-        if hp2=texported_item(current_module._exports.first) then
-          current_module._exports.concat(hp)
-        else if assigned(hp2) then
-          begin
-             hp.next:=hp2;
-             hp.previous:=hp2.previous;
-             if assigned(hp2.previous) then
-               hp2.previous.next:=hp;
-             hp2.previous:=hp;
-          end
-        else
-          current_module._exports.concat(hp);
-      end;
-
-
-    procedure texportlibwin32.generatelib;
-      var
-         ordinal_base,ordinal_max,ordinal_min : longint;
-         current_index : longint;
-         entries,named_entries : longint;
-         name_label,dll_name_label,export_address_table : tasmlabel;
-         export_name_table_pointers,export_ordinal_table : tasmlabel;
-         hp,hp2 : texported_item;
-         temtexport : TLinkedList;
-         address_table,name_table_pointers,
-         name_table,ordinal_table : TAAsmoutput;
-      begin
-        if not (aktoutputformat in MainAsmFormats)then
-         begin
-           generatenasmlib;
-           exit;
-         end;
-
-         hp:=texported_item(current_module._exports.first);
-         if not assigned(hp) then
-           exit;
-
-         ordinal_max:=0;
-         ordinal_min:=$7FFFFFFF;
-         entries:=0;
-         named_entries:=0;
-         objectlibrary.getlabel(dll_name_label);
-         objectlibrary.getlabel(export_address_table);
-         objectlibrary.getlabel(export_name_table_pointers);
-         objectlibrary.getlabel(export_ordinal_table);
-
-         { count entries }
-         while assigned(hp) do
-           begin
-              inc(entries);
-              if (hp.index>ordinal_max) then
-                ordinal_max:=hp.index;
-              if (hp.index>0) and (hp.index<ordinal_min) then
-                ordinal_min:=hp.index;
-              if assigned(hp.name) then
-                inc(named_entries);
-              hp:=texported_item(hp.next);
-           end;
-
-         { no support for higher ordinal base yet !! }
-         ordinal_base:=1;
-         current_index:=ordinal_base;
-         { we must also count the holes !! }
-         entries:=ordinal_max-ordinal_base+1;
-
-         exportsSection.concat(Tai_section.Create(sec_edata));
-         { create label to reference from main so smartlink will include
-           the .edata section }
-         exportsSection.concat(Tai_symbol.Create(edatalabel,0));
-         { export flags }
-         exportsSection.concat(Tai_const.Create_32bit(0));
-         { date/time stamp }
-         exportsSection.concat(Tai_const.Create_32bit(0));
-         { major version }
-         exportsSection.concat(Tai_const.Create_16bit(0));
-         { minor version }
-         exportsSection.concat(Tai_const.Create_16bit(0));
-         { pointer to dll name }
-         exportsSection.concat(Tai_const_symbol.Create_rva(dll_name_label));
-         { ordinal base normally set to 1 }
-         exportsSection.concat(Tai_const.Create_32bit(ordinal_base));
-         { number of entries }
-         exportsSection.concat(Tai_const.Create_32bit(entries));
-         { number of named entries }
-         exportsSection.concat(Tai_const.Create_32bit(named_entries));
-         { address of export address table }
-         exportsSection.concat(Tai_const_symbol.Create_rva(export_address_table));
-         { address of name pointer pointers }
-         exportsSection.concat(Tai_const_symbol.Create_rva(export_name_table_pointers));
-         { address of ordinal number pointers }
-         exportsSection.concat(Tai_const_symbol.Create_rva(export_ordinal_table));
-         { the name }
-         exportsSection.concat(Tai_label.Create(dll_name_label));
-         if st='' then
-           exportsSection.concat(Tai_string.Create(current_module.modulename^+target_info.sharedlibext+#0))
-         else
-           exportsSection.concat(Tai_string.Create(st+target_info.sharedlibext+#0));
-
-         {  export address table }
-         address_table:=TAAsmoutput.create;
-         address_table.concat(Tai_align.Create_op(4,0));
-         address_table.concat(Tai_label.Create(export_address_table));
-         name_table_pointers:=TAAsmoutput.create;
-         name_table_pointers.concat(Tai_align.Create_op(4,0));
-         name_table_pointers.concat(Tai_label.Create(export_name_table_pointers));
-         ordinal_table:=TAAsmoutput.create;
-         ordinal_table.concat(Tai_align.Create_op(4,0));
-         ordinal_table.concat(Tai_label.Create(export_ordinal_table));
-         name_table:=TAAsmoutput.Create;
-         name_table.concat(Tai_align.Create_op(4,0));
-         { write each address }
-         hp:=texported_item(current_module._exports.first);
-         while assigned(hp) do
-           begin
-              if (hp.options and eo_name)<>0 then
-                begin
-                   objectlibrary.getlabel(name_label);
-                   name_table_pointers.concat(Tai_const_symbol.Create_rva(name_label));
-                   ordinal_table.concat(Tai_const.Create_16bit(hp.index-ordinal_base));
-                   name_table.concat(Tai_align.Create_op(2,0));
-                   name_table.concat(Tai_label.Create(name_label));
-                   name_table.concat(Tai_string.Create(hp.name^+#0));
-                end;
-              hp:=texported_item(hp.next);
-           end;
-         { order in increasing ordinal values }
-         { into temtexport list }
-         temtexport:=TLinkedList.Create;
-         hp:=texported_item(current_module._exports.first);
-         while assigned(hp) do
-           begin
-              current_module._exports.remove(hp);
-              hp2:=texported_item(temtexport.first);
-              while assigned(hp2) and (hp.index>hp2.index) do
-                begin
-                   hp2:=texported_item(hp2.next);
-                end;
-              if hp2=texported_item(temtexport.first) then
-                 temtexport.insert(hp)
-              else
-                begin
-                   if assigned(hp2) then
-                     begin
-                        hp.next:=hp2;
-                        hp.previous:=hp2.previous;
-                        hp2.previous:=hp;
-                        if assigned(hp.previous) then
-                          hp.previous.next:=hp;
-                      end
-                    else
-                      temtexport.concat(hp);
-                end;
-              hp:=texported_item(current_module._exports.first);;
-           end;
-
-         { write the export adress table }
-         current_index:=ordinal_base;
-         hp:=texported_item(temtexport.first);
-         while assigned(hp) do
-           begin
-              { fill missing values }
-              while current_index<hp.index do
-                begin
-                   address_table.concat(Tai_const.Create_32bit(0));
-                   inc(current_index);
-                end;
-              case hp.sym.typ of
-                varsym :
-                  address_table.concat(Tai_const_symbol.Createname_rva(tvarsym(hp.sym).mangledname));
-                typedconstsym :
-                  address_table.concat(Tai_const_symbol.Createname_rva(ttypedconstsym(hp.sym).mangledname));
-                procsym :
-                  address_table.concat(Tai_const_symbol.Createname_rva(tprocsym(hp.sym).first_procdef.mangledname));
-              end;
-              inc(current_index);
-              hp:=texported_item(hp.next);
-           end;
-
-         exportsSection.concatlist(address_table);
-         exportsSection.concatlist(name_table_pointers);
-         exportsSection.concatlist(ordinal_table);
-         exportsSection.concatlist(name_table);
-         address_table.Free;
-         name_table_pointers.free;
-         ordinal_table.free;
-         name_table.free;
-         temtexport.free;
-      end;
-
-    procedure texportlibwin32.generatenasmlib;
-      var
-         hp : texported_item;
-         p  : pchar;
-         s  : string;
-      begin
-         exportssection.concat(tai_section.create(sec_code));
-         hp:=texported_item(current_module._exports.first);
-         while assigned(hp) do
-           begin
-             case hp.sym.typ of
-               varsym :
-                 s:=tvarsym(hp.sym).mangledname;
-               typedconstsym :
-                 s:=ttypedconstsym(hp.sym).mangledname;
-               procsym :
-                 s:=tprocsym(hp.sym).first_procdef.mangledname;
-               else
-                 s:='';
-             end;
-             p:=strpnew(#9+'export '+s+' '+hp.name^+' '+tostr(hp.index));
-             exportssection.concat(tai_direct.create(p));
-             hp:=texported_item(hp.next);
-           end;
-      end;
-
-
-{****************************************************************************
-                              TLINKERWIN32
-****************************************************************************}
-
-
-Constructor TLinkerWin32.Create;
-begin
-  Inherited Create;
-  { allow duplicated libs (PM) }
-  SharedLibFiles.doubles:=true;
-  StaticLibFiles.doubles:=true;
-  If not ForceDeffileForExport then
-    UseDeffileForExport:=false;
-end;
-
-Procedure TLinkerWin32.SetDefaultInfo;
-begin
-  with Info do
-   begin
-     ExeCmd[1]:='ldw $OPT $STRIP $APPTYPE $IMAGEBASE $RELOC -o $EXE $RES';
-     DllCmd[1]:='ldw $OPT $STRIP --dll $APPTYPE $IMAGEBASE $RELOC -o $EXE $RES';
-     if RelocSection or UseDeffileForExport then
-       begin
-          { ExeCmd[2]:='dlltool --as $ASBIN --dllname $EXE --output-exp exp.$$$ $RELOC $DEF';
-            use short forms to avoid 128 char limitation problem }
-          ExeCmd[2]:='dlltool -S $ASBIN -D $EXE -e exp.$$$ $RELOC $DEF';
-          ExeCmd[3]:='ldw $OPT $STRIP $APPTYPE $IMAGEBASE -o $EXE $RES exp.$$$';
-          { DllCmd[2]:='dlltool --as $ASBIN --dllname $EXE --output-exp exp.$$$ $RELOC $DEF'; }
-          DllCmd[2]:='dlltool -S $ASBIN -D $EXE -e exp.$$$ $RELOC $DEF';
-          DllCmd[3]:='ldw $OPT $STRIP --dll $APPTYPE $IMAGEBASE -o $EXE $RES exp.$$$';
-       end;
-   end;
-end;
-
-
-
-Function TLinkerWin32.WriteResponseFile(isdll:boolean) : Boolean;
-Var
-  linkres : TLinkRes;
-  HPath   : TStringListItem;
-  s,s2    : string;
-  i       : integer;
-  linklibc : boolean;
-begin
-  WriteResponseFile:=False;
-  linklibc:=false;
-
-  { Open link.res file }
-  LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);
-
-  { Write path to search libraries }
-  HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
-  while assigned(HPath) do
-   begin
-     LinkRes.Add('SEARCH_DIR('+GetShortName(HPath.Str)+')');
-     HPath:=TStringListItem(HPath.Next);
-   end;
-  HPath:=TStringListItem(LibrarySearchPath.First);
-  while assigned(HPath) do
-   begin
-     LinkRes.Add('SEARCH_DIR('+GetShortName(HPath.Str)+')');
-     HPath:=TStringListItem(HPath.Next);
-   end;
-
-  { add objectfiles, start with prt0 always }
-  LinkRes.Add('INPUT(');
-  if isdll then
-   LinkRes.AddFileName(GetShortName(FindObjectFile('wdllprt0','')))
-  else
-   LinkRes.AddFileName(GetShortName(FindObjectFile('wprt0','')));
-  while not ObjectFiles.Empty do
-   begin
-     s:=ObjectFiles.GetFirst;
-     if s<>'' then
-      LinkRes.AddFileName(GetShortName(s));
-   end;
-  { add libaries required for profiling }
-  if cs_profile in aktmoduleswitches then
-   begin
-     LinkRes.Add('-lgmon');
-     LinkRes.Add('-lc');
-   end;
-  LinkRes.Add(')');
-
-  { Write staticlibraries }
-  if not StaticLibFiles.Empty then
-   begin
-     LinkRes.Add('GROUP(');
-     While not StaticLibFiles.Empty do
-      begin
-        S:=StaticLibFiles.GetFirst;
-        LinkRes.AddFileName(GetShortName(s));
-      end;
-     LinkRes.Add(')');
-   end;
-
-  { Write sharedlibraries }
-  if not SharedLibFiles.Empty then
-   begin
-     LinkRes.Add('INPUT(') ;
-     While not SharedLibFiles.Empty do
-      begin
-        S:=SharedLibFiles.GetFirst;
-        if FindLibraryFile(s,target_info.staticClibprefix,target_info.staticClibext,s2) then
-          begin
-            LinkRes.Add(GetShortName(s2));
-            continue;
-          end;
-        if pos(target_info.sharedlibprefix,s)=1 then
-          s:=copy(s,length(target_info.sharedlibprefix)+1,255);
-        if s<>'c' then
-         begin
-           i:=Pos(target_info.sharedlibext,S);
-           if i>0 then
-            Delete(S,i,255);
-           LinkRes.Add('-l'+s);
-         end
-        else
-         begin
-           LinkRes.Add('-l'+s);
-           linklibc:=true;
-         end;
-      end;
-     { be sure that libc is the last lib }
-     if linklibc then
-      LinkRes.Add('-lc');
-     LinkRes.Add(')');
-   end;
-
-{ Write and Close response }
-  linkres.writetodisk;
-  LinkRes.Free;
-
-  WriteResponseFile:=True;
-end;
-
-
-function TLinkerWin32.MakeExecutable:boolean;
-var
-  binstr,
-  cmdstr  : string;
-  success : boolean;
-  i       : longint;
-  AsBinStr     : string[80];
-  StripStr,
-  RelocStr,
-  AppTypeStr,
-  ImageBaseStr : string[40];
-begin
-  if not(cs_link_extern in aktglobalswitches) then
-   Message1(exec_i_linking,current_module.exefilename^);
-
-{ Create some replacements }
-  RelocStr:='';
-  AppTypeStr:='';
-  ImageBaseStr:='';
-  StripStr:='';
-  FindExe('asw',AsBinStr);
-  if RelocSection then
-   { Using short form to avoid problems with 128 char limitation under Dos. }
-   RelocStr:='-b base.$$$';
-  if apptype=app_gui then
-   AppTypeStr:='--subsystem windows';
-  if assigned(DLLImageBase) then
-   ImageBaseStr:='--image-base=0x'+DLLImageBase^;
-  if (cs_link_strip in aktglobalswitches) then
-   StripStr:='-s';
-
-{ Write used files and libraries }
-  WriteResponseFile(false);
-
-{ Call linker }
-  success:=false;
-  for i:=1 to 3 do
-   begin
-     SplitBinCmd(Info.ExeCmd[i],binstr,cmdstr);
-     if binstr<>'' then
-      begin
-        Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename^));
-        Replace(cmdstr,'$OPT',Info.ExtraOptions);
-        Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
-        Replace(cmdstr,'$APPTYPE',AppTypeStr);
-        Replace(cmdstr,'$ASBIN',AsbinStr);
-        Replace(cmdstr,'$RELOC',RelocStr);
-        Replace(cmdstr,'$IMAGEBASE',ImageBaseStr);
-        Replace(cmdstr,'$STRIP',StripStr);
-        if not DefFile.Empty {and UseDefFileForExport} then
-          begin
-            DefFile.WriteFile;
-            Replace(cmdstr,'$DEF','-d '+maybequoted(deffile.fname));
-          end
-        else
-          Replace(cmdstr,'$DEF','');
-        success:=DoExec(FindUtil(binstr),cmdstr,(i=1),false);
-        if not success then
-         break;
-      end;
-   end;
-
-{ Post process }
-  if success then
-   success:=PostProcessExecutable(current_module.exefilename^,false);
-
-{ Remove ReponseFile }
-  if (success) and not(cs_link_extern in aktglobalswitches) then
-   begin
-     RemoveFile(outputexedir+Info.ResName);
-     RemoveFile('base.$$$');
-     RemoveFile('exp.$$$');
-     RemoveFile('deffile.$$$');
-   end;
-
-  MakeExecutable:=success;   { otherwise a recursive call to link method }
-end;
-
-
-Function TLinkerWin32.MakeSharedLibrary:boolean;
-var
-  binstr,
-  cmdstr  : string;
-  success : boolean;
-  i       : longint;
-  AsBinStr     : string[80];
-  StripStr,
-  RelocStr,
-  AppTypeStr,
-  ImageBaseStr : string[40];
-begin
-  MakeSharedLibrary:=false;
-  if not(cs_link_extern in aktglobalswitches) then
-   Message1(exec_i_linking,current_module.sharedlibfilename^);
-
-{ Create some replacements }
-  RelocStr:='';
-  AppTypeStr:='';
-  ImageBaseStr:='';
-  StripStr:='';
-  FindExe('asw',AsBinStr);
-  if RelocSection then
-   { Using short form to avoid problems with 128 char limitation under Dos. }
-   RelocStr:='-b base.$$$';
-  if apptype=app_gui then
-   AppTypeStr:='--subsystem windows';
-  if assigned(DLLImageBase) then
-   ImageBaseStr:='--image-base=0x'+DLLImageBase^;
-  if (cs_link_strip in aktglobalswitches) then
-   StripStr:='-s';
-
-{ Write used files and libraries }
-  WriteResponseFile(true);
-
-{ Call linker }
-  success:=false;
-  for i:=1 to 3 do
-   begin
-     SplitBinCmd(Info.DllCmd[i],binstr,cmdstr);
-     if binstr<>'' then
-      begin
-        Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^));
-        Replace(cmdstr,'$OPT',Info.ExtraOptions);
-        Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
-        Replace(cmdstr,'$APPTYPE',AppTypeStr);
-        Replace(cmdstr,'$ASBIN',AsbinStr);
-        Replace(cmdstr,'$RELOC',RelocStr);
-        Replace(cmdstr,'$IMAGEBASE',ImageBaseStr);
-        Replace(cmdstr,'$STRIP',StripStr);
-        if not DefFile.Empty {and UseDefFileForExport} then
-          begin
-            DefFile.WriteFile;
-            Replace(cmdstr,'$DEF','-d '+maybequoted(deffile.fname));
-          end
-        else
-          Replace(cmdstr,'$DEF','');
-        success:=DoExec(FindUtil(binstr),cmdstr,(i=1),false);
-        if not success then
-         break;
-      end;
-   end;
-
-{ Post process }
-  if success then
-   success:=PostProcessExecutable(current_module.sharedlibfilename^,true);
-
-{ Remove ReponseFile }
-  if (success) and not(cs_link_extern in aktglobalswitches) then
-   begin
-     RemoveFile(outputexedir+Info.ResName);
-     RemoveFile('base.$$$');
-     RemoveFile('exp.$$$');
-   end;
-  MakeSharedLibrary:=success;   { otherwise a recursive call to link method }
-end;
-
-
-function tlinkerwin32.postprocessexecutable(const fn : string;isdll:boolean):boolean;
-type
-  tdosheader = packed record
-     e_magic : word;
-     e_cblp : word;
-     e_cp : word;
-     e_crlc : word;
-     e_cparhdr : word;
-     e_minalloc : word;
-     e_maxalloc : word;
-     e_ss : word;
-     e_sp : word;
-     e_csum : word;
-     e_ip : word;
-     e_cs : word;
-     e_lfarlc : word;
-     e_ovno : word;
-     e_res : array[0..3] of word;
-     e_oemid : word;
-     e_oeminfo : word;
-     e_res2 : array[0..9] of word;
-     e_lfanew : longint;
-  end;
-  tpeheader = packed record
-     PEMagic : array[0..3] of char;
-     Machine : word;
-     NumberOfSections : word;
-     TimeDateStamp : longint;
-     PointerToSymbolTable : longint;
-     NumberOfSymbols : longint;
-     SizeOfOptionalHeader : word;
-     Characteristics : word;
-     Magic : word;
-     MajorLinkerVersion : byte;
-     MinorLinkerVersion : byte;
-     SizeOfCode : longint;
-     SizeOfInitializedData : longint;
-     SizeOfUninitializedData : longint;
-     AddressOfEntryPoint : longint;
-     BaseOfCode : longint;
-     BaseOfData : longint;
-     ImageBase : longint;
-     SectionAlignment : longint;
-     FileAlignment : longint;
-     MajorOperatingSystemVersion : word;
-     MinorOperatingSystemVersion : word;
-     MajorImageVersion : word;
-     MinorImageVersion : word;
-     MajorSubsystemVersion : word;
-     MinorSubsystemVersion : word;
-     Reserved1 : longint;
-     SizeOfImage : longint;
-     SizeOfHeaders : longint;
-     CheckSum : longint;
-     Subsystem : word;
-     DllCharacteristics : word;
-     SizeOfStackReserve : longint;
-     SizeOfStackCommit : longint;
-     SizeOfHeapReserve : longint;
-     SizeOfHeapCommit : longint;
-     LoaderFlags : longint;
-     NumberOfRvaAndSizes : longint;
-     DataDirectory : array[1..$80] of byte;
-  end;
-  tcoffsechdr=packed record
-    name     : array[0..7] of char;
-    vsize    : longint;
-    rvaofs   : longint;
-    datalen  : longint;
-    datapos  : longint;
-    relocpos : longint;
-    lineno1  : longint;
-    nrelocs  : word;
-    lineno2  : word;
-    flags    : longint;
-  end;
-  psecfill=^TSecfill;
-  TSecfill=record
-    fillpos,
-    fillsize : longint;
-    next : psecfill;
-  end;
-var
-  f : file;
-  cmdstr : string;
-  dosheader : tdosheader;
-  peheader : tpeheader;
-  firstsecpos,
-  maxfillsize,
-  l,peheaderpos : longint;
-  coffsec : tcoffsechdr;
-  secroot,hsecroot : psecfill;
-  zerobuf : pointer;
-begin
-  postprocessexecutable:=false;
-  { when -s is used or it's a dll then quit }
-  if (cs_link_extern in aktglobalswitches) then
-   begin
-     case apptype of
-       app_gui :
-         cmdstr:='--subsystem gui';
-       app_cui :
-         cmdstr:='--subsystem console';
-     end;
-     if dllversion<>'' then
-       cmdstr:=cmdstr+' --version '+dllversion;
-     cmdstr:=cmdstr+' --input '+fn;
-     cmdstr:=cmdstr+' --stack '+tostr(stacksize);
-     DoExec(FindUtil('postw32'),cmdstr,false,false);
-     postprocessexecutable:=true;
-     exit;
-   end;
-  { open file }
-  assign(f,fn);
-  {$I-}
-   reset(f,1);
-  if ioresult<>0 then
-    Message1(execinfo_f_cant_open_executable,fn);
-  { read headers }
-  blockread(f,dosheader,sizeof(tdosheader));
-  peheaderpos:=dosheader.e_lfanew;
-  seek(f,peheaderpos);
-  blockread(f,peheader,sizeof(tpeheader));
-  { write info }
-  Message1(execinfo_x_codesize,tostr(peheader.SizeOfCode));
-  Message1(execinfo_x_initdatasize,tostr(peheader.SizeOfInitializedData));
-  Message1(execinfo_x_uninitdatasize,tostr(peheader.SizeOfUninitializedData));
-  { change stack size (PM) }
-  { I am not sure that the default value is adequate !! }
-  peheader.SizeOfStackReserve:=stacksize;
-  { change the header }
-  { sub system }
-  { gui=2 }
-  { cui=3 }
-  case apptype of
-    app_gui :
-      peheader.Subsystem:=2;
-    app_cui :
-      peheader.Subsystem:=3;
-  end;
-  if dllversion<>'' then
-    begin
-     peheader.MajorImageVersion:=dllmajor;
-     peheader.MinorImageVersion:=dllminor;
-    end;
-  { reset timestamp }
-  peheader.TimeDateStamp:=0;
-  { write header back }
-  seek(f,peheaderpos);
-  blockwrite(f,peheader,sizeof(tpeheader));
-  if ioresult<>0 then
-    Message1(execinfo_f_cant_process_executable,fn);
-  seek(f,peheaderpos);
-  blockread(f,peheader,sizeof(tpeheader));
-  { write the value after the change }
-  Message1(execinfo_x_stackreserve,tostr(peheader.SizeOfStackReserve));
-  Message1(execinfo_x_stackcommit,tostr(peheader.SizeOfStackCommit));
-  { read section info }
-  maxfillsize:=0;
-  firstsecpos:=0;
-  secroot:=nil;
-  for l:=1 to peheader.NumberOfSections do
-   begin
-     blockread(f,coffsec,sizeof(tcoffsechdr));
-     if coffsec.datapos>0 then
-      begin
-        if secroot=nil then
-         firstsecpos:=coffsec.datapos;
-        new(hsecroot);
-        hsecroot^.fillpos:=coffsec.datapos+coffsec.vsize;
-        hsecroot^.fillsize:=coffsec.datalen-coffsec.vsize;
-        hsecroot^.next:=secroot;
-        secroot:=hsecroot;
-        if secroot^.fillsize>maxfillsize then
-         maxfillsize:=secroot^.fillsize;
-      end;
-   end;
-  if firstsecpos>0 then
-   begin
-     l:=firstsecpos-filepos(f);
-     if l>maxfillsize then
-      maxfillsize:=l;
-   end
-  else
-   l:=0;
-  { get zero buffer }
-  getmem(zerobuf,maxfillsize);
-  fillchar(zerobuf^,maxfillsize,0);
-  { zero from sectioninfo until first section }
-  blockwrite(f,zerobuf^,l);
-  { zero section alignments }
-  while assigned(secroot) do
-   begin
-     seek(f,secroot^.fillpos);
-     blockwrite(f,zerobuf^,secroot^.fillsize);
-     hsecroot:=secroot;
-     secroot:=secroot^.next;
-     dispose(hsecroot);
-   end;
-  freemem(zerobuf,maxfillsize);
-  close(f);
-  {$I+}
-  if ioresult<>0 then;
-  postprocessexecutable:=true;
-end;
-
-
-{****************************************************************************
-                            TDLLScannerWin32
-****************************************************************************}
-
-    procedure tDLLScannerWin32.GetDefExt(var N:longint;var P:pStr4);
-     begin
-      N:=sizeof(DefaultDLLExtensions)div sizeof(DefaultDLLExtensions[1]);
-      pointer(P):=@DefaultDLLExtensions;
-     end;
-
-    function tDLLScannerWin32.DOSstubOK(var x:cardinal):boolean;
-      begin
-        blockread(f,TheWord,2,loaded);
-        if loaded<>2 then
-         DOSstubOK:=false
-        else
-         begin
-           DOSstubOK:=(TheWord='MZ');
-           seek(f,$3C);
-           blockread(f,x,4,loaded);
-           if(loaded<>4)or(longint(x)>filesize(f))then
-            DOSstubOK:=false;
-         end;
-      end;
-
-    function TDLLScannerWin32.FindDLL(const s:string;var founddll:string):boolean;
-      var
-        sysdir : string;
-        Found : boolean;
-      begin
-        Found:=false;
-        { Look for DLL in:
-          1. Current dir
-          2. Library Path
-          3. windir,windir/system,windir/system32 }
-        Found:=FindFile(s,'.'+source_info.DirSep,founddll);
-        if (not found) then
-         Found:=librarysearchpath.FindFile(s,founddll);
-        if (not found) then
-         begin
-           sysdir:=FixPath(GetEnv('windir'),false);
-           Found:=FindFile(s,sysdir+';'+sysdir+'system'+source_info.DirSep+';'+sysdir+'system32'+source_info.DirSep,founddll);
-         end;
-        if (not found) then
-         begin
-           message1(exec_w_libfile_not_found,s);
-           FoundDll:=s;
-         end;
-        FindDll:=Found;
-      end;
-
-
-    function tDLLScannerWin32.ExtractDllName(Const Name : string) : string;
-      var n : string;
-      begin
-         n:=Upper(SplitExtension(Name));
-         if (n='.DLL') or (n='.DRV') or (n='.EXE') then
-           ExtractDllName:=Name
-         else
-           ExtractDllName:=Name+target_info.sharedlibext;
-      end;
-
-
-
-function tDLLScannerWin32.isSuitableFileType(x:cardinal):longbool;
- begin
-  seek(f,x);
-  blockread(f,TheWord,2,loaded);
-  isSuitableFileType:=(loaded=2)and(TheWord='PE');
- end;
-
-
-function tDLLScannerWin32.GetEdata(HeaderEntry:cardinal):longbool;
- type
-  TObjInfo=packed record
-   ObjName:array[0..7]of char;
-   VirtSize,
-   VirtAddr,
-   RawSize,
-   RawOffset,
-   Reloc,
-   LineNum:cardinal;
-   RelCount,
-   LineCount:word;
-   flags:cardinal;
-  end;
- var
-  i:cardinal;
-  ObjOfs:cardinal;
-  Obj:TObjInfo;
-  APE_obj,APE_Optsize:word;
-  ExportRVA:cardinal;
-  delta:cardinal;
- const
-  IMAGE_SCN_CNT_CODE=$00000020;
- var
- _d:dirstr;
- _n:namestr;
- _e:extstr;
- function isUsedFunction(name:pchar):longbool;
-  var
-   hp:tExternalsItem;
-  begin
-   isUsedFunction:=false;
-   hp:=tExternalsItem(current_module.Externals.first);
-   while assigned(hp)do
-    begin
-     if(assigned(hp.data))and(not hp.found)then
-      if hp.data^=StrPas(name)then
-       begin
-        isUsedFunction:=true;
-        hp.found:=true;
-        exit;
-       end;
-     hp:=tExternalsItem(hp.next);
-    end;
-  end;
-
- procedure Store(index:cardinal;name:pchar;isData:longbool);
-  begin
-   if not isUsedFunction(name)then
-    exit;
-   if not(current_module.uses_imports) then
-    begin
-     current_module.uses_imports:=true;
-     importlib.preparelib(current_module.modulename^);
-    end;
-   if IsData then
-    importlib.importvariable(name,_n,name)
-   else
-    importlib.importprocedure(name,_n,index,name);
-  end;
-
- procedure ProcessEdata;
-  type
-   a8=array[0..7]of char;
-  function GetSectionName(rva:cardinal;var Flags:cardinal):a8;
-   var
-    i:cardinal;
-    LocObjOfs:cardinal;
-    LocObj:TObjInfo;
-   begin
-    GetSectionName:='';
-    Flags:=0;
-    LocObjOfs:=APE_OptSize+HeaderOffset+24;
-    for i:=1 to APE_obj do
-     begin
-      seek(f,LocObjOfs);
-      blockread(f,LocObj,sizeof(LocObj));
-      if(rva>=LocObj.VirtAddr)and(rva<=LocObj.VirtAddr+LocObj.RawSize)then
-       begin
-        GetSectionName:=a8(LocObj.ObjName);
-        Flags:=LocObj.flags;
-       end;
-     end;
-   end;
-  var
-   j,Fl:cardinal;
-   ulongval,procEntry:cardinal;
-   Ordinal:word;
-   isData:longbool;
-   ExpDir:packed record
-    flag,
-    stamp:cardinal;
-    Major,
-    Minor:word;
-    Name,
-    Base,
-    NumFuncs,
-    NumNames,
-    AddrFuncs,
-    AddrNames,
-    AddrOrds:cardinal;
-   end;
-  begin
-   with Obj do
-    begin
-     seek(f,RawOffset+delta);
-     blockread(f,ExpDir,sizeof(ExpDir));
-     fsplit(impname,_d,_n,_e);
-     for j:=0 to pred(ExpDir.NumNames)do
-      begin
-       seek(f,RawOffset-VirtAddr+ExpDir.AddrOrds+j*2);
-       blockread(f,Ordinal,2);
-       seek(f,RawOffset-VirtAddr+ExpDir.AddrFuncs+cardinal(Ordinal)*4);
-       blockread(f,ProcEntry,4);
-       seek(f,RawOffset-VirtAddr+ExpDir.AddrNames+j*4);
-       blockread(f,ulongval,4);
-       seek(f,RawOffset-VirtAddr+ulongval);
-       blockread(f,cstring,sizeof(cstring));
-       isData:=GetSectionName(procentry,Fl)='';
-       if not isData then
-        isData:=Fl and IMAGE_SCN_CNT_CODE<>IMAGE_SCN_CNT_CODE;
-       Store(succ(Ordinal),cstring,isData);
-      end;
-   end;
-  end;
- begin
-  GetEdata:=false;
-  seek(f,HeaderEntry+120);
-  blockread(f,ExportRVA,4);
-  seek(f,HeaderEntry+6);
-  blockread(f,APE_Obj,2);
-  seek(f,HeaderEntry+20);
-  blockread(f,APE_OptSize,2);
-  ObjOfs:=APE_OptSize+HeaderOffset+24;
-  for i:=1 to APE_obj do
-   begin
-    seek(f,ObjOfs);
-    blockread(f,Obj,sizeof(Obj));
-    inc(ObjOfs,sizeof(Obj));
-    with Obj do
-     if(VirtAddr<=ExportRva)and(ExportRva<VirtAddr+VirtSize)then
-      begin
-       delta:=ExportRva-VirtAddr;
-       ProcessEdata;
-       GetEdata:=true;
-      end;
-   end;
- end;
-
-function tDLLScannerWin32.scan(const binname:string):longbool;
- var
-  OldFileMode:longint;
-  foundimp : string;
-  NN:longint;PP:pStr4;
- begin
-   Scan:=false;
-  { is there already an import library the we will use that one }
-  if FindLibraryFile(binname,target_info.staticClibprefix,target_info.staticClibext,foundimp) then
-   exit;
-  { check if we can find the dll }
-  GetDefExt(NN,PP);
-  if not FindDll(DLLName(binname,NN,PP),impname) then
-   exit;
-  { read the dll file }
-  assign(f,impname);
-  OldFileMode:=filemode;
-  filemode:=0;
-  reset(f,1);
-  filemode:=OldFileMode;
-  if not DOSstubOK(HeaderOffset)then
-   scan:=false
-  else if not isSuitableFileType(HeaderOffset)then
-   scan:=false
-  else
-   scan:=GetEdata(HeaderOffset);
-  close(f);
- end;
-
-
-{*****************************************************************************
-                                     Initialize
-*****************************************************************************}
-
-initialization
-{$ifdef i386}
-  RegisterExternalLinker(system_i386_win32_info,TLinkerWin32);
-  RegisterImport(system_i386_win32,TImportLibWin32);
-  RegisterExport(system_i386_win32,TExportLibWin32);
-  RegisterDLLScanner(system_i386_win32,TDLLScannerWin32);
-  RegisterAr(ar_gnu_arw_info);
-  RegisterRes(res_gnu_windres_info);
-  RegisterTarget(system_i386_win32_info);
-{$endif i386}
-end.
-{
-  $Log$
-  Revision 1.40  2002-09-03 16:26:29  daniel
-    * Make Tprocdef.defs protected
-
-  Revision 1.39  2002/08/12 15:08:44  carl
-    + stab register indexes for powerpc (moved from gdb to cpubase)
-    + tprocessor enumeration moved to cpuinfo
-    + linker in target_info is now a class
-    * many many updates for m68k (will soon start to compile)
-    - removed some ifdef or correct them for correct cpu
-
-  Revision 1.38  2002/08/11 14:32:32  peter
-    * renamed current_library to objectlibrary
-
-  Revision 1.37  2002/08/11 13:24:20  peter
-    * saving of asmsymbols in ppu supported
-    * asmsymbollist global is removed and moved into a new class
-      tasmlibrarydata that will hold the info of a .a file which
-      corresponds with a single module. Added librarydata to tmodule
-      to keep the library info stored for the module. In the future the
-      objectfiles will also be stored to the tasmlibrarydata class
-    * all getlabel/newasmsymbol and friends are moved to the new class
-
-  Revision 1.36  2002/07/26 21:15:46  florian
-    * rewrote the system handling
-
-  Revision 1.35  2002/07/01 18:46:35  peter
-    * internal linker
-    * reorganized aasm layer
-
-  Revision 1.34  2002/05/18 13:34:27  peter
-    * readded missing revisions
-
-  Revision 1.33  2002/05/16 19:46:53  carl
-  + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
-  + try to fix temp allocation (still in ifdef)
-  + generic constructor calls
-  + start of tassembler / tmodulebase class cleanup
-
-  Revision 1.31  2002/04/22 18:19:22  carl
-  - remove use_bound_instruction field
-
-  Revision 1.30  2002/04/21 15:43:58  carl
-  * change stack size to 256K
-
-  Revision 1.29  2002/04/20 21:43:18  carl
-  * fix stack size for some targets
-  + add offset to parameters from frame pointer info.
-  - remove some unused stuff
-
-  Revision 1.28  2002/04/15 19:16:57  carl
-  - remove size_of_pointer field
-
-  Revision 1.27  2002/04/05 17:49:09  carl
-  * fix compilation problems
-  * fix range check error
-
-  Revision 1.26  2002/04/04 19:06:14  peter
-    * removed unused units
-    * use tlocation.size in cg.a_*loc*() routines
-
-  Revision 1.25  2002/04/04 18:25:30  carl
-  + added wdosx patch from Pavel
-
-  Revision 1.24  2002/04/02 17:11:39  peter
-    * tlocation,treference update
-    * LOC_CONSTANT added for better constant handling
-    * secondadd splitted in multiple routines
-    * location_force_reg added for loading a location to a register
-      of a specified size
-    * secondassignment parses now first the right and then the left node
-      (this is compatible with Kylix). This saves a lot of push/pop especially
-      with string operations
-    * adapted some routines to use the new cg methods
-
-  Revision 1.23  2002/01/29 21:27:34  peter
-    * default alignment changed to 4 bytes for locals and static const,var
-
-  Revision 1.22  2002/01/19 11:53:07  peter
-    * fixed managledname
-
-}