add libbacktrace (#5990)

diff --git a/modules/libbacktrace/1.0.0-20250926-7939218/MODULE.bazel b/modules/libbacktrace/1.0.0-20250926-7939218/MODULE.bazel
new file mode 100644
index 0000000..200094c
--- /dev/null
+++ b/modules/libbacktrace/1.0.0-20250926-7939218/MODULE.bazel
@@ -0,0 +1,8 @@
+module(
+    name = "libbacktrace",
+    version = "1.0.0-20250926-7939218",
+    bazel_compatibility = [">=7.2.1"],
+)
+
+bazel_dep(name = "rules_license", version = "1.0.0")
+bazel_dep(name = "rules_cc", version = "0.2.8")
diff --git a/modules/libbacktrace/1.0.0-20250926-7939218/overlay/BUILD.bazel b/modules/libbacktrace/1.0.0-20250926-7939218/overlay/BUILD.bazel
new file mode 100644
index 0000000..ec3bd6a
--- /dev/null
+++ b/modules/libbacktrace/1.0.0-20250926-7939218/overlay/BUILD.bazel
@@ -0,0 +1,57 @@
+load("@rules_cc//cc:cc_library.bzl", "cc_library")
+load("@rules_license//rules:license.bzl", "license")
+
+package(
+    default_visibility = ["//visibility:public"],
+    default_applicable_licenses = [":license"],
+)
+
+exports_files([
+    "LICENSE",
+])
+
+license(
+    name = "license",
+    license_kinds = ["@rules_license//licenses/spdx:BSD-3-Clause"],
+    license_text = "LICENSE",
+)
+
+cc_library(
+    name = "backtrace",
+    srcs = [
+        "backtrace.h",
+        "atomic.c",
+        "dwarf.c",
+        "fileline.c",
+        "internal.h",
+        "posix.c",
+        "print.c",
+        "sort.c",
+        "state.c",
+        "config.h",
+        "backtrace.c",
+        "simple.c",
+        "nounwind.c",
+        "elf.c",
+        "macho.c",
+        "pecoff.c",
+        "unknown.c",
+        "read.c",
+        "mmapio.c",
+        "mmap.c",
+        "filenames.h",
+        "backtrace-supported.h",
+    ],
+    hdrs = [
+        "backtrace.h",
+    ],
+    includes = ["."],
+    linkstatic = 1,
+    visibility = ["//visibility:public"],
+)
+
+alias(
+    name = "libbacktrace",
+    actual = ":backtrace",
+    visibility = ["//visibility:public"],
+)
diff --git a/modules/libbacktrace/1.0.0-20250926-7939218/overlay/MODULE.bazel b/modules/libbacktrace/1.0.0-20250926-7939218/overlay/MODULE.bazel
new file mode 120000
index 0000000..9b599e3
--- /dev/null
+++ b/modules/libbacktrace/1.0.0-20250926-7939218/overlay/MODULE.bazel
@@ -0,0 +1 @@
+../MODULE.bazel
\ No newline at end of file
diff --git a/modules/libbacktrace/1.0.0-20250926-7939218/overlay/backtrace-supported.h b/modules/libbacktrace/1.0.0-20250926-7939218/overlay/backtrace-supported.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/modules/libbacktrace/1.0.0-20250926-7939218/overlay/backtrace-supported.h
diff --git a/modules/libbacktrace/1.0.0-20250926-7939218/overlay/config.h b/modules/libbacktrace/1.0.0-20250926-7939218/overlay/config.h
new file mode 100644
index 0000000..2f90384
--- /dev/null
+++ b/modules/libbacktrace/1.0.0-20250926-7939218/overlay/config.h
@@ -0,0 +1,66 @@
+// I.e. glibc needs this for dl_iterate_phdr
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <stdint.h>
+
+#if UINTPTR_MAX == 0xffffffff
+#define BACKTRACE_ELF_SIZE 32
+#ifdef __i386__
+#define HAVE_ATOMIC_FUNCTIONS 1
+#define HAVE_SYNC_FUNCTIONS 1
+#endif
+#else
+#if UINTPTR_MAX != 0xffffffffffffffffULL
+#error bad elf word size!?
+#endif
+#define BACKTRACE_ELF_SIZE 64
+#define HAVE_ATOMIC_FUNCTIONS 1
+#define HAVE_SYNC_FUNCTIONS 1
+#endif
+
+#if defined __ELF__
+#define HAVE_DL_ITERATE_PHDR 1
+#define HAVE_LINK_H 1
+
+// FreeBSD. We also assume it has modern enough GCC-compatible compiler
+#if defined __has_include
+#if __has_include(<sys/sysctl.h>)
+#if defined KERN_PROC
+#define HAVE_KERN_PROC 1
+#endif
+#if defined KERN_PROC_ARGS
+#define HAVE_KERN_PROC_ARGS 1
+#endif
+#endif
+#endif
+
+#elif defined __MACH__
+#define HAVE_MACH_O_DYLD_H
+#else
+#error This code is only prepared to deal with ELF systems or OSX (mach-o)
+#endif
+
+#define HAVE_FCNTL 1
+#define HAVE_LSTAT 1
+#define HAVE_MEMORY_H 1
+#define HAVE_READLINK 1
+#define HAVE_CLOCK_GETTIME 1
+#define HAVE_DECL_GETPAGESIZE 1
+#define HAVE_DECL_STRNLEN 1
+#define HAVE_DECL__PGMPTR 0
+#define HAVE_DLFCN_H 1
+#define HAVE_GETIPINFO 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_MMAN_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_UNISTD_H 1
+
+
+
diff --git a/modules/libbacktrace/1.0.0-20250926-7939218/presubmit.yml b/modules/libbacktrace/1.0.0-20250926-7939218/presubmit.yml
new file mode 100644
index 0000000..acf2a35
--- /dev/null
+++ b/modules/libbacktrace/1.0.0-20250926-7939218/presubmit.yml
@@ -0,0 +1,17 @@
+matrix:
+  platform:
+  - debian11
+  - ubuntu2404
+  - macos
+  - macos_arm64
+  bazel:
+  - rolling
+  - 8.x
+  - 7.x
+tasks:
+  verify_targets:
+    name: Verify build targets
+    platform: ${{ platform }}
+    bazel: ${{ bazel }}
+    build_targets:
+      - '@libbacktrace//:libbacktrace'
diff --git a/modules/libbacktrace/1.0.0-20250926-7939218/source.json b/modules/libbacktrace/1.0.0-20250926-7939218/source.json
new file mode 100644
index 0000000..92834d7
--- /dev/null
+++ b/modules/libbacktrace/1.0.0-20250926-7939218/source.json
@@ -0,0 +1,11 @@
+{
+    "url": "https://github.com/ianlancetaylor/libbacktrace/archive/793921876c981ce49759114d7bb89bb89b2d3a2d.tar.gz",
+    "integrity": "sha256-hYsSJTUQUiNPfnHw82Yi/JrTOqyUfbeBbQtEOuDdM84=",
+    "strip_prefix": "libbacktrace-793921876c981ce49759114d7bb89bb89b2d3a2d",
+    "overlay": {
+        "BUILD.bazel": "sha256-0JM7EAKDBRZJfF7eSE31GAjSvvpb4k4KrFXLi2W5TAU=",
+        "MODULE.bazel": "sha256-TNW5NV8cJTPDDwGQS3GsGxqb9hxDyBuplypb+PIWR2s=",
+        "backtrace-supported.h": "sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=",
+        "config.h": "sha256-ImDr0toqXreVzEJgduHuWE4WTi+8q58op2OvWlPugJo="
+    }
+}
diff --git a/modules/libbacktrace/metadata.json b/modules/libbacktrace/metadata.json
new file mode 100644
index 0000000..46ddea5
--- /dev/null
+++ b/modules/libbacktrace/metadata.json
@@ -0,0 +1,16 @@
+{
+    "homepage": "https://github.com/ianlancetaylor/libbacktrace",
+    "maintainers": [
+        {
+            "email": "bcr-maintainers@bazel.build",
+            "name": "No Maintainer Specified"
+        }
+    ],
+    "repository": [
+        "github:ianlancetaylor/libbacktrace"
+    ],
+    "versions": [
+        "1.0.0-20250926-7939218"
+    ],
+    "yanked_versions": {}
+}