Skip to content

Commit

Permalink
Merge branch 'topic/kliemann/bb-runtimes-79-native-cpu' into 'master'
Browse files Browse the repository at this point in the history
Split native into separate Linux and Windows targets

See merge request eng/toolchain/bb-runtimes!129
  • Loading branch information
jklmnn committed Sep 18, 2024
2 parents 3bbc0b9 + 6a8c7c1 commit 376e062
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 29 deletions.
19 changes: 12 additions & 7 deletions build_rts.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
from x86_64 import X8664Generic

# native
from native import Aarch64Native, X86Native, X8664Native
from linux import Aarch64Linux, X86Linux, X8664Linux
from windows import X86Windows, X8664Windows

# vx7r2cert
from vx7r2cert import (
Expand Down Expand Up @@ -282,12 +283,16 @@ def build_configs(target):
elif target == "x86_64":
t = X8664Generic()
# native platforms
elif target in ("x86-linux", "x86-windows"):
t = X86Native(target)
elif target in ("x86_64-linux", "x86_64-windows", "x86_64-windows64"):
t = X8664Native(target)
elif target in ("aarch64-linux",):
t = Aarch64Native(target)
elif target == "aarch64-linux":
t = Aarch64Linux()
elif target == "x86-linux":
t = X86Linux()
elif target == "x86_64-linux":
t = X8664Linux()
elif target == "x86-windows":
t = X86Windows()
elif target in ("x86_64-windows", "x86_64-windows64"):
t = X8664Windows()
# vx7r2cert
elif target == "aarch64-vx7r2cert":
t = AArch64Vx7r2Cert()
Expand Down
40 changes: 18 additions & 22 deletions native/__init__.py → linux/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
from support.bsp_sources.target import DFBBTarget


class Native(DFBBTarget):
def __init__(self, target):
class Linux(DFBBTarget):
def __init__(self):
super().__init__()
self.add_gnat_sources("src/s-macres__native.adb")
# Use the bb source of s-textio for Windows as a custom
# source profile is not yet supported.
# eng/toolchain/bb-runtimes#78
if "windows" in target:
self.add_gnat_sources("src/s-textio__stdio.adb")

@property
def target(self):
return None

def has_libc(self, profile):
return True

@property
def name(self):
return self.target

def dump_runtime_xml(self, rts_name, rts):
return (
'<?xml version="1.0" ?>\n'
Expand All @@ -27,24 +22,25 @@ def dump_runtime_xml(self, rts_name, rts):
"</gprconfig>\n"
)

def amend_rts(self, rts_profile, cfg):
super().amend_rts(rts_profile, cfg)
@property
def is_legacy_format(self):
return True


class X86Native(Native):
class X86Linux(Linux):
@property
def name(self):
return "native-x86"
def target(self):
return "x86-linux"

@property
def system_ads(self):
return {"light": "system-native-x86-light.ads"}


class X8664Native(Native):
class X8664Linux(Linux):
@property
def name(self):
return "native-x86_64"
def target(self):
return "x86_64-linux"

@property
def is_64bit(self):
Expand All @@ -55,10 +51,10 @@ def system_ads(self):
return {"light": "system-native-x86-light.ads"}


class Aarch64Native(Native):
class Aarch64Linux(Linux):
@property
def name(self):
return "native-aarch64"
def target(self):
return "aarch64-linux"

@property
def is_64bit(self):
Expand Down
51 changes: 51 additions & 0 deletions windows/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from support.bsp_sources.target import DFBBTarget


class Windows(DFBBTarget):
def __init__(self):
super().__init__()
self.add_gnat_sources("src/s-macres__native.adb", "src/s-textio__stdio.adb")

@property
def name(self):
return self.target

def has_libc(self, profile):
return True

def dump_runtime_xml(self, rts_name, rts):
return (
'<?xml version="1.0" ?>\n'
"<gprconfig>\n"
" <configuration>\n"
" </configuration>\n"
"</gprconfig>\n"
)

@property
def is_legacy_format(self):
return True


class X86Windows(Windows):
@property
def target(self):
return "x86-windows"

@property
def system_ads(self):
return {"light": "system-native-x86-light.ads"}


class X8664Windows(Windows):
@property
def target(self):
return "x86_64-windows"

@property
def is_64bit(self):
return True

@property
def system_ads(self):
return {"light": "system-native-x86-light.ads"}

0 comments on commit 376e062

Please sign in to comment.