View Issue Details

IDProjectCategoryView StatusLast Update
0028711FPCCompilerpublic2016-02-14 10:57
ReporterBenjamin Rosseaux Assigned ToJeppe Johansen  
PrioritynormalSeverityminorReproducibilityN/A
Status resolvedResolutionfixed 
Product Version3.1.1 
Target Version4.0.0Fixed in Version3.1.1 
Summary0028711: Adding missed x86_64-embedded target
DescriptionI do need for my current work a working x86_64-embedded target, so I've created a patch for this myself (based on SVN rev 31772).
Additional InformationThe already existent i386_embedded target is useless for me for my current hardware-examine-work on a x86_64-based devboard, because I do need some features, which're only available in the x86_64 long mode.

I've attached my patch to this issue report.
TagsNo tags attached.
Fixed in Revision33097
FPCOldBugId
FPCTarget
Attached Files

Activities

Benjamin Rosseaux

2015-09-23 03:45

reporter  

x86_64_embedded.patch (7,723 bytes)   
Index: compiler/systems/i_embed.pas
===================================================================
--- compiler/systems/i_embed.pas	(revision 31772)
+++ compiler/systems/i_embed.pas	(working copy)
@@ -284,6 +284,70 @@
             llvmdatalayout : 'e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S32';
           );
 
+       system_x86_64_embedded_info : tsysteminfo =
+          (
+            system       : system_x86_64_embedded;
+            name         : 'Embedded';
+            shortname    : 'embedded';
+            flags        : [tf_needs_symbol_size,tf_files_case_sensitive
+	                          ,tf_smartlink_sections];
+            cpu          : cpu_x86_64;
+            unit_env     : '';
+            extradefines : '';
+            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_x86_64_elf64;
+            assemextern  : as_gas;
+            link         : ld_none;
+            linkextern   : ld_embedded;
+            ar           : ar_gnu_ar;
+            res          : res_none;
+            dbg          : dbg_stabs;
+            script       : script_unix;
+            endian       : endian_little;
+            alignment    :
+              (
+                procalign       : 16;
+                loopalign       : 8;
+                jumpalign       : 0;
+                constalignmin   : 0;
+                constalignmax   : 8;
+                varalignmin     : 0;
+                varalignmax     : 16;
+                localalignmin   : 4;
+                localalignmax   : 16;
+                recordalignmin  : 0;
+                recordalignmax  : 16;
+                maxCrecordalign : 16
+              );
+            first_parm_offset : 16;
+            stacksize    : 8*1024*1024;
+            stackalign   : 16;
+            abi : abi_default;
+            llvmdatalayout : 'e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128';
+         );
+
   implementation
 
 initialization
@@ -307,4 +371,9 @@
     set_source_info(system_i386_embedded_info);
   {$endif embedded}
 {$endif CPUI386}
+{$ifdef CPUX86_64}
+  {$ifdef embedded}
+    set_source_info(system_x86_64_embedded_info);
+  {$endif embedded}
+{$endif CPUX86_64}
 end.
Index: compiler/systems/t_embed.pas
===================================================================
--- compiler/systems/t_embed.pas	(revision 31772)
+++ compiler/systems/t_embed.pas	(working copy)
@@ -96,7 +96,7 @@
 begin
   WriteResponseFile:=False;
   linklibc:=(SharedLibFiles.Find('c')<>nil);
-{$if defined(ARM) or defined(i386) or defined(AVR) or defined(MIPSEL)}
+{$if defined(ARM) or defined(i386) or defined(x86_64) or defined(AVR) or defined(MIPSEL)}
   prtobj:='';
 {$else}
   prtobj:='prt0';
@@ -633,6 +633,43 @@
     end;
 {$endif i386}
 
