arm-netbsd: added platform define and dummy rtl files so the build passes for this platform. port not functional yet

git-svn-id: trunk@38412 -
This commit is contained in:
Károly Balogh 2018-03-05 15:38:46 +00:00
parent 6e09180502
commit dbb91b5ef0
16 changed files with 248 additions and 9 deletions

5
.gitattributes vendored
View File

@ -9762,6 +9762,11 @@ rtl/nds/sysutils.pp svneol=native#text/plain
rtl/nds/tthread.inc svneol=native#text/plain
rtl/netbsd/Makefile svneol=native#text/plain
rtl/netbsd/Makefile.fpc svneol=native#text/plain
rtl/netbsd/arm/bsyscall.inc svneol=native#text/plainn
rtl/netbsd/arm/cprt0.as svneol=native#text/plainn
rtl/netbsd/arm/dllprt0.as svneol=native#text/plainn
rtl/netbsd/arm/prt0.as svneol=native#text/plainn
rtl/netbsd/arm/sighnd.inc svneol=native#text/plainn
rtl/netbsd/errno.inc svneol=native#text/plain
rtl/netbsd/errnostr.inc svneol=native#text/plain
rtl/netbsd/i386/bsyscall.inc svneol=native#text/plain

View File

@ -402,7 +402,7 @@ unit agarmgas;
idtxt : 'AS';
asmbin : 'as';
asmcmd : '-o $OBJ $EXTRAOPT $ASM';
supported_targets : [system_arm_linux,system_arm_wince,system_arm_gba,system_arm_palmos,system_arm_nds,
supported_targets : [system_arm_linux,system_arm_netbsd,system_arm_wince,system_arm_gba,system_arm_palmos,system_arm_nds,
system_arm_embedded,system_arm_symbian,system_arm_android,system_arm_aros];
flags : [af_needar,af_smartlink_sections];
labelprefix : '.L';

View File

@ -955,8 +955,9 @@ implementation
asmbin : '';
asmcmd : '';
supported_targets : [system_arm_embedded,system_arm_darwin,
system_arm_linux,system_arm_gba,
system_arm_nds,system_arm_aros];
system_arm_linux,system_arm_netbsd,
system_arm_gba,system_arm_nds,
system_arm_aros];
flags : [af_outputbinary,af_smartlink_sections,af_supports_dwarf];
labelprefix : '.L';
comment : '';

View File

@ -178,7 +178,8 @@
system_arm_aros, { 91 }
system_wasm_wasm32, { 92 }
system_sparc64_linux, { 93 }
system_sparc64_solaris { 94 }
system_sparc64_solaris, { 94 }
system_arm_netbsd { 95 }
);
type

View File

@ -239,7 +239,8 @@ interface
systems_netbsd = [system_i386_netbsd,
system_m68k_netbsd,
system_powerpc_netbsd,
system_x86_64_netbsd];
system_x86_64_netbsd,
system_arm_netbsd];
systems_openbsd = [system_i386_openbsd,
system_x86_64_openbsd];
@ -974,6 +975,10 @@ begin
{$define default_target_set}
default_target(system_arm_linux);
{$endif}
{$ifdef netbsd}
{$define default_target_set}
default_target(system_arm_netbsd);
{$endif}
{$ifdef android}
{$define default_target_set}
default_target(system_arm_android);

View File

