[fpc-devel] Porting fpc to linux-sparc64

John Paul Adrian Glaubitz glaubitz at physik.fu-berlin.de
Mon May 29 13:09:05 CEST 2017


On Mon, May 29, 2017 at 12:46:57PM +0200, John Paul Adrian Glaubitz wrote:
> On Mon, May 29, 2017 at 11:53:26AM +0200, Karoly Balogh (Charlie/SGR) wrote:
> > > Running the file utility on one of the object files shows that the
> > > assembler did not generate 32-bit code. So, at least a hotfix here
> > > would be to pass "-m32" to the assembler.
> > 
> > That is easy to add, see in compiler/sparc/cpugas.pas, MakeCmdLine method,
> > which works from the templates at the bottom of the same
> > file.
> 
> Good idea, I'll try that.

I tried adding "-32" like this:

Index: fpc-3.0.0+dfsg/fpcsrc/compiler/sparc/cpugas.pas
===================================================================
--- fpc-3.0.0+dfsg.orig/fpcsrc/compiler/sparc/cpugas.pas
+++ fpc-3.0.0+dfsg/fpcsrc/compiler/sparc/cpugas.pas
@@ -77,7 +77,7 @@ implementation
            cpu_SPARC_V7: Replace(result,'$ARCH','-Av7');
            cpu_SPARC_V8: Replace(result,'$ARCH','-Av8')
          else
-           Replace(result,'$ARCH','-Av9')
+           Replace(result,'$ARCH','-Av9 -32')
          end
       end;
 
@@ -226,7 +226,7 @@ implementation
 {$ifdef FPC_SPARC_V8_ONLY}
            asmcmd : '$PIC -o $OBJ $EXTRAOPT $ASM';
 {$else}
-           asmcmd : '$ARCH $PIC -o $OBJ $EXTRAOPT $ASM';
+           asmcmd : '$ARCH $PIC -o $OBJ -32 $EXTRAOPT $ASM';
 {$endif}
            supported_targets : [system_sparc_solaris,system_sparc_linux,system_sparc_embedded];
            flags : [af_needar,af_smartlink_sections];
@@ -240,7 +240,7 @@ implementation
            id     : as_ggas;
            idtxt  : 'GAS';
            asmbin : 'gas';
-           asmcmd : '$ARCH $PIC -o $OBJ $EXTRAOPT $ASM';
+           asmcmd : '$ARCH $PIC -o $OBJ -32 $EXTRAOPT $ASM';
            supported_targets : [system_sparc_solaris,system_sparc_linux,system_sparc_embedded];
            flags : [af_needar,af_smartlink_sections];
            labelprefix : '.L';

Still generates 64-bit object files:

root at deb4g:~/fpc/fpc-3.0.0+dfsg# file /root/fpc/fpc-3.0.0+dfsg/fpcsrc/rtl/units/sparc-linux/strings.o
/root/fpc/fpc-3.0.0+dfsg/fpcsrc/rtl/units/sparc-linux/strings.o: ELF 64-bit MSB relocatable, SPARC V9, relaxed memory ordering, version 1 (SYSV), not stripped
root at deb4g:~/fpc/fpc-3.0.0+dfsg#

Any idea?

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz at debian.org
`. `'   Freie Universitaet Berlin - glaubitz at physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



More information about the fpc-devel mailing list