Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 17 additions & 7 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,34 @@ 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",
"treat_warnings_as_errors",
],
)
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.
Expand All @@ -60,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"],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ TEST(StdIntegralTypes, signess_and_bytes_number)
// How to move forward in this ticket Ticket-141110
// static_assert(std::numeric_limits<char>::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<char>::is_signed == true,
"it is expected a 'char' to be signed in a linux environment");
#endif
Expand Down
7 changes: 7 additions & 0 deletions score/os/cpuid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <arm_acle.h>
#elif defined(__linux__) && defined(__x86_64__)
#include <cpuid.h>
#elif defined(__linux__) && defined(__aarch64__)
#include "score/utility.hpp"
#else
#error "Target platform not supported"
#endif
Expand Down Expand Up @@ -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__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This issue is also being addressed in #22

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, I just cross-ported this here until the fix is on main. Note that this PR is really just a draft right now, since it fixes several but not yet all build issues. Some may also be related to the toolchain... investigation is ongoing.

// ARM64/aarch64 doesn't have CPUID instruction like x86
// Return dummy values for compatibility
score::cpp::ignore = leaf;
eax = ebx = ecx = edx = 0;
#endif
}
};
Expand Down
4 changes: 2 additions & 2 deletions third_party/acl/acl.BUILD
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
cc_library(
name = "acl",
srcs = [
"usr/lib/libacl.a",
"usr/lib/aarch64-linux-gnu/libacl.a",
],
hdrs = [
"usr/include/acl/libacl.h",
"usr/include/sys/acl.h",
],
includes = ["usr/include/"],
visibility = ["//visibility:public"],
)
)
Loading