@ -645,6 +645,69 @@ unit i_bsd;
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';
);
system_arm_netbsd_info : tsysteminfo =
(
system : system_arm_netbsd;
name : 'NetBSD for ARMHF';
shortname : 'NetBSD';
flags : [tf_under_development,tf_files_case_sensitive,tf_smartlink_sections,tf_has_winlike_resources];
cpu : cpu_arm;
unit_env : '';
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 : '.s';
staticlibprefix : 'libp';
sharedlibprefix : 'lib';
sharedClibext : '.so';
staticClibext : '.a';
staticClibprefix : 'lib';
sharedClibprefix : 'lib';
importlibprefix : 'libimp';
importlibext : '.a';
Cprefix : '';
newline : #10;
dirsep : '/';
assem : as_gas; {as_arm_elf32;}
assemextern : as_gas;
link : ld_none;
linkextern : ld_bsd;
ar : ar_gnu_ar;
res : res_elf;
dbg : dbg_dwarf2;
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;
recordalignmin : 0;
recordalignmax : 2;
maxCrecordalign : 4 // should be 8 probably
);
first_parm_offset : 8;
stacksize : 32*1024*1024;
stackalign : 16;
abi : abi_default;
llvmdatalayout : 'todo';
);
system_powerpc_darwin_info : tsysteminfo =
(
system : system_powerpc_darwin;
@ -1219,6 +1282,9 @@ initialization
{$ifdef Darwin}
set_source_info(system_arm_darwin_info);
{$endif Darwin}
{$ifdef NetBSD}
set_source_info(system_arm_netbsd_info);
{$endif}
{$endif cpuarm}
{$ifdef cpuaarch64}
{$ifdef Darwin}

View File

@ -1101,6 +1101,10 @@ initialization
RegisterImport(system_arm_darwin,timportlibdarwin);
RegisterExport(system_arm_darwin,texportlibdarwin);
RegisterTarget(system_arm_darwin_info);
RegisterImport(system_arm_netbsd,timportlibbsd);
RegisterExport(system_arm_netbsd,texportlibbsd);
RegisterTarget(system_arm_netbsd_info);
{$endif arm}
{$ifdef aarch64}
RegisterImport(system_aarch64_darwin,timportlibdarwin);

View File

@ -180,7 +180,8 @@ const
{ 91 } 'AROS-arm',
{ 92 } 'WebAssembly-wasm',
{ 93 } 'Linux-sparc64',
{ 94 } 'Solaris-sparc64'
{ 94 } 'Solaris-sparc64',
{ 95 } 'NetBSD-arm'
);
const

View File

@ -180,7 +180,7 @@ Const
AllAmigaLikeOSes = [Amiga,MorphOS,AROS];
AllLimit83fsOses = [go32v2,os2,emx,watcom,msdos,win16,atari];
AllSmartLinkLibraryOSes = [Linux,msdos,win16]; // OSes that use .a library files for smart-linking
AllSmartLinkLibraryOSes = [Linux,msdos,win16,palmos]; // OSes that use .a library files for smart-linking
AllImportLibraryOSes = AllWindowsOSes + [os2,emx,netwlibc,netware,watcom,go32v2,macos,nativent,msdos,win16];
{ This table is kept OS,Cpu because it is easier to maintain (PFV) }
@ -193,7 +193,7 @@ Const
{ os2 } ( false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false),
{ freebsd } ( false, true, true, false, false, true, false, false, false, false, false, false, false, false, false, false),
{ beos } ( false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false),
{ netbsd } ( false, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false),
{ netbsd } ( false, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false),
{ amiga } ( false, false, true, true, false, false, false, false, false, false, false, false, false, false, false, false),
{ atari } ( false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false),
{ solaris } ( false, true, false, false, true, true, false, false, false, false, false, false, false, false, false, false),

View File

@ -0,0 +1,14 @@
{
This file is part of the Free Pascal run time library.
Copyright (c) 2005 by Michael Van Canneyt,
member of the Free Pascal development team.
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
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.
**********************************************************************}

16
rtl/netbsd/arm/cprt0.as Normal file
View File

@ -0,0 +1,16 @@
#
# This file is part of the Free Pascal run time library.
# Copyright (c) 2017 by Karoly Balogh
# member of the Free Pascal development team.
#
# See the file COPYING.FPC, included in this distribution,
# for details about the copyright.
#
# 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.
#
#**********************************************************************}
#
# FIX ME: dummy file, required for the build to pass, implement! (KB)

