From 75e01f3d778aeebc33108ff66e7b9766d6c37288 Mon Sep 17 00:00:00 2001 From: Oliver Pajonk Date: Thu, 13 Nov 2025 10:23:40 +0000 Subject: [PATCH 1/3] add config for EBcLfSA, add EBcLfSA compiler --- .bazelrc | 9 ++++++++- MODULE.bazel | 22 ++++++++++++++++------ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.bazelrc b/.bazelrc index e60252c0..35a200b1 100644 --- a/.bazelrc +++ b/.bazelrc @@ -32,10 +32,17 @@ build:bl_toolchain_common --host_platform=@score_bazel_platforms//:x86_64-linux # Target configuration for CPU:x86-64|OS:Linux build (do not use it in case of system toolchains!) build:bl-x86_64-linux --config=bl_stub build:bl-x86_64-linux --config=bl_toolchain_common -build:bl-x86_64-linux --platforms=@score_bazel_platforms//:x86_64-linux +build:bl-x86_64-linux --platforms=@score_toolchains_gcc//platforms:aarch64-linux build:bl-x86_64-linux --extra_toolchains=@gcc_toolchain//:host_gcc_12 test:bl-x86_64-linux --config=bl_common +# Target configuration for CPU:aarch64|OS:EBcLfSA build (do not use it in case of system toolchains!) +build:bl-aarch64-ebclfsa --config=bl_stub +build:bl-aarch64-ebclfsa --platforms=@score_bazel_platforms//:arm64-linux +build:bl-aarch64-ebclfsa --extra_toolchains=@gcc_toolchain//:aarch64_gcc_13 +build:bl-aarch64-ebclfsa --spawn_strategy=local +test:bl-aarch64-ebclfsa --config=bl_common + # Target configuration for CPU:x86-64|OS:QNX build (do not use it in case of system toolchains!) build:bl-x86_64-qnx --config=bl_stub build:bl-x86_64-qnx --config=bl_toolchain_common diff --git a/MODULE.bazel b/MODULE.bazel index a302a841..16776ba8 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -16,14 +16,22 @@ module( compatibility_level = 0, ) -# Configure the host toolchain. -bazel_dep(name = "score_toolchains_gcc", version = "0.5", dev_dependency=True) +# Configure the EB corbos Linux for Safety Applications (aarch64) toolchain. +bazel_dep(name = "score_toolchains_gcc", dev_dependency=True) +git_override( # Elektrobit corbos Linux for Safety Applications needs a specific toolchain + module_name = "score_toolchains_gcc", + remote = "https://github.com/Elektrobit/eclipse-score_toolchains_gcc.git", + #tag = "0.5.0-alpha", # commit sha: fb009e490b9b8f28805d587f50d0bf6d885f3414 + commit = "1255dd71ffec33e527aef76f86b4fdb3b48e01db", +) gcc = use_extension("@score_toolchains_gcc//extentions:gcc.bzl", "gcc", dev_dependency=True) gcc.toolchain( - url = "https://github.com/eclipse-score/toolchains_gcc_packages/releases/download/0.0.1/x86_64-unknown-linux-gnu_gcc12.tar.gz", - sha256 = "457f5f20f57528033cb840d708b507050d711ae93e009388847e113b11bf3600", - strip_prefix = "x86_64-unknown-linux-gnu", + url = "https://github.com/Elektrobit/eclipse-score_toolchains_gcc/releases/download/0.5.0-alpha/fastdev-sdk-ubuntu-ebcl-deb-qemu-arm64.tar.xz", + sha256 = "cf8d277a2b95bbdad3e177c488fa77d01723510690a911218ef33747574d78fe", + strip_prefix = "fastdev-sdk-ubuntu-ebcl-deb-qemuarm64", ) + +# TODO to be moved to toolchain. https://github.com/eclipse-score/toolchains_gcc/issues/11 gcc.extra_features( features = [ "minimal_warnings", @@ -31,9 +39,11 @@ gcc.extra_features( ], ) gcc.warning_flags( - minimal_warnings = ["-Wall", "-Wno-error=deprecated-declarations", "-Wno-error=narrowing"], + minimal_warnings = ["-Wall", "-Wno-error=deprecated-declarations"], strict_warnings = ["-Wextra", "-Wpedantic"], + treat_warnings_as_errors = ["-Werror"], ) + use_repo(gcc, "gcc_toolchain", "gcc_toolchain_gcc") # Configure the target toolchain. From 16baa2da1b8b48dccbd3604ba18bf0f7ca7abf63 Mon Sep 17 00:00:00 2001 From: Oliver Pajonk Date: Thu, 13 Nov 2025 10:20:29 +0000 Subject: [PATCH 2/3] cross-port parts of https://github.com/eclipse-score/baselibs/pull/22 --- score/language/safecpp/test/test_std_arithmetic_types.cpp | 2 +- score/os/cpuid.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/score/language/safecpp/test/test_std_arithmetic_types.cpp b/score/language/safecpp/test/test_std_arithmetic_types.cpp index b09415b4..7af292c0 100644 --- a/score/language/safecpp/test/test_std_arithmetic_types.cpp +++ b/score/language/safecpp/test/test_std_arithmetic_types.cpp @@ -54,7 +54,7 @@ TEST(StdIntegralTypes, signess_and_bytes_number) // How to move forward in this ticket Ticket-141110 // static_assert(std::numeric_limits::is_signed == false, // "it is expected a 'char' to be unsigned in a QNX environment"); -#else +#elif !defined(__aarch64__) // on aarch64 linux char is unsigned static_assert(std::numeric_limits::is_signed == true, "it is expected a 'char' to be signed in a linux environment"); #endif diff --git a/score/os/cpuid.cpp b/score/os/cpuid.cpp index 1f80592a..7088ec2a 100644 --- a/score/os/cpuid.cpp +++ b/score/os/cpuid.cpp @@ -20,6 +20,8 @@ #include #elif defined(__linux__) && defined(__x86_64__) #include +#elif defined(__linux__) && defined(__aarch64__) +#include "score/utility.hpp" #else #error "Target platform not supported" #endif @@ -68,6 +70,11 @@ class CpuIdImpl final : public CpuId /* KW_SUPPRESS_START:MISRA.USE.EXPANSION:OS library macros */ __cpuid(leaf, eax, ebx, ecx, edx); /* KW_SUPPRESS_END:MISRA.USE.EXPANSION:OS library macros */ +#elif defined(__linux__) && defined(__aarch64__) + // ARM64/aarch64 doesn't have CPUID instruction like x86 + // Return dummy values for compatibility + score::cpp::ignore = leaf; + eax = ebx = ecx = edx = 0; #endif } }; From 47dce6d56b4c33e75e1dea4409edcd0e557e024c Mon Sep 17 00:00:00 2001 From: Oliver Pajonk Date: Thu, 13 Nov 2025 10:21:37 +0000 Subject: [PATCH 3/3] fix linker problem with older libacl apparently the previous version was not built with -fPIC --- MODULE.bazel | 2 +- third_party/acl/acl.BUILD | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 16776ba8..683c131e 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -70,7 +70,7 @@ deb = use_repo_rule("@download_utils//download/deb:defs.bzl", "download_deb") deb( name = "acl-deb", build = "//third_party/acl:acl.BUILD", - urls = ["https://archive.ubuntu.com/ubuntu/pool/main/a/acl/libacl1-dev_2.2.52-3build1_amd64.deb"], + urls = ["https://launchpadlibrarian.net/581258948/libacl1-dev_2.3.1-1_arm64.deb"], visibility = ["//visibility:public"], ) diff --git a/third_party/acl/acl.BUILD b/third_party/acl/acl.BUILD index 718726c6..710befd0 100644 --- a/third_party/acl/acl.BUILD +++ b/third_party/acl/acl.BUILD @@ -1,7 +1,7 @@ cc_library( name = "acl", srcs = [ - "usr/lib/libacl.a", + "usr/lib/aarch64-linux-gnu/libacl.a", ], hdrs = [ "usr/include/acl/libacl.h", @@ -9,4 +9,4 @@ cc_library( ], includes = ["usr/include/"], visibility = ["//visibility:public"], -) \ No newline at end of file +)