Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2018-12

Sparc64 on solaris

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Peter Popov

Hi All
I noticed that the trunk version of the compiler has a Sparc64/Linux target. Did a little work to create a Sparc64/Solaris target. Had little luck producing an executable.

What is the current status of Sparc64/Linux?

Any interest in uploading the Sparc64/Solaris patches (could not produce an working executable)?

Peter Popov

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10

Reply by email

Pierre Muller
to Peter Popov

Did you check if the snapshots are working?

ftp://ftp.freepascal.org/pub/fpc/snapshot/trunk/sparc64-linux/

contains both native snapshots and cross-snapshots created on a x86_64-linux machine.

For sparc64-solaris, the situation is different,
because it is not yet enabled in trunk.

I had some local changes on stadler.debian.net machine, but this machine did not re-appear after a machine upgrade that probably did not work out as expected ...

Pierre

Le 09/12/2018 à 22:33, Peter Popov a écrit :

Show quoted text 29 lines
Hi All I noticed that the trunk version of the compiler has a Sparc64/Linux target. Did a little work to create a Sparc64/Solaris target. Had little luck producing an executable.   What is the current status of Sparc64/Linux?   Any interest in uploading the Sparc64/Solaris patches (could not produce an working executable)?   Peter Popov     Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10   _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Pierre Muller
to Pierre Muller

I forgot that I also had these local changes on a solaris farm machine ...

As the changes are rather small, I include them here below.

If you want to test them, you need to patch current trunk,

go to fpcsrc/utils/fpcm to compile a new fpcmake program, and use that new fpcmake to regenerate all Makefile's.

The easiest is to go to trunk directory and do

find . -name Makefile.fpc | xargs /path/to/new/fpcmake -Tall

After that operation, you will need to cross-compile the first sparc64 native compiler.

For that move to fpcsrc/compiler:

gmake cycle CPU_TARGET=sparc64 OPT="-n -gl"
the -n option is to be sure that your local Free Pascal configuration will not affect your build, the -gl is to be able to debug any compiler generated...

if this works, you should have a ppcsparc64 binary in compiler directory that is a native sparc64 executable. But you might need to add some tweaks for correct library directories...

Next you need to install the new binary.

For that you will need to use:

gmake installsymlink rtlinstall FPC=`pwd`/ppcsparc64 INSTALL_PREFIX=/where/you/want/your/new/sparc64

After try to compile the whole trunk tree:

go to trunk dir:

gmake distclean install OPT="-n -gl" FPC=/where/you/want/your/new/sparc64/bin/ppcsparc64 INSTALL_PREFIX=/where/you/want/your/new/sparc64

At that point, you can just reply to the mailing list that you made it ... Or report any problem before!

Pierre

Index: fpcsrc/utils/fpcm/fpcmmain.pp
=================================================================== --- fpcsrc/utils/fpcm/fpcmmain.pp (revision 40515) +++ fpcsrc/utils/fpcm/fpcmmain.pp (working copy) @@ -120,7 +120,7 @@
{ netbsd } ( true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), { amiga } ( false, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), { atari } ( false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false),
- { solaris } ( true, false, false, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false),
+ { solaris } ( true, false, false, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false), { qnx } ( false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), { netware } ( true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), { openbsd } ( true, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), Index: fpcsrc/compiler/systems/t_sunos.pas
=================================================================== --- fpcsrc/compiler/systems/t_sunos.pas (revision 40515) +++ fpcsrc/compiler/systems/t_sunos.pas (working copy) @@ -95,9 +95,12 @@
{$endif }
{$ifdef sparc}
const
- { no emulation specification needed, as long as only 32-bit is supported }
- gnu_emul = '';
+ gnu_emul = '-m elf32_sparc_sol2';
{$endif}
+{$ifdef sparc64}
+const
+ gnu_emul = '-m elf64_sparc_sol2';
+{$endif}

 Constructor TLinkersolaris.Create;
 begin
@@ -107,11 +110,18 @@
   else
     use_gnu_ld:=true;
   if NOT Dontlinkstdlibpath Then