+{$ifdef x86_64}
+  with linkres do
+    begin
+      Add('ENTRY(_START)');
+      Add('SECTIONS');
+      Add('{');
+      Add('     . = 0x100000;');
+      Add('     .text ALIGN (0x1000) :');
+      Add('    {');
+      Add('    _text = .;');
+      Add('    KEEP(*(.init, .init.*))');
+      Add('    *(.text, .text.*)');
+      Add('    *(.strings)');
+      Add('    *(.rodata, .rodata.*)');
+      Add('    *(.comment)');
+      Add('    _etext = .;');
+      Add('    }');
+      Add('    .data ALIGN (0x1000) :');
+      Add('    {');
+      Add('    _data = .;');
+      Add('    *(.data, .data.*)');
+      Add('    KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
+      Add('    _edata = .;');
+      Add('    }');
+      Add('    . = ALIGN(4);');
+      Add('    .bss :');
+      Add('    {');
+      Add('    _bss_start = .;');
+      Add('    *(.bss, .bss.*)');
+      Add('    *(COMMON)');
+      Add('    }');
+      Add('_bss_end = . ;');
+      Add('}');
+      Add('_end = .;');
+    end;
+{$endif x86_64}
+
 {$ifdef AVR}
   with linkres do
     begin
@@ -1340,6 +1377,11 @@
   RegisterTarget(system_i386_embedded_info);
 {$endif i386}
 
+{$ifdef x86_64}
+  RegisterLinker(ld_embedded,TLinkerEmbedded);
+  RegisterTarget(system_x86_64_embedded_info);
+{$endif x86_64}
+
 {$ifdef mipsel}
   RegisterLinker(ld_embedded,TLinkerEmbedded);
   RegisterTarget(system_mipsel_embedded_info);
Index: compiler/x86/agx86att.pas
===================================================================
--- compiler/x86/agx86att.pas	(revision 31772)
+++ compiler/x86/agx86att.pas	(working copy)
@@ -111,6 +111,8 @@
             FormatName:='win64';
           system_x86_64_darwin:
             FormatName:='macho64';
+          system_x86_64_embedded:
+            FormatName:='obj';
           system_x86_64_linux:
             FormatName:='elf64';
         else
Index: compiler/x86/agx86nsm.pas
===================================================================
--- compiler/x86/agx86nsm.pas	(revision 31772)
+++ compiler/x86/agx86nsm.pas	(working copy)
@@ -1221,6 +1221,8 @@
             FormatName:='win64';
           system_x86_64_darwin:
             FormatName:='macho64';
+          system_x86_64_embedded:
+            FormatName:='obj';
           system_x86_64_linux:
             FormatName:='elf64';
         else
Index: compiler/x86_64/cputarg.pas
===================================================================
--- compiler/x86_64/cputarg.pas	(revision 31772)
+++ compiler/x86_64/cputarg.pas	(working copy)
@@ -52,8 +52,10 @@
     {$ifndef NOTARGETAROS}
       ,t_aros
     {$endif}
+    {$ifndef NOTARGETEMBEDDED}
+      ,t_embed
+    {$endif}
 
-
 {**************************************
              Assemblers
 **************************************}
Index: rtl/embedded/Makefile.fpc
===================================================================
--- rtl/embedded/Makefile.fpc	(revision 31772)
+++ rtl/embedded/Makefile.fpc	(working copy)
@@ -123,6 +123,11 @@
 CPU_UNITS=multiboot
 endif
 
+ifeq ($(ARCH),x86_64)
+CPU_SPECIFIC_COMMON_UNITS=sysutils math classes fgl macpas typinfo types rtlconsts getopts lineinfo
+# CPU_UNITS=multiboot
+endif
+
 ifeq ($(ARCH),mipsel)
 CPU_SPECIFIC_COMMON_UNITS=sysutils math classes fgl macpas typinfo types rtlconsts getopts lineinfo
 ifeq ($(SUBARCH),pic32mx)
Index: rtl/embedded/rtl.cfg
===================================================================
--- rtl/embedded/rtl.cfg	(revision 31772)
+++ rtl/embedded/rtl.cfg	(working copy)
@@ -52,6 +52,24 @@
 -SfRESOURCES
 #endif CPUI386
 
+# x86_64 is powerful enough to handle most object pascal constructs
+# it is only a matter of size
+#ifdef CPUX86_64
+-SfSOFTFPU
+-SfCLASSES
+-SfEXCEPTIONS
+-SfANSISTRINGS
+-SfRTTI
+-SfWIDESTRINGS
+-SfDYNARRAYS
+-SfTHREADING
+-SfVARIANTS
+-SfOBJECTS
+-SfCOMMANDARGS
+-SfRANDOM
+-SfRESOURCES
+#endif CPUX86_64
+
 # arm is powerful enough to handle most object pascal constructs
 # it is only a matter of size
 #ifdef CPUARM
x86_64_embedded.patch (7,723 bytes)   

Benjamin Rosseaux

2016-02-10 10:38

reporter  

x86_64_embedded_on_rev33078.patch (7,709 bytes)   
Index: compiler/systems/i_embed.pas
===================================================================
--- compiler/systems/i_embed.pas	(revision 33078)
+++ compiler/systems/i_embed.pas	(working copy)
@@ -284,6 +284,70 @@
             llvmdatalayout : 'e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S32';
           );
 
