Skip to content

Commit 35bd649

Browse files
authored
bazel-registry: Fix vectorscan@5.4.11.envoy (#3559)
Signed-off-by: Ryan Northey <ryan@synca.io>
1 parent 76f2fe7 commit 35bd649

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

bazel-registry/modules/vectorscan/5.4.11.envoy/overlay/BUILD.bazel

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
load("@rules_cc//cc:defs.bzl", "cc_library")
22

33
# Generate config.h for ARM
4+
# Uses C preprocessor to conditionally define HAVE__BUILTIN_CONSTANT_P based on compiler.
5+
# GCC optimizes __builtin_constant_p() properly, but Clang doesn't optimize away the
6+
# dead branch the same way, causing compile errors with ARM NEON intrinsics that require
7+
# constant arguments.
8+
# See: https://github.com/VectorCamp/vectorscan/blob/6bb8733e93f97a0e55b858ecd4e17d7e7b52619c/cmake/cflags-generic.cmake#L61-L64
49
genrule(
510
name = "config_h",
611
outs = ["config.h"],
@@ -10,13 +15,18 @@ genrule(
1015
1116
#define ARCH_64_BIT
1217
#define ARCH_AARCH64
18+
#define HAVE_C_ARM_NEON_H
1319
#define HAVE_NEON
1420
#define HAVE_SIMD_128_BITS
1521
#define HAVE_CC_BUILTIN_ASSUME_ALIGNED
1622
#define HAVE_CXX_BUILTIN_ASSUME_ALIGNED
1723
#define HAVE_POSIX_MEMALIGN
1824
#define HAVE_UNISTD_H
25+
/* Clang does not use __builtin_constant_p() the same way as GCC.
26+
* Only define for GCC to avoid ARM NEON intrinsic errors with Clang. */
27+
#if defined(__GNUC__) && !defined(__clang__)
1928
#define HAVE__BUILTIN_CONSTANT_P
29+
#endif
2030
#define HS_OPTIMIZE
2131
#define HS_VERSION "5.4.11"
2232
#define HS_MAJOR_VERSION 5
@@ -81,7 +91,6 @@ cc_library(
8191
"src/**/*.hpp",
8292
]),
8393
copts = [
84-
"-std=c99",
8594
"-O3",
8695
"-DNDEBUG",
8796
"-fno-strict-aliasing",
@@ -117,7 +126,6 @@ cc_library(
117126
"src/som/*.c",
118127
"src/util/simd_utils.c",
119128
"src/util/state_compress.c",
120-
"src/util/supervector/arch/arm/impl.cpp",
121129
],
122130
exclude = [
123131
"src/**/*_dump*.c",
@@ -131,9 +139,11 @@ cc_library(
131139
],
132140
hdrs = glob([
133141
"src/**/*.h",
134-
]),
142+
]) + [
143+
":config_h",
144+
],
145+
textual_hdrs = ["src/util/supervector/arch/arm/impl.cpp"],
135146
copts = [
136-
"-std=c99",
137147
"-O3",
138148
"-DNDEBUG",
139149
"-fno-strict-aliasing",
@@ -188,14 +198,14 @@ cc_library(
188198
":hs_version_h",
189199
],
190200
copts = [
191-
"-std=c++11",
192201
"-O2",
193202
"-DNDEBUG",
194203
"-fno-strict-aliasing",
195204
"-Wno-unused-parameter",
196205
"-Wno-sign-compare",
197206
"-Wno-unused-variable",
198207
"-Wno-unused-but-set-variable",
208+
"-std=c++17",
199209
],
200210
includes = [
201211
".",

bazel-registry/modules/vectorscan/5.4.11.envoy/source.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"patches": {},
66
"patch_strip": 1,
77
"overlay": {
8-
"BUILD.bazel": "sha256-crvQkjOE9RcNP6BKEUW2tPYNOjulttMFj5kxE9wnf1Y=",
8+
"BUILD.bazel": "sha256-bGV8ZYcvMoQdLm6RSN6yc24uT/EAsLMz1ibK2XLv4SM=",
99
"MODULE.bazel": "sha256-Mhvz6sZ5XqMtwYFOcBanL5yN8BqlChNalS3iTvo5rPI="
1010
}
1111
}

0 commit comments

Comments
 (0)