+{$ifdef i386}
+   LibrarySearchPath.AddPath(sysrootpath,'/lib;/usr/lib;/usr/X11R6/lib;/opt/sfw/lib',true);
+{$endif i386}
 {$ifdef x86_64}
    LibrarySearchPath.AddPath(sysrootpath,'/lib/64;/usr/lib/64;/usr/X11R6/lib/64;/opt/sfw/lib/64',true);
-{$else not x86_64}
-   LibrarySearchPath.AddPath(sysrootpath,'/lib;/usr/lib;/usr/X11R6/lib;/opt/sfw/lib',true);
-{$endif not x86_64}
+{$endif x86_64}
+{$ifdef sparc}
+   LibrarySearchPath.AddPath(sysrootpath,'/lib;/usr/lib;/usr/X11R6/lib;/opt/sfw/lib;/opt/csw/lib',true);
+{$endif sparc}
+{$ifdef sparc64}
+   LibrarySearchPath.AddPath(sysrootpath,'/lib/sparcv9;/usr/lib/sparcv9;/usr/X11R6/lib/sparcv9;/opt/sfw/lib/sparcv9;/opt/csw/lib/sparcv9',true);
+{$endif sparc64}
 {$ifdef  LinkTest}
      if (cs_link_staticflag in current_settings.globalswitches) then  WriteLN('ForceLinkStaticFlag');
      if (cs_link_static in current_settings.globalswitches) then  WriteLN('LinkStatic-Flag');
@@ -136,9 +146,14 @@
 {$endif }
 {$ifdef sparc}
 const
-  gld = 'gld ';
+  gld = 'gld $EMUL';
   solaris_ld = 'ld ';
 {$endif}
+{$ifdef sparc64}
+const
+  gld = 'gld $EMUL';
+  solaris_ld = 'ld -64 ';
+{$endif}
 begin
   Glibc2:=false;
   Glibc21:=false;
@@ -678,5 +693,11 @@
   RegisterTarget(system_sparc_solaris_info);
 {$endif sparc}

+{$ifdef sparc64}
+ RegisterImport(system_sparc64_solaris,TImportLibsolaris);
+ RegisterExport(system_sparc64_solaris,TExportLibsolaris);
+ RegisterTarget(system_sparc64_solaris_info);
+{$endif sparc}
+

   RegisterRes(res_elf_info,TWinLikeResourceFile);

end.
Index: fpcsrc/compiler/systems/i_sunos.pas
=================================================================== --- fpcsrc/compiler/systems/i_sunos.pas (revision 40515) +++ fpcsrc/compiler/systems/i_sunos.pas (working copy) @@ -241,6 +241,79 @@

             llvmdatalayout : 'E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32-S64';
           );
+        system_sparc64_solaris_info : tsysteminfo =
+          (
+            system       : system_sparc64_solaris;
+            name         : 'Solaris for SPARC64';
+            shortname    : 'solaris';
+           { sparc64 linux flags        : [tf_needs_symbol_size,tf_library_needs_pic,tf_smartlink_sections,
+                            tf_needs_symbol_type,tf_files_case_sensitive,
+                            tf_pic_uses_got,
+                            tf_requires_proper_alignment,tf_safecall_exceptions, tf_safecall_clearstack,
+                            tf_has_winlike_resources]; }
+            flags        : [tf_needs_symbol_size,tf_under_development,
+                            tf_files_case_sensitive,
+                            tf_pic_uses_got,
+                            tf_requires_proper_alignment,tf_smartlink_library,
+                            tf_has_winlike_resources];
+            cpu          : cpu_sparc64;
+            unit_env     : 'SOLARISUNITS';
+            extradefines : 'UNIX;LIBC;SUNOS;HASUNIX';
+            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';
+            importlibprefix : 'libimp';
+            importlibext : '.a';
+            Cprefix      : '';
+            newline      : #10;
+            dirsep       : '/';
+            assem        : as_ggas;
+            assemextern  : as_ggas;
+            link         : ld_none;
+            linkextern   : ld_solaris;
+            ar           : ar_gnu_gar;
+            res          : res_elf;
+            dbg          : dbg_dwarf2;
+            script       : script_unix;
+            endian       : endian_big;
+            alignment    :
+              (
+                procalign       : 16;
+                loopalign       : 8;
+                jumpalign       : 0;
+                constalignmin   : 4;
+                constalignmax   : 16;
+                varalignmin     : 4;
+                varalignmax     : 16;
+                localalignmin   : 4;
+                localalignmax   : 16;
+                recordalignmin  : 0;
+                recordalignmax  : 16;
+                maxCrecordalign : 16
+              );
+            first_parm_offset : 176;
+            stacksize    : 16*1024*1024;
+            stackalign   : 16;
+            abi : abi_default;
+            llvmdatalayout : 'E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32-S64';
+          );
+
+
   implementation
 initialization
