Skip to content

[bazel] add vdso dependency to time_linux lib #108647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 13, 2024
Merged

[bazel] add vdso dependency to time_linux lib #108647

merged 1 commit into from
Sep 13, 2024

Conversation

pranavk
Copy link
Contributor

@pranavk pranavk commented Sep 13, 2024

This is a quick fix to unbreak Bazel build. The right solution would probably add vdso.cpp in the support library which includes circular dependency and needs more restructuring.

@llvmbot llvmbot added libc bazel "Peripheral" support tier build system: utils/bazel labels Sep 13, 2024
@llvmbot
Copy link
Member

llvmbot commented Sep 13, 2024

@llvm/pr-subscribers-libc

Author: Pranav Kant (pranavk)

Changes

This is a quick fix to unbreak Bazel build. The right solution would probably add vdso.cpp in the support library which includes circular dependency and needs more restructuring.


Full diff: https://github.com/llvm/llvm-project/pull/108647.diff

1 Files Affected:

  • (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+56)
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 4646aef95f949c..834d309b82001d 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -162,6 +162,11 @@ libc_support_library(
     hdrs = ["hdr/types/clockid_t.h"],
 )
 
+libc_support_library(
+    name = "types_clock_t",
+    hdrs = ["hdr/types/clock_t.h"],
+)
+
 libc_support_library(
     name = "types_fenv_t",
     hdrs = ["hdr/types/fenv_t.h"],
@@ -192,6 +197,11 @@ libc_support_library(
     hdrs = ["hdr/types/time_t.h"],
 )
 
+libc_support_library(
+    name = "types_struct_timeval",
+    hdrs = ["hdr/types/struct_timeval.h"],
+)
+
 libc_support_library(
     name = "types_pid_t",
     hdrs = ["hdr/types/pid_t.h"],
@@ -1070,6 +1080,32 @@ libc_support_library(
     ],
 )
 
+libc_support_library(
+    name = "__support_osutil_vdso",
+    hdrs = [
+        "src/__support/OSUtil/linux/vdso.h",
+        "src/__support/OSUtil/linux/vdso_sym.h"
+    ],
+    textual_hdrs = [
+        "src/__support/OSUtil/linux/riscv/vdso.h",
+        "src/__support/OSUtil/linux/arm/vdso.h",
+        "src/__support/OSUtil/linux/x86_64/vdso.h",
+        "src/__support/OSUtil/linux/aarch64/vdso.h",
+    ],
+    target_compatible_with = select({
+        "@platforms//os:linux": [],
+        "//conditions:default": ["@platforms//:incompatible"],
+    }),
+    deps = [
+        ":__support_cpp_array",
+        ":__support_cpp_optional",
+        ":__support_cpp_string_view",
+        ":__support_threads_callonce",
+        ":types_clock_t",
+        ":types_struct_timeval"
+    ],
+)
+
 libc_support_library(
     name = "__support_osutil_io",
     hdrs = ["src/__support/OSUtil/io.h"],
@@ -1212,6 +1248,25 @@ libc_support_library(
     ],
 )
 
+
+libc_support_library(
+    name = "__support_threads_callonce",
+    hdrs = [
+        "src/__support/threads/callonce.h",
+    ],
+    target_compatible_with = select({
+        "@platforms//os:linux": [],
+        "//conditions:default": ["@platforms//:incompatible"],
+    }),
+    textual_hdrs = [
+        "src/__support/threads/linux/callonce.h",
+    ],
+    deps = [
+        ":__support_macros_config",
+        ":__support_macros_optimization"
+    ],
+)
+
 libc_support_library(
     name = "__support_time",
     hdrs = glob(["src/__support/time/*.h"]),
@@ -1234,6 +1289,7 @@ libc_support_library(
         ":__support_cpp_expected",
         ":__support_error_or",
         ":__support_libc_assert",
+        ":__support_osutil_vdso",
         ":__support_time",
         ":hdr_time_macros",
         ":types_clockid_t",

Copy link
Member

@keith keith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice thanks, I started working on this too and stopped at the circular dependency since I'm not familiar with the code at all

@pranavk pranavk merged commit a592e4b into llvm:main Sep 13, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bazel "Peripheral" support tier build system: utils/bazel libc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants