[fpc-devel] adding x86_64-netbsd

2009-04-21 Thread Axel Scheepers
Hi List,

I've been fiddling around adding netbsd x86_64 to fpc 2.2.4, I've got it
to the point that I can compile both the rtl and the compiler but I'm
having difficulties creating the prt0.as file(s).
I can't link anything due to missing symbols;
[...]
Assembling pp
Linking ./pp
/home/axel/Sources/FPC/fpcbuild-2.2.4-netbsd_x86_64/fpcsrc/rtl/units/x86_64-netbsd/prt0.o:
 In function `___start':
crt0.c:(.text+0xc5): undefined reference to `_fini'
crt0.c:(.text+0xd0): undefined reference to `_(float, char __restrict *,
wchar_t)'
crt0.c:(.text+0xe3): undefined reference to `main'
[..snip!..]

The file I created is a somewhat modified .s output from crt0.c from
netbsd. Can someone help me a bit with this?
I've included a patch with the things I changed (but there's some build
leftovers in it too, sorry)

I used to program a lot in pascal for school about 16yrs ago, it would
be fun to start playing with it again :)

Kind regards,
Axel Scheepers
-- 
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments
diff -urP --exclude 'Makefile*' --exclude installer.pas --exclude fpmkunit.pp fpcbuild-2.2.4/fpcsrc/compiler/systems/i_bsd.pas fpcbuild-2.2.4-netbsd_x86_64/fpcsrc/compiler/systems/i_bsd.pas
--- fpcbuild-2.2.4/fpcsrc/compiler/systems/i_bsd.pas	2008-11-13 20:25:57.0 +0100
+++ fpcbuild-2.2.4-netbsd_x86_64/fpcsrc/compiler/systems/i_bsd.pas	2009-04-18 17:59:00.0 +0200
@@ -217,6 +217,65 @@
 abi  : abi_default;
   );
 
+   system_x86_64_netbsd_info : tsysteminfo =
+  (
+system   : system_x86_64_NetBSD;
+name : 'NetBSD for x86_64';
+shortname: 'NetBSD';
+flags: [tf_under_development,tf_files_case_sensitive,tf_smartlink_library,tf_use_function_relative_addresses];
+cpu  : cpu_x86_64;
+unit_env : 'BSDUNITS';
+extradefines : 'UNIX;BSD;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';
+Cprefix  : '_';
+newline  : #10;
+dirsep   : '/';
+assem: as_gas;
+assemextern  : as_gas;
+link : nil;
+linkextern   : nil;
+ar   : ar_gnu_ar;
+res  : res_none;
+dbg  : dbg_stabs;
+script   : script_unix;
+endian   : endian_little;
+alignment:
+  (
+procalign   : 8;
+loopalign   : 4;
+jumpalign   : 0;
+constalignmin   : 0;
+constalignmax   : 8;
+varalignmin : 0;
+varalignmax : 16;
+localalignmin   : 4;
+localalignmax   : 16;
+recordalignmin  : 0;
+recordalignmax  : 16;
+maxCrecordalign : 8 
+  );
+first_parm_offset : 8;
+stacksize   : 262144;
+abi  : abi_default;
+  );
+
system_i386_openbsd_info : tsysteminfo =
   (
 system   : system_i386_OpenBSD;
@@ -599,6 +658,9 @@
{$ifdef FreeBSD}
  set_source_info(system_x86_64_FreeBSD_info);
{$endif}
+   {$ifdef NetBSD}
+ set_source_info(system_x86_64_netbsd_info);
+   {$endif}
 {$endif}
 {$ifdef cpu68}
   {$ifdef NetBSD}
diff -urP --exclude 'Makefile*' --exclude installer.pas --exclude fpmkunit.pp fpcbuild-2.2.4/fpcsrc/compiler/systems/t_bsd.pas fpcbuild-2.2.4-netbsd_x86_64/fpcsrc/compiler/systems/t_bsd.pas
--- fpcbuild-2.2.4/fpcsrc/compiler/systems/t_bsd.pas	2008-05-31 16:03:25.0 +0200
+++ fpcbuild-2.2.4-netbsd_x86_64/fpcsrc/compiler/systems/t_bsd.pas	2009-04-19 09:37:45.0 +0200
@@ -713,6 +713,10 @@
   RegisterImport(system_x86_64_freebsd,timportlibbsd);
   RegisterExport(system_x86_64_freebsd,texportlibbsd);
   RegisterTarget(system_x86_64_freebsd_info);
+  RegisterExternalLinker(system_x86_64_NetBSD_info,TLinkerBSD);
+  RegisterImport(system_x86_64_netbsd,timportlibbsd);
+  RegisterExport(system_x86_64_netbsd,texportlibbsd);
+  RegisterTarget(system_x86_64_netbsd_info);
 {$endif}
 {$ifdef i386}
   RegisterExternalLinker(system_i386_FreeBSD_info,TLinkerBSD);
diff -urP --exclude 'Makefile*' --exclude installer.pas --exclude

Re: [fpc-devel] adding x86_64-netbsd

2009-04-21 Thread Leonardo M . Ramé

Axel, It was difficult to create the port to NetBSD? In my company we have 
several OpenBSD installs and it would be nice if we could run FPC apps on them.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Mon, 4/20/09, Axel Scheepers  wrote:

> From: Axel Scheepers 
> Subject: [fpc-devel] adding x86_64-netbsd
> To: fpc-devel@lists.freepascal.org
> Date: Monday, April 20, 2009, 12:59 PM
> Hi List,
> 
> I've been fiddling around adding netbsd x86_64 to fpc
> 2.2.4, I've got it
> to the point that I can compile both the rtl and the
> compiler but I'm
> having difficulties creating the prt0.as file(s).
> I can't link anything due to missing symbols;
> [...]
> Assembling pp
> Linking ./pp
> /home/axel/Sources/FPC/fpcbuild-2.2.4-netbsd_x86_64/fpcsrc/rtl/units/x86_64-netbsd/prt0.o:
> In function `___start':
> crt0.c:(.text+0xc5): undefined reference to `_fini'
> crt0.c:(.text+0xd0): undefined reference to `_(float, char
> __restrict *,
> wchar_t)'
> crt0.c:(.text+0xe3): undefined reference to `main'
> [..snip!..]
> 
> The file I created is a somewhat modified .s output from
> crt0.c from
> netbsd. Can someone help me a bit with this?
> I've included a patch with the things I changed (but
> there's some build
> leftovers in it too, sorry)
> 
> I used to program a lot in pascal for school about 16yrs
> ago, it would
> be fun to start playing with it again :)
> 
> Kind regards,
> Axel Scheepers
> -- 
> ()  ascii ribbon campaign - against html e-mail 
> /\  www.asciiribbon.org   - against
> proprietary attachments
> 
> -Inline Attachment Follows-
> 
> ___
> fpc-devel maillist  -  fpc-devel@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> 