+       system_x86_64_embedded_info : tsysteminfo =
+          (
+            system       : system_x86_64_embedded;
+            name         : 'Embedded';
+            shortname    : 'embedded';
+            flags        : [tf_needs_symbol_size,tf_files_case_sensitive
+	                          ,tf_smartlink_sections];
+            cpu          : cpu_x86_64;
+            unit_env     : '';
+            extradefines : '';
+            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_x86_64_elf64;
+            assemextern  : as_gas;
+            link         : ld_none;
+            linkextern   : ld_embedded;
+            ar           : ar_gnu_ar;
+            res          : res_none;
+            dbg          : dbg_stabs;
+            script       : script_unix;
+            endian       : endian_little;
+            alignment    :
+              (
+                procalign       : 16;
+                loopalign       : 8;
+                jumpalign       : 0;
+                constalignmin   : 0;
+                constalignmax   : 8;
+                varalignmin     : 0;
+                varalignmax     : 16;
+                localalignmin   : 4;
+                localalignmax   : 16;
+                recordalignmin  : 0;
+                recordalignmax  : 16;
+                maxCrecordalign : 16
+              );
+            first_parm_offset : 16;
+            stacksize    : 8*1024*1024;
+            stackalign   : 16;
+            abi : abi_default;
+            llvmdatalayout : 'e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128';
+         );
+
   implementation
 
 initialization
@@ -307,4 +371,9 @@
     set_source_info(system_i386_embedded_info);
   {$endif embedded}
 {$endif CPUI386}
+{$ifdef CPUX86_64}
+  {$ifdef embedded}
+    set_source_info(system_x86_64_embedded_info);
+  {$endif embedded}
+{$endif CPUX86_64}
 end.
Index: compiler/systems/t_embed.pas
===================================================================
--- compiler/systems/t_embed.pas	(revision 33078)
+++ compiler/systems/t_embed.pas	(working copy)
@@ -96,7 +96,7 @@
 begin
   WriteResponseFile:=False;
   linklibc:=(SharedLibFiles.Find('c')<>nil);
-{$if defined(ARM) or defined(i386) or defined(AVR) or defined(MIPSEL)}
+{$if defined(ARM) or defined(i386) or defined(x86_64) or defined(AVR) or defined(MIPSEL)}
   prtobj:='';
 {$else}
   prtobj:='prt0';
@@ -738,6 +738,43 @@
     end;
 {$endif i386}
 
