Move to new version of bazel, shift from WORKSPACE to MODULE.bazel

PiperOrigin-RevId: 893646575
Change-Id: If48d2a4f36bf0f6ff748ce9a2985ea2c1e503bbd
diff --git a/.bazeliskrc b/.bazeliskrc
index e254530..1ab2228 100644
--- a/.bazeliskrc
+++ b/.bazeliskrc
@@ -1 +1 @@
-USE_BAZEL_VERSION=7.1.2
+USE_BAZEL_VERSION=8.6.0
diff --git a/.bazelrc b/.bazelrc
index f400d64..82e707d 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -21,6 +21,10 @@
 
 build --copt=-Wno-unused-function --cxxopt="-std=c++17"
 build --host_copt=-Wno-unused-function --host_cxxopt="-std=c++17"
-# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel
-# https://github.com/protocolbuffers/protobuf/issues/14313
-common --noenable_bzlmod
\ No newline at end of file
+
+# Force include cstdint to provide uintptr_t for Abseil and other deps
+build --cxxopt=-include --cxxopt=cstdint
+build --host_cxxopt=-include --host_cxxopt=cstdint
+
+common --registry=https://raw.githubusercontent.com/google/mpact-sim-codelabs/main/
+common --registry=https://bcr.bazel.build/
diff --git a/.bazelversion b/.bazelversion
index a8a1887..acd405b 100644
--- a/.bazelversion
+++ b/.bazelversion
@@ -1 +1 @@
-7.1.2
+8.6.0
diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 0000000..147be0f
--- /dev/null
+++ b/MODULE.bazel
@@ -0,0 +1,64 @@
+# Copyright 2026 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module(
+    name = "mpact-riscv",
+    version = "1.0.0",
+)
+
+# Core Dependencies
+bazel_dep(
+    name = "mpact-sim",
+    version = "1.0.0",
+)
+bazel_dep(
+    name = "abseil-cpp",
+    version = "20240116.2",
+)
+bazel_dep(
+    name = "protobuf",
+    version = "29.0",
+    repo_name = "com_google_protobuf",
+)
+bazel_dep(
+    name = "googletest",
+    version = "1.14.0.bcr.1",
+    repo_name = "com_google_googletest",
+)
+bazel_dep(
+    name = "re2",
+    version = "2023-11-01",
+    repo_name = "com_googlesource_code_re2",
+)
+bazel_dep(
+    name = "rules_license",
+    version = "1.0.0",
+)
+bazel_dep(
+    name = "bazel_skylib",
+    version = "1.7.1",
+)
+bazel_dep(
+    name = "rules_cc",
+    version = "0.1.3",
+)
+
+sim_deps = use_extension(
+    "@mpact-sim//:extensions.bzl",
+    "non_module_deps",
+)
+use_repo(
+    sim_deps,
+    "com_github_serge1_elfio",
+)
diff --git a/gitfiles/WORKSPACE b/gitfiles/WORKSPACE
deleted file mode 100644
index 17ce205..0000000
--- a/gitfiles/WORKSPACE
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright 2023 - 2024 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-workspace(name = "com_google_mpact-riscv")
-
-# First load the immediate repo dependencies (mpact-sim).
-load("@com_google_mpact-riscv//:repos.bzl", "mpact_riscv_repos")
-
-mpact_riscv_repos()
-
-# Next load in the transitive repo dependencies.
-load("@com_google_mpact-riscv//:dep_repos.bzl", "mpact_riscv_dep_repos")
-
-mpact_riscv_dep_repos()
-
-# Call the deps function. It will call any other dependent deps functions.
-load("@com_google_mpact-riscv//:deps.bzl", "mpact_riscv_deps");
-
-mpact_riscv_deps()
-
-# Load the protobuf deps from mpact_sim
-load("@com_google_mpact-sim//:protobuf_deps.bzl", "mpact_sim_protobuf_deps")
-
-mpact_sim_protobuf_deps()
-
diff --git a/gitfiles/dep_repos.bzl b/gitfiles/dep_repos.bzl
deleted file mode 100644
index 65d9176..0000000
--- a/gitfiles/dep_repos.bzl
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright 2024 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Call the first level dependent repos to load their dependencies."""
-
-load("@com_google_mpact-sim//:repos.bzl", "mpact_sim_repos")
-
-def mpact_riscv_dep_repos():
-    """ Extra dependencies to finish setting up repositories"""
-
-    mpact_sim_repos()
diff --git a/gitfiles/deps.bzl b/gitfiles/deps.bzl
deleted file mode 100644
index 23c199c..0000000
--- a/gitfiles/deps.bzl
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright 2024 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Set up extra repositories with the dependencies"""
-
-load("@com_google_mpact-sim//:deps.bzl", "mpact_sim_deps")
-
-def mpact_riscv_deps():
-    """ Extra dependencies to finish setting up repositories"""
-
-    mpact_sim_deps()
diff --git a/gitfiles/repos.bzl b/gitfiles/repos.bzl
deleted file mode 100644
index a8ce95b..0000000
--- a/gitfiles/repos.bzl
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2024 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Load dependent repositories"""
-
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-
-def mpact_riscv_repos():
-    """ Load dependencies needed to use mpact-riscv as a 3rd-party consumer"""
-
-    if not native.existing_rule("com_google_mpact-sim"):
-        http_archive(
-            name = "com_google_mpact-sim",
-            sha256 = "117b8c8c3508e0c7975c2560b58cb742662568e3fd33722e01c4c07f742d1a54",
-            strip_prefix = "mpact-sim-323f07a5bf5e9eea2ad337e295a53235eaa3bfee",
-            url = "https://github.com/google/mpact-sim/archive/323f07a5bf5e9eea2ad337e295a53235eaa3bfee.tar.gz",
-        )
diff --git a/riscv/riscv_gdb_debug_info.h b/riscv/riscv_gdb_debug_info.h
index 0d0055b..57feaaa 100644
--- a/riscv/riscv_gdb_debug_info.h
+++ b/riscv/riscv_gdb_debug_info.h
@@ -160,6 +160,9 @@
   int GetLastGpr() const override {
     return static_cast<int>(RiscVGdbRegisterEnum::kGprLast);
   }
+  int GetPcRegister() const override {
+    return static_cast<int>(RiscVGdbRegisterEnum::kGprPc);
+  }
   int GetGprWidth() const override { return gpr_width_; };
   // For now assume that all registers have the same width as the GPRs.
   int GetRegisterByteWidth(int register_number) const override {