[llvm] [Bazel] Define BUILTIN_THREAD_POINTER where appropriate on x86-64 linux (PR #74574)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 8 13:10:33 PST 2023


https://github.com/boomanaiden154 updated https://github.com/llvm/llvm-project/pull/74574

>From b466404686d8e4c2bdbfc671428c2e39d96fa639 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <agrossman154 at yahoo.com>
Date: Wed, 6 Dec 2023 01:00:30 -0800
Subject: [PATCH 1/2] [Bazel] Define BUILTIN_THREAD_POINTER where appropriate
 on x86-64 linux

This patch defines BUILTIN_THREAD_POINTER in config.bzl when appropriate
on x86-64 linux only. This is needed to build exegesis properly as certain
functionality breaks if this is not enabled. This option is only
supported on relatively recent compiler versions, but given most people
using the bazel build are using very recent toolchains, this shouldn't
be an issue.
---
 utils/bazel/llvm-project-overlay/llvm/config.bzl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utils/bazel/llvm-project-overlay/llvm/config.bzl b/utils/bazel/llvm-project-overlay/llvm/config.bzl
index b15ec9e1bb399a..6cbe2b735d8c55 100644
--- a/utils/bazel/llvm-project-overlay/llvm/config.bzl
+++ b/utils/bazel/llvm-project-overlay/llvm/config.bzl
@@ -94,7 +94,7 @@ llvm_config_defines = os_defines + select({
     "@bazel_tools//src/conditions:linux_aarch64": native_arch_defines("AArch64", "aarch64-unknown-linux-gnu"),
     "@bazel_tools//src/conditions:linux_ppc64le": native_arch_defines("PowerPC", "powerpc64le-unknown-linux-gnu"),
     "@bazel_tools//src/conditions:linux_s390x": native_arch_defines("SystemZ", "systemz-unknown-linux_gnu"),
-    "//conditions:default": native_arch_defines("X86", "x86_64-unknown-linux-gnu"),
+    "//conditions:default": native_arch_defines("X86", "x86_64-unknown-linux-gnu") + ["HAVE_BUILTIN_THREAD_POINTER"],
 }) + [
     "LLVM_VERSION_MAJOR={}".format(LLVM_VERSION_MAJOR),
     "LLVM_VERSION_MINOR={}".format(LLVM_VERSION_MINOR),

>From bee0ac98465d0cb84ebe20a1a525940ff40cd7c9 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <agrossman154 at yahoo.com>
Date: Fri, 8 Dec 2023 13:10:24 -0800
Subject: [PATCH 2/2] Add comment

---
 utils/bazel/llvm-project-overlay/llvm/config.bzl | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/utils/bazel/llvm-project-overlay/llvm/config.bzl b/utils/bazel/llvm-project-overlay/llvm/config.bzl
index 6cbe2b735d8c55..b516a9905d4dab 100644
--- a/utils/bazel/llvm-project-overlay/llvm/config.bzl
+++ b/utils/bazel/llvm-project-overlay/llvm/config.bzl
@@ -94,6 +94,9 @@ llvm_config_defines = os_defines + select({
     "@bazel_tools//src/conditions:linux_aarch64": native_arch_defines("AArch64", "aarch64-unknown-linux-gnu"),
     "@bazel_tools//src/conditions:linux_ppc64le": native_arch_defines("PowerPC", "powerpc64le-unknown-linux-gnu"),
     "@bazel_tools//src/conditions:linux_s390x": native_arch_defines("SystemZ", "systemz-unknown-linux_gnu"),
+    # HAVE_BUILTIN_THREAD_POINTER is true for on x86-64 Linux for all recent
+    # toolchains. Add it here by default as we can't perfomr a configure time
+    # check.
     "//conditions:default": native_arch_defines("X86", "x86_64-unknown-linux-gnu") + ["HAVE_BUILTIN_THREAD_POINTER"],
 }) + [
     "LLVM_VERSION_MAJOR={}".format(LLVM_VERSION_MAJOR),



More information about the llvm-commits mailing list