+{$ifdef x86_64}
+  with linkres do
+    begin
+      Add('ENTRY(_START)');
+      Add('SECTIONS');
+      Add('{');
+      Add('     . = 0x100000;');
+      Add('     .text ALIGN (0x1000) :');
+      Add('    {');
+      Add('    _text = .;');
+      Add('    KEEP(*(.init, .init.*))');
+      Add('    *(.text, .text.*)');
+      Add('    *(.strings)');
+      Add('    *(.rodata, .rodata.*)');
+      Add('    *(.comment)');
+      Add('    _etext = .;');
+      Add('    }');
+      Add('    .data ALIGN (0x1000) :');
+      Add('    {');
+      Add('    _data = .;');
+      Add('    *(.data, .data.*)');
+      Add('    KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
+      Add('    _edata = .;');
+      Add('    }');
+      Add('    . = ALIGN(4);');
+      Add('    .bss :');
+      Add('    {');
+      Add('    _bss_start = .;');
+      Add('    *(.bss, .bss.*)');
+      Add('    *(COMMON)');
+      Add('    }');
+      Add('_bss_end = . ;');
+      Add('}');
+      Add('_end = .;');
+    end;
+{$endif x86_64}
+
 {$ifdef AVR}
   with linkres do
     begin
@@ -1445,6 +1482,11 @@
   RegisterTarget(system_i386_embedded_info);
 {$endif i386}
 
+{$ifdef x86_64}
+  RegisterLinker(ld_embedded,TLinkerEmbedded);
+  RegisterTarget(system_x86_64_embedded_info);
+{$endif x86_64}
+
 {$ifdef mipsel}
   RegisterLinker(ld_embedded,TLinkerEmbedded);
   RegisterTarget(system_mipsel_embedded_info);
Index: compiler/x86/agx86att.pas
===================================================================
--- compiler/x86/agx86att.pas	(revision 33078)
+++ compiler/x86/agx86att.pas	(working copy)
@@ -111,6 +111,8 @@
             FormatName:='win64';
           system_x86_64_darwin:
             FormatName:='macho64';
+          system_x86_64_embedded:
+            FormatName:='obj';
           system_x86_64_linux:
             FormatName:='elf64';
         else
Index: compiler/x86/agx86nsm.pas
===================================================================
--- compiler/x86/agx86nsm.pas	(revision 33078)
+++ compiler/x86/agx86nsm.pas	(working copy)
@@ -1239,6 +1239,8 @@
             FormatName:='win64';
           system_x86_64_darwin:
             FormatName:='macho64';
+          system_x86_64_embedded:
+            FormatName:='obj';
           system_x86_64_linux:
             FormatName:='elf64';
         else
Index: compiler/x86_64/cputarg.pas
===================================================================
--- compiler/x86_64/cputarg.pas	(revision 33078)
+++ compiler/x86_64/cputarg.pas	(working copy)
@@ -52,8 +52,10 @@
     {$ifndef NOTARGETAROS}
       ,t_aros
     {$endif}
+    {$ifndef NOTARGETEMBEDDED}
+      ,t_embed
+    {$endif}
 
-
 {**************************************
              Assemblers
 **************************************}
Index: rtl/embedded/Makefile.fpc
===================================================================
--- rtl/embedded/Makefile.fpc	(revision 33078)
+++ rtl/embedded/Makefile.fpc	(working copy)
@@ -145,6 +145,11 @@
 endif
 endif
 
+ifeq ($(ARCH),x86_64)
+CPU_SPECIFIC_COMMON_UNITS=sysutils math classes fgl macpas typinfo types rtlconsts getopts lineinfo
+# CPU_UNITS=multiboot
+endif
+
 ifeq ($(ARCH),mipsel)
 CPU_SPECIFIC_COMMON_UNITS=sysutils math classes fgl macpas typinfo types rtlconsts getopts lineinfo
 ifeq ($(SUBARCH),pic32mx)
Index: rtl/embedded/rtl.cfg
===================================================================
--- rtl/embedded/rtl.cfg	(revision 33078)
+++ rtl/embedded/rtl.cfg	(working copy)
@@ -52,6 +52,24 @@
 -SfRESOURCES
 #endif CPUI386
 
+# x86_64 is powerful enough to handle most object pascal constructs
+# it is only a matter of size
+#ifdef CPUX86_64
+-SfSOFTFPU
+-SfCLASSES
+-SfEXCEPTIONS
+-SfANSISTRINGS
+-SfRTTI
+-SfWIDESTRINGS
+-SfDYNARRAYS
+-SfTHREADING
+-SfVARIANTS
+-SfOBJECTS
+-SfCOMMANDARGS
+-SfRANDOM
+-SfRESOURCES
+#endif CPUX86_64
+
 # arm is powerful enough to handle most object pascal constructs
 # it is only a matter of size
 #ifdef CPUARM

Issue History

Date Modified Username Field Change
2015-09-23 03:45 Benjamin Rosseaux New Issue
2015-09-23 03:45 Benjamin Rosseaux File Added: x86_64_embedded.patch
2016-02-10 10:38 Benjamin Rosseaux File Added: x86_64_embedded_on_rev33078.patch
2016-02-14 10:57 Jeppe Johansen Fixed in Revision => 33097
2016-02-14 10:57 Jeppe Johansen Status new => resolved
2016-02-14 10:57 Jeppe Johansen Fixed in Version => 3.1.1
2016-02-14 10:57 Jeppe Johansen Resolution open => fixed
2016-02-14 10:57 Jeppe Johansen Assigned To => Jeppe Johansen
2016-02-14 10:57 Jeppe Johansen Target Version => 4.0.0