Skip to content

Comments

bazel-registry: Add .envoy suffix to xscan-fat-runtime version#3676

Closed
Copilot wants to merge 6 commits intomainfrom
copilot/create-xscan-fat-runtime-module
Closed

bazel-registry: Add .envoy suffix to xscan-fat-runtime version#3676
Copilot wants to merge 6 commits intomainfrom
copilot/create-xscan-fat-runtime-module

Conversation

Copy link
Contributor

Copilot AI commented Jan 31, 2026

All bazel-registry modules use .envoy version suffixes. The newly created xscan-fat-runtime module used 1.0.0 instead of 1.0.0.envoy.

Changes

  • Renamed version directory: 1.0.01.0.0.envoy
  • Updated metadata.json and MODULE.bazel to reference 1.0.0.envoy

Now consistent with hyperscan (5.4.2.envoy), ragel (7.0.4-211228-d4577c9.envoy), and all other modules.

Original prompt

Create xscan-fat-runtime module

Background

PR #3675 implements a fat runtime for hyperscan with symbol renaming to support multiple CPU architecture variants. This pattern will also be needed for vectorscan (the ARM-focused fork of hyperscan). Rather than duplicating the logic, we should extract it into a shared module.

Task

Create a new Bazel module xscan-fat-runtime that provides the fat runtime symbol renaming infrastructure for both hyperscan and vectorscan.

Implementation

Create the following structure:

bazel-registry/modules/xscan-fat-runtime/
├── metadata.json
├── 1.0.0/
│   ├── MODULE.bazel
│   ├── source.json
│   └── overlay/
│       ├── BUILD.bazel
│       └── fat_runtime.bzl

metadata.json

{
    "homepage": "https://github.com/envoyproxy/toolshed",
    "maintainers": [
        {
            "name": "Envoy maintainers",
            "github": "envoyproxy"
        }
    ],
    "versions": [
        "1.0.0"
    ],
    "yanked_versions": {}
}

1.0.0/MODULE.bazel

module(
    name = "xscan-fat-runtime",
    version = "1.0.0",
    bazel_compatibility = [">=7.2.1"],
    compatibility_level = 1,
)

bazel_dep(name = "rules_cc", version = "0.1.1")
bazel_dep(name = "platforms", version = "0.0.11")

1.0.0/source.json

This should be a local/empty source since the module is purely overlay-based. Use appropriate format for a toolshed-local module.

1.0.0/overlay/BUILD.bazel

load("@rules_cc//cc:defs.bzl", "cc_library")

package(default_visibility = ["//visibility:public"])

exports_files(["fat_runtime.bzl"])

1.0.0/overlay/fat_runtime.bzl

Extract the fat runtime implementation from PR #3675's bazel-registry/modules/hyperscan/5.4.2.envoy/overlay/fat_runtime.bzl, containing:

  1. XSCAN_KEEP_SYMBOLS - The keep-list for symbol renaming, including:

    • Hyperscan/vectorscan allocation hooks: hs_misc_alloc, hs_misc_free, hs_database_alloc, hs_database_free, hs_scratch_alloc, hs_scratch_free, hs_stream_alloc, hs_stream_free, hs_free_scratch
    • Cross-library symbols: ^mmbit_
    • System/libc symbols: ^_, ^malloc$, ^free$, ^calloc$, ^realloc$, ^memcpy$, ^memmove$, ^memset$, ^memcmp$, ^strlen$, ^strcmp$, ^strncmp$, ^strcpy$, ^strncpy$, ^printf$, ^fprintf$, ^sprintf$, ^snprintf$, ^abort$, ^exit$, ^pthread_
  2. rename_symbols rule - The Starlark rule that:

    • Uses find_cc_toolchain() and use_cc_toolchain() for hermetic toolchain access
    • Gets the ar tool via cc_common.get_tool_for_action() with ACTION_NAMES.cpp_link_static_library
    • Derives nm and objcopy paths from the ar path (supporting LLVM toolchain layout)
    • Extracts objects from archive, renames symbols with prefix (excluding keep-list), recreates archive
    • Returns DefaultInfo with the renamed archive
  3. exec_variant macro - A macro that:

    • Takes parameters: name, arch, march_flag, common_lib, srcs, hdrs, copts, includes, target_constraints, extra_keep_symbols (optional)
    • Creates a cc_library with the arch-specific compilation flags
    • Calls rename_symbols to rename the symbols with the arch prefix
    • Creates a cc_import for the renamed static library
    • Creates a final cc_library that exports the renamed variant

The implementation should be extracted/adapted from the working code in PR #3675's fat_runtime.bzl.

Notes

  • Do NOT modify the hyperscan module - the user will hook it up themselves for testing
  • The module should be self-contained and usable by both hyperscan and vectorscan
  • Follow the existing patterns in the toolshed bazel-registry for module structure

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@netlify
Copy link

netlify bot commented Jan 31, 2026

Deploy Preview for nifty-bassi-e26446 ready!

Name Link
🔨 Latest commit 040bbab
🔍 Latest deploy log https://app.netlify.com/projects/nifty-bassi-e26446/deploys/697e5c313c825a0008c3d336
😎 Deploy Preview https://deploy-preview-3676--nifty-bassi-e26446.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI and others added 4 commits January 31, 2026 19:31
Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Copilot AI changed the title [WIP] Create xscan-fat-runtime module for symbol renaming infrastructure bazel-registry: Add xscan-fat-runtime module for multi-arch symbol renaming Jan 31, 2026
Copilot AI requested a review from phlax January 31, 2026 19:36
Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Copilot AI changed the title bazel-registry: Add xscan-fat-runtime module for multi-arch symbol renaming bazel-registry: Add .envoy suffix to xscan-fat-runtime version Jan 31, 2026
@phlax phlax closed this Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants