From a73fd86c133b081709cb5311e70bbe47bb0e0d56 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Tue, 22 Oct 2019 13:27:26 -0400 Subject: [PATCH 1/2] Use memcpy to perform unaligned reads Creating and reading from unaligned pointers is UB and I'm trying to run upb on a platform (GraalVM) that is sensitive to that unfortunately. Recent compilers are smart enough to fold the memcpy down to a simple memory load on platforms that support it, so this should mostly be a aesthetic change. --- upb/table.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/upb/table.c b/upb/table.c index 8896d217db..fd5bc53f96 100644 --- a/upb/table.c +++ b/upb/table.c @@ -756,7 +756,8 @@ uint32_t upb_murmur_hash2(const void *key, size_t len, uint32_t seed) { /* Mix 4 bytes at a time into the hash */ const uint8_t * data = (const uint8_t *)key; while(len >= 4) { - uint32_t k = *(uint32_t *)data; + uint32_t k; + memcpy(&k, data, sizeof(k)); k *= m; k ^= k >> r; From bcdfe6b1b01cd41ec2125d937f14e85c0a1b53d3 Mon Sep 17 00:00:00 2001 From: Lizan Zhou Date: Fri, 15 Nov 2019 20:02:20 +0000 Subject: [PATCH 2/2] bazel: use canonical repository name for absl Signed-off-by: Lizan Zhou --- BUILD | 6 +++--- bazel/workspace_deps.bzl | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BUILD b/BUILD index ad85b202a9..e6e27f84e4 100644 --- a/BUILD +++ b/BUILD @@ -259,9 +259,9 @@ cc_library( "//conditions:default": CPPOPTS }), deps = [ - "@absl//absl/base:core_headers", - "@absl//absl/container:flat_hash_map", - "@absl//absl/strings", + "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/strings", "@com_google_protobuf//:protobuf", "@com_google_protobuf//:protoc_lib", ], diff --git a/bazel/workspace_deps.bzl b/bazel/workspace_deps.bzl index 39bf524a7a..b1c75db275 100644 --- a/bazel/workspace_deps.bzl +++ b/bazel/workspace_deps.bzl @@ -9,7 +9,7 @@ def upb_deps(): ) git_repository( - name = "absl", + name = "com_google_absl", commit = "070f6e47b33a2909d039e620c873204f78809492", remote = "https://github.com/abseil/abseil-cpp.git", shallow_since = "1541627663 -0500",