diff --git a/aarch64/__init__.py b/aarch64/__init__.py index 3e1ec52f..787bc38b 100644 --- a/aarch64/__init__.py +++ b/aarch64/__init__.py @@ -1,5 +1,5 @@ # BSP support for ARM64 -from support import Compiler, target_compiler +from support import using_llvm_compiler from support.bsp_sources.archsupport import ArchSupport from support.bsp_sources.target import DFBBTarget @@ -117,7 +117,7 @@ def system_ads(self): # GNAT-LLVM can't build the embedded Morello runtime yet, so we exclude it for # the time being. - if target_compiler() != Compiler.gnat_llvm: + if using_llvm_compiler(): result["embedded"] = "system-xi-arm-nxstack-embedded.ads" return result diff --git a/aarch64/zynqmp/common.ld b/aarch64/zynqmp/common.ld index 69a33f4f..74268dbc 100644 --- a/aarch64/zynqmp/common.ld +++ b/aarch64/zynqmp/common.ld @@ -95,7 +95,17 @@ SECTIONS __eh_frame_hdr = .; *(.eh_frame_hdr) } > REGION_CODE - .eh_frame : { KEEP (*(.eh_frame)) } > REGION_CODE + + __eh_frame_hdr_start = SIZEOF(.eh_frame_hdr) > 0 ? ADDR(.eh_frame_hdr) : 0; + __eh_frame_hdr_end = SIZEOF(.eh_frame_hdr) > 0 ? . : 0; + + .eh_frame : + { + __eh_frame_start = .; + KEEP (*(.eh_frame)) + __eh_frame_end = .; + } > REGION_CODE + .gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) } > REGION_CODE . = ALIGN(0x1000); diff --git a/support/__init__.py b/support/__init__.py index 7b4c41b5..9def0ea3 100644 --- a/support/__init__.py +++ b/support/__init__.py @@ -99,3 +99,7 @@ def set_target_compiler(comp): def target_compiler(): return _TARGET_COMPILER + + +def using_llvm_compiler(): + return target_compiler() == Compiler.gnat_llvm diff --git a/support/bsp_sources/installer.py b/support/bsp_sources/installer.py index 70194b71..ad4838ed 100644 --- a/support/bsp_sources/installer.py +++ b/support/bsp_sources/installer.py @@ -1,4 +1,4 @@ -from support import readfile, getdatafilepath, Compiler, target_compiler +from support import readfile, getdatafilepath, using_llvm_compiler from support.bsp_sources.target import Target from support.files_holder import _copy @@ -147,15 +147,11 @@ def _find_rts_sources(self, destination, descriptor): break if ret is None: # gprls did not work, try to find out manually the proper location - compiler_name_pattern = ( - "%s-llvm-gcc" if target_compiler() == Compiler.gnat_llvm else "%s-gcc" - ) + compiler_name_pattern = "%s-llvm-gcc" if using_llvm_compiler() else "%s-gcc" compiler = shutil.which(compiler_name_pattern % self.tgt.target) if compiler is not None: compiler_root = os.path.dirname(os.path.dirname(compiler)) - lib_dir = ( - "gnat-llvm" if target_compiler() == Compiler.gnat_llvm else "gnat" - ) + lib_dir = "gnat-llvm" if using_llvm_compiler() else "gnat" tentative = os.path.join( compiler_root, self.tgt.target, "lib", lib_dir, rts_json_file ) diff --git a/support/bsp_sources/target.py b/support/bsp_sources/target.py index f83a9026..a87af9f6 100644 --- a/support/bsp_sources/target.py +++ b/support/bsp_sources/target.py @@ -1,7 +1,7 @@ import copy import sys -from support import readfile, is_string, Compiler, target_compiler +from support import readfile, is_string, using_llvm_compiler from support.files_holder import FilesHolder from support.bsp_sources.archsupport import ArchSupport from support.rts_sources.profiles import RTSProfiles @@ -176,7 +176,7 @@ def __init__(self): "c_flags": ["-DIN_RTS", "-Dinhibit_libc", "-DLIGHT_RUNTIME"], } # GNAT-LLVM doesn't support -fcallgraph-info - if target_compiler() != Compiler.gnat_llvm: + if using_llvm_compiler(): self.build_flags["common_flags"].append("-fcallgraph-info=su,da") # Add the following compiler switches to runtime.xml for all targets: @@ -187,7 +187,7 @@ def __init__(self): # a hidden runtime dependency that is considered undesirable by many # of our customers. strlen is particularly problematic, as its not # provided in our light and light-tasking runtimes. - if target_compiler() == Compiler.gnat: + if using_llvm_compiler(): self.global_compiler_switches = ("-fno-tree-loop-distribute-patterns",) else: self.global_compiler_switches = () @@ -372,6 +372,8 @@ def dump_runtime_xml(self, rts_name, rts): blank + '"-nostartfiles", "-nolibc", ' + '"-Wl,--start-group,-lgnarl,-lgnat,-lc,-lgcc,-lgcc_eh,--end-group",' + if using_llvm_compiler() + else '"-Wl,--start-group,-lgnarl,-lgnat,-lc,-lunwind,--end-group",' ) # Add the user script path first, so that they have precedence diff --git a/support/rts_sources/profiles.py b/support/rts_sources/profiles.py index 8d81a39b..c33aae87 100644 --- a/support/rts_sources/profiles.py +++ b/support/rts_sources/profiles.py @@ -5,6 +5,7 @@ # BSP to actually create a runtime project. import sys +from support import using_llvm_compiler from support.rts_sources import Rule from support.rts_sources.sources import all_scenarios, sources @@ -61,6 +62,8 @@ def light_scenarios(self, profile="light"): """Returns the list of directories contained in a base Light runtime""" ret = {} ret["RTS_Profile"] = profile + ret["Compiler_Backend"] = "llvm" if using_llvm_compiler() else "gcc" + ret["Add_Arith64"] = "yes" ret["Add_Case_Util:yes"] = "yes" ret["Add_Exponent_Float"] = "yes" diff --git a/support/rts_sources/sources.py b/support/rts_sources/sources.py index 87a5d083..fcd0177f 100644 --- a/support/rts_sources/sources.py +++ b/support/rts_sources/sources.py @@ -26,6 +26,7 @@ all_scenarios = { # Main profile "RTS_Profile": ["light", "light-tasking", "embedded", "cert"], + "Compiler_Backend": ["gcc", "llvm"], # Runtime RTP support "Is_RTP": ["no", "yes"], # CPU architecture @@ -1523,8 +1524,15 @@ "srcs": [ "libgnat/s-excmac__gcc.ads", "libgnat/s-excmac__gcc.adb", - "libgcc/unwind-dw2-fde.h", ], + }, + "full/zcx-dw2-gcc": { + "conditions": [ + "RTS_Profile:embedded", + "CPU_Family:!arm", + "Compiler_Backend:gcc", + ], + "srcs": ["libgcc/unwind-dw2-fde.h"], "bb_srcs": ["hie/unwind-dw2-fde-bb.c"], }, "full/zcx-aarch64": {