16
rtl/netbsd/arm/dllprt0.as Normal file
View File

@ -0,0 +1,16 @@
#
# This file is part of the Free Pascal run time library.
# Copyright (c) 2017 by Karoly Balogh
# member of the Free Pascal development team.
#
# See the file COPYING.FPC, included in this distribution,
# for details about the copyright.
#
# 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.
#
#**********************************************************************}
#
# FIX ME: dummy file, required for the build to pass, implement! (KB)

55
rtl/netbsd/arm/prt0.as Normal file
View File

@ -0,0 +1,55 @@
#
# This file is part of the Free Pascal run time library.
# Copyright (c) 2017 by Karoly Balogh
# member of the Free Pascal development team.
#
# See the file COPYING.FPC, included in this distribution,
# for details about the copyright.
#
# 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.
#
#**********************************************************************}
#
# NetBSD standard (shared) ELF/arm startup code for Free Pascal
.section .text
.globl _start
_start:
# move.l %a2,-(%sp) | ps_strings
# move.l %a0,-(%sp) | obj
# move.l %a1,-(%sp) | cleanup
# move.l 0(%a2),operatingsystem_parameter_argv
# move.l 4(%a2),operatingsystem_parameter_argc
# move.l 8(%a2),operatingsystem_parameter_envp
# move.l 8(%a2),environ
# jsr PASCALMAIN
# jmp _haltproc
.globl _haltproc
_haltproc:
# move.l operatingsystem_result,-(%sp)
# move.l #0,-(%sp)
# moveq.l #1,%d0
# trap #0
# rts
.section .data
.comm environ,4,4
.comm operatingsystem_parameter_envp,4,4
.comm operatingsystem_parameter_argc,4,4
.comm operatingsystem_parameter_argv,4,4
.section ".note.netbsd.ident", "a"
.long 2f-1f
.long 4f-3f
.long 1
1: .asciz "NetBSD"
2: .p2align 2
3: .long 400000000
4: .p2align 2

49
rtl/netbsd/arm/sighnd.inc Normal file
View File

@ -0,0 +1,49 @@
{
This file is part of the Free Pascal run time library
(c) 2016 the Free Pascal development team
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
Signalhandler for NetBSD/m68k
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.
}
CONST FPU_ALL=$7F;
function getfpustate(const Sigcontext:sigcontextRec):longint; {inline;}
begin
getfpustate:=0;
end;
procedure SignalToRunerror(Signo: longint;info : PSigInfo;SigContext: PSigContextRec); public name '_FPC_DEFAULTSIGHANDLER'; cdecl;
var
res : word;
begin
res:=0;
if signo = SIGFPE then
begin
res := 200;
end
else
if (signo = SIGILL) or (signo = SIGBUS) or (signo = SIGSEGV) then
begin
res := 216;
end
else if (signo = SIGINT) then
begin
res:=217;
end
else if (signo = SIGKILL) then
begin
res:=233
end;
{ give runtime error at the position where the signal was raised }
if res<>0 then
begin
HandleError(res);
end;
end;

View File

@ -299,6 +299,12 @@ enum { _FRAME_GREG(GREG_OFFSETS) _NGREG = 26 };
{$WARNING FIXME! SigContextRec}
end;
{$endif powerpc}
{$ifdef CPUARM}
SigContextRec = record
sc_args : array[0..6] of clong;
{$WARNING FIXME! SigContextRec}
end;
{$endif m68k}
SignalHandler = Procedure(Sig : Longint);cdecl;
PSignalHandler = ^SignalHandler;

View File

@ -121,7 +121,7 @@ interface
{ freebsd } ( true, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false),
{ beos } ( true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false),
{ haiku } ( true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false),
{ netbsd } ( true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false),
{ netbsd } ( true, true, true, true, true, true, 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),
{ atari } ( false, true, 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),