[llvm] [libc][bazel] Move libc namespace definition to its own file (PR #68563)
Guillaume Chatelet via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 9 01:36:55 PDT 2023
https://github.com/gchatelet created https://github.com/llvm/llvm-project/pull/68563
None
>From 132323ae793340510e47a73639864121ac949a2a Mon Sep 17 00:00:00 2001
From: Guillaume Chatelet <gchatelet at google.com>
Date: Mon, 9 Oct 2023 08:36:15 +0000
Subject: [PATCH] [libc][bazel] Move libc namespace definition to its own file
---
.../llvm-project-overlay/libc/BUILD.bazel | 24 ++-----------------
.../libc/libc_namespace.bzl | 4 ++++
2 files changed, 6 insertions(+), 22 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/libc_namespace.bzl
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 6fc4be39b063f07..e48933aef998715 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -10,9 +10,9 @@ load(
"libc_support_library",
)
load(":platforms.bzl", "PLATFORM_CPU_ARM64", "PLATFORM_CPU_X86_64")
+load(":libc_namespace.bzl", "LIBC_NAMESPACE")
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag")
-load("//:vars.bzl", "LLVM_VERSION_MAJOR", "LLVM_VERSION_MINOR", "LLVM_VERSION_PATCH")
package(
default_visibility = ["//visibility:public"],
@@ -63,23 +63,6 @@ config_setting(
flag_values = {":mpfr": "system"},
)
-default_libc_namespace = "__llvm_libc_{}_{}_{}_git".format(LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR, LLVM_VERSION_PATCH)
-
-release_libc_namespace = "__llvm_libc"
-
-# When set, The ':libc_root' target below will define 'LIBC_NAMESPACE' to
-# 'release_libc_namespace' instead of 'default_libc_namespace'.
-# Usage: `-- at llvm-project//libc:release`.
-bool_flag(
- name = "release",
- build_setting_default = False,
-)
-
-config_setting(
- name = "use_release_namespace",
- flag_values = {":release": "true"},
-)
-
# This empty root library helps us add an include path to this directory
# using the 'includes' attribute. The strings listed in the includes attribute
# are relative paths wrt this library but are inherited by the dependents
@@ -87,10 +70,7 @@ config_setting(
# paths of the kind "../../" to other libc targets.
cc_library(
name = "libc_root",
- defines = select({
- ":use_release_namespace": ["LIBC_NAMESPACE=" + release_libc_namespace],
- "//conditions:default": ["LIBC_NAMESPACE=" + default_libc_namespace],
- }),
+ defines = ["LIBC_NAMESPACE=" + LIBC_NAMESPACE],
includes = ["."],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/libc_namespace.bzl b/utils/bazel/llvm-project-overlay/libc/libc_namespace.bzl
new file mode 100644
index 000000000000000..8cbac6c624c6e1e
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/libc_namespace.bzl
@@ -0,0 +1,4 @@
+load("//:vars.bzl", "LLVM_VERSION_MAJOR", "LLVM_VERSION_MINOR", "LLVM_VERSION_PATCH")
+
+# The default libc namespace that encloses all functions.
+LIBC_NAMESPACE = "__llvm_libc_{}_{}_{}_git".format(LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR, LLVM_VERSION_PATCH)
More information about the llvm-commits
mailing list