@@ -259,5 +332,10 @@
     set_source_info(system_sparc_solaris_info);
   {$endif solaris}
 {$endif CPUSparc}
+{$ifdef CPUSparc64}
+  {$ifdef solaris}
+    set_source_info(system_sparc64_solaris_info);
+  {$endif solaris}
+{$endif CPUSparc64}

end.
Index: fpcsrc/compiler/sparcgen/cpugas.pas
=================================================================== --- fpcsrc/compiler/sparcgen/cpugas.pas (revision 40515) +++ fpcsrc/compiler/sparcgen/cpugas.pas (working copy) @@ -274,7 +274,7 @@

            idtxt  : 'GAS';
            asmbin : 'gas';
            asmcmd : '$ARCH $PIC -o $OBJ $EXTRAOPT $ASM';

- supported_targets : [system_sparc64_linux];
+ supported_targets : [system_sparc64_linux, system_sparc64_solaris];

            flags : [af_needar,af_smartlink_sections];
            labelprefix : '.L';
            comment : '# ';

Index: fpcsrc/compiler/sparc64/cputarg.pas
=================================================================== --- fpcsrc/compiler/sparc64/cputarg.pas (revision 40515) +++ fpcsrc/compiler/sparc64/cputarg.pas (working copy) @@ -43,7 +43,7 @@
,t_linux

     {$endif}
     {$ifndef NOTARGETSUNOS}

-// ,t_sunos
+ ,t_sunos

     {$endif}
 {**************************************
Index: fpcsrc/compiler/sparc64/cpugas.pas
===================================================================
--- fpcsrc/compiler/sparc64/cpugas.pas  (revision 40515)
+++ fpcsrc/compiler/sparc64/cpugas.pas  (working copy)
@@ -235,7 +235,7 @@
 {$else}
            asmcmd : '$ARCH $PIC -o $OBJ $EXTRAOPT $ASM';
 {$endif}
-           supported_targets : [system_sparc64_linux];
+           supported_targets : [system_sparc64_linux,system_sparc64_solaris];
            flags : [af_needar,af_smartlink_sections];
            labelprefix : '.L';
            comment : '# ';
@@ -248,7 +248,7 @@
            idtxt  : 'GAS';
            asmbin : 'gas';
            asmcmd : '$ARCH $PIC -o $OBJ $EXTRAOPT $ASM';
-           supported_targets : [system_sparc64_linux];
+           supported_targets : [system_sparc64_linux,system_sparc64_solaris];
            flags : [af_needar,af_smartlink_sections];
            labelprefix : '.L';
            comment : '# ';

Le 10/12/2018 à 13:11, Pierre Muller a écrit :

Show quoted text 51 lines
Did you check if the snapshots are working? ftp://ftp.freepascal.org/pub/fpc/snapshot/trunk/sparc64-linux/ contains both native snapshots and cross-snapshots created on a x86_64-linux machine. For sparc64-solaris, the situation is different, because it is not yet enabled in trunk. I had some local changes on stadler.debian.net machine, but this machine did not re-appear after a machine upgrade that probably did not work out as expected ... Pierre Le 09/12/2018 à 22:33, Peter Popov a écrit : > Hi All > > I noticed that the trunk version of the compiler has a Sparc64/Linux target. Did a little work to create a Sparc64/Solaris target. Had little luck producing an executable. > >   > > What is the current status of Sparc64/Linux? > >   > > Any interest in uploading the Sparc64/Solaris patches (could not produce an working executable)? > >   > > Peter Popov > >   > >   > > Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10 > >   > > > _______________________________________________ > fpc-devel maillist - > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel > _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email