___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] adding x86_64-netbsd

2009-04-21 Thread Axel Scheepers
On Tue, 2009-04-21 at 05:15 -0700, Leonardo M. Ramé wrote:
> Axel, It was difficult to create the port to NetBSD? In my company we have 
> several OpenBSD installs and it would be nice if we could run FPC apps on 
> them.
> 
> Leonardo M. Ramé
> http://leonardorame.blogspot.com

Hi Leonardo,

It's my first try at it, I don't know if I missed something except the
obvious prt0.as problems I'm having. From what I saw most of the *bsd is
already defined and I even saw an openbsd i386/m68k target, take a look
at fpcsrc/compiler/systems.pas,
fpcsrc/compiler/systems/i_bsd.pas
fpcsrc/compiler/systems/t_bsd.pas and
fpcsrc/rtl/openbsd/


Kind regards,

Axel Scheepers
-- 
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments


signature.asc
Description: This is a digitally signed message part
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] adding x86_64-netbsd

2009-04-21 Thread Leonardo M . Ramé

That's great!, I'll try to compile it this week.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Tue, 4/21/09, Axel Scheepers  wrote:

> From: Axel Scheepers 
> Subject: Re: [fpc-devel] adding x86_64-netbsd
> To: "FPC developers' list" 
> Date: Tuesday, April 21, 2009, 2:12 PM
> On Tue, 2009-04-21 at 05:15 -0700,
> Leonardo M. Ramé wrote:
> > Axel, It was difficult to create the port to NetBSD?
> In my company we have several OpenBSD installs and it would
> be nice if we could run FPC apps on them.
> > 
> > Leonardo M. Ramé
> > http://leonardorame.blogspot.com
> 
> Hi Leonardo,
> 
> It's my first try at it, I don't know if I missed something
> except the
> obvious prt0.as problems I'm having. From what I saw most
> of the *bsd is
> already defined and I even saw an openbsd i386/m68k target,
> take a look
> at fpcsrc/compiler/systems.pas,
> fpcsrc/compiler/systems/i_bsd.pas
> fpcsrc/compiler/systems/t_bsd.pas and
> fpcsrc/rtl/openbsd/
> 
> 
> Kind regards,
> 
> Axel Scheepers
> -- 
> ()  ascii ribbon campaign - against html e-mail 
> /\  www.asciiribbon.org   - against
> proprietary attachments
> 
> -Inline Attachment Follows-
> 
> ___
> fpc-devel maillist  -  fpc-devel@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> 



___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] adding x86_64-netbsd

2009-04-21 Thread Axel Scheepers
Oh, I also had to build a fpcmake beforehand (see
fpcsrc/utils/fpcm/fpcmmain.pp) and did a 
find /path/to/toplevel/source/dir -name Makefile.fpc
-exec /path/to/new/fpcmake -Tall {} \;

I also had to cross build a binutils and put that in my $PATH.

I have some spare time coming, I should take a better look at the
freebsd prt0.as and see if I can work from there to see if my mess can
produce a netbsd-/amd64 binary so I can try to build a native fpc for
it.

Kind regards,

Axel Scheepers
-- 
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments


signature.asc
Description: This is a digitally signed message part
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel