Skip to content

[libc] implement pathconf/fpathconf #87165

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 28 commits into from
Jul 7, 2024

Conversation

changkhothuychung
Copy link
Contributor

@changkhothuychung changkhothuychung commented Mar 30, 2024

Fix #86544

@llvmbot llvmbot added the libc label Mar 30, 2024
@llvmbot
Copy link
Member

llvmbot commented Mar 30, 2024

@llvm/pr-subscribers-libc

Author: Nhat Nguyen (changkhothuychung)

Changes

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

7 Files Affected:

  • (modified) libc/config/linux/aarch64/entrypoints.txt (+2)
  • (modified) libc/config/linux/riscv/entrypoints.txt (+2)
  • (modified) libc/config/linux/x86_64/entrypoints.txt (+2)
  • (modified) libc/src/unistd/CMakeLists.txt (+14)
  • (modified) libc/src/unistd/linux/CMakeLists.txt (+26)
  • (added) libc/src/unistd/linux/pathconf.cpp (+68)
  • (added) libc/src/unistd/pathconf.h (+20)
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 78da7f0b334b1f..be0c4bebfd95ad 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -282,6 +282,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.unistd.dup3
     libc.src.unistd.execve
     libc.src.unistd.fchdir
+    libc.src.unistd.fpathconf
     libc.src.unistd.fsync
     libc.src.unistd.ftruncate
     libc.src.unistd.getcwd
@@ -293,6 +294,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.unistd.link
     libc.src.unistd.linkat
     libc.src.unistd.lseek
+    libc.src.unistd.pathconf
     libc.src.unistd.pread
     libc.src.unistd.pwrite
     libc.src.unistd.read
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 5aae4e246cfb3c..2d8f9b1f6dd82c 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -287,6 +287,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.unistd.dup3
     libc.src.unistd.execve
     libc.src.unistd.fchdir
+    libc.src.unistd.fpathconf
     libc.src.unistd.fsync
     libc.src.unistd.ftruncate
     libc.src.unistd.getcwd
@@ -298,6 +299,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.unistd.link
     libc.src.unistd.linkat
     libc.src.unistd.lseek
+    libc.src.unistd.pathconf
     libc.src.unistd.pread
     libc.src.unistd.pwrite
     libc.src.unistd.read
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 5b428e51aee620..0f00f264ea1490 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -297,6 +297,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.unistd.dup3
     libc.src.unistd.execve
     libc.src.unistd.fchdir
+    libc.src.unistd.fpathconf
     libc.src.unistd.fsync
     libc.src.unistd.ftruncate
     libc.src.unistd.getcwd
@@ -308,6 +309,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.unistd.link
     libc.src.unistd.linkat
     libc.src.unistd.lseek
+    libc.src.unistd.pathconf
     libc.src.unistd.pread
     libc.src.unistd.pwrite
     libc.src.unistd.read
diff --git a/libc/src/unistd/CMakeLists.txt b/libc/src/unistd/CMakeLists.txt
index e22b0e1872caa1..20c87f668b381b 100644
--- a/libc/src/unistd/CMakeLists.txt
+++ b/libc/src/unistd/CMakeLists.txt
@@ -58,6 +58,13 @@ add_entrypoint_object(
     .${LIBC_TARGET_OS}.fork
 )
 
+add_entrypoint_object(
+  fpathconf
+  ALIAS
+  DEPENDS
+    .${LIBC_TARGET_OS}.fpathconf
+)
+
 add_entrypoint_object(
   execv
   ALIAS
@@ -149,6 +156,13 @@ add_entrypoint_object(
     .${LIBC_TARGET_OS}.lseek
 )
 
+add_entrypoint_object(
+  pathconf
+  ALIAS
+  DEPENDS
+    .${LIBC_TARGET_OS}.pathconf
+)
+
 add_entrypoint_object(
   pread
   ALIAS
diff --git a/libc/src/unistd/linux/CMakeLists.txt b/libc/src/unistd/linux/CMakeLists.txt
index df85d44e9e9edc..0ee59d5391ac5e 100644
--- a/libc/src/unistd/linux/CMakeLists.txt
+++ b/libc/src/unistd/linux/CMakeLists.txt
@@ -105,6 +105,19 @@ add_entrypoint_object(
     libc.src.errno.errno
 )
 
+add_entrypoint_object(
+  fpathconf
+  SRCS
+    fpathconf.cpp
+  HDRS
+    ../fpathconf.h
+  DEPENDS
+    libc.include.unistd
+    libc.include.sys_syscall
+    libc.src.__support.OSUtil.osutil
+    libc.src.errno.errno
+)
+
 add_entrypoint_object(
   execv
   SRCS
@@ -273,6 +286,19 @@ add_entrypoint_object(
     libc.src.errno.errno
 )
 
+add_entrypoint_object(
+  pathconf
+  SRCS
+  pathconf.cpp
+  HDRS
+    ../pathconf.h
+  DEPENDS
+    libc.include.unistd
+    libc.include.sys_syscall
+    libc.src.__support.OSUtil.osutil
+    libc.src.errno.errno
+)
+
 add_entrypoint_object(
   pread
   SRCS
diff --git a/libc/src/unistd/linux/pathconf.cpp b/libc/src/unistd/linux/pathconf.cpp
new file mode 100644
index 00000000000000..fed94e7d423716
--- /dev/null
+++ b/libc/src/unistd/linux/pathconf.cpp
@@ -0,0 +1,68 @@
+//===-- Linux implementation of pathconf ----------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/unistd/pread.h"
+
+#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
+#include "src/__support/common.h"
+#include "src/__support/macros/sanitizer.h" // for MSAN_UNPOISON
+#include "src/errno/libc_errno.h"
+#include <stdint.h> // For uint64_t.
+#include <sys/statvfs.h>
+#include <sys/syscall.h> // For syscall numbers.
+
+namespace LIBC_NAMESPACE {
+
+static long pathconfig(const struct statvfs &s, int name) {
+  switch (name) {
+  case _PC_LINK_MAX:
+    return _POSIX_LINK_MAX;
+
+  case _PC_MAX_CANON:
+    return _POSIX_MAX_CANON;
+
+  case _PC_MAX_INPUT:
+    return _POSIX_MAX_INPUT;
+
+  case _PC_NAME_MAX:
+    return _POSIX_NAME_MAX;
+
+  case _PC_PATH_MAX:
+    return _POSIX_PATH_MAX;
+
+  case _PC_PIPE_BUF:
+    return _POSIX_PIPE_BUF;
+
+  case _PC_CHOWN_RESTRICTED:
+    return _POSIX_CHOWN_RESTRICTED;
+
+  case _PC_NO_TRUNC:
+    return _POSIX_NO_TRUNC;
+
+  case _PC_VDISABLE:
+    return _POSIX_VDISABLE;
+  }
+}
+
+LLVM_LIBC_FUNCTION(long, pathconf, (char *path, int name)) {
+  struct statvfs sb;
+  if (statvfs(path, &sb) == -1) {
+    return -1;
+  }
+  return pathconfig(sb, name);
+}
+
+LLVM_LIBC_FUNCTION(long, fpathconf, (int fd, int name)) {
+  struct statvfs sb;
+  if (statvfs(path, &sb) == -1) {
+    return -1;
+  }
+  return pathconfig(sb, name);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/pathconf.h b/libc/src/unistd/pathconf.h
new file mode 100644
index 00000000000000..a397cd9323bbb8
--- /dev/null
+++ b/libc/src/unistd/pathconf.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for pathconf ----------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_UNISTD_PREAD_H
+#define LLVM_LIBC_SRC_UNISTD_PREAD_H
+
+#include <unistd.h>
+
+namespace LIBC_NAMESPACE {
+
+long pathconf(char *path, int name);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_UNISTD_PREAD_H

Copy link
Member

@nickdesaulniers nickdesaulniers left a comment

Choose a reason for hiding this comment

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

Thanks for the patch!

It needs tests.

@SchrodingerZhu
Copy link
Contributor

any update on this PR? I can PR my preferred changes to your branch if you would like to have them.

@changkhothuychung
Copy link
Contributor Author

any update on this PR? I can PR my preferred changes to your branch if you would like to have them.

sorry I was busy the past days, will resume on this one soon. But if this is in any urgency, please feel free to add your change .

@changkhothuychung
Copy link
Contributor Author

@SchrodingerZhu can you re-trigger the CI manually by any chance? my pushes dont seem to re-trigger the CI

@lntue
Copy link
Contributor

lntue commented Jun 17, 2024

Similarly, you need to examine all other header guards. I could see there are several other headers created by this PR having similar issues.

This is something clang-tidy should be able to catch. Maybe you can rerun your cmake with -DLLVM_LIBC_CLANG_TIDY=clang-tidy or the one with the same version you use for -DCMAKE_C_COMPILER

@SchrodingerZhu
Copy link
Contributor

@changkhothuychung locally under full build, there is another error (which I believe should be my fault).

[294/446] Building CXX object projects/libc/src/unis...std.linux.fpathconf.__internal__.dir/fpathconf.cpp.o
FAILED: projects/libc/src/unistd/linux/CMakeFiles/libc.src.unistd.linux.fpathconf.__internal__.dir/fpathconf.cpp.o 
ccache /usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_19_0_0_git -I/home/yifanzhu/llvm-project/build/projects/libc/src/unistd/linux -I/home/yifanzhu/llvm-project/libc/src/unistd/linux -I/home/yifanzhu/llvm-project/libc -isystem /home/yifanzhu/llvm-project/build/projects/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O2 -g -DNDEBUG -std=c++17 -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -MD -MT projects/libc/src/unistd/linux/CMakeFiles/libc.src.unistd.linux.fpathconf.__internal__.dir/fpathconf.cpp.o -MF projects/libc/src/unistd/linux/CMakeFiles/libc.src.unistd.linux.fpathconf.__internal__.dir/fpathconf.cpp.o.d -o projects/libc/src/unistd/linux/CMakeFiles/libc.src.unistd.linux.fpathconf.__internal__.dir/fpathconf.cpp.o -c /home/yifanzhu/llvm-project/libc/src/unistd/linux/fpathconf.cpp
In file included from /home/yifanzhu/llvm-project/libc/src/unistd/linux/fpathconf.cpp:12:
/home/yifanzhu/llvm-project/libc/src/sys/statvfs/linux/statfs_utils.h:12:10: fatal error: 'llvm-libc-types/struct_statvfs.h' file not found
   12 | #include "llvm-libc-types/struct_statvfs.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[300/446] Building CXX object projects/libc/src/unis...rc.unistd.linux.isatty.__internal__.dir/isatty.cpp.o
ninja: build stopped: subcommand failed.

Other than that everything looks good to me now.

A small patch for the fix:

From 66b281bc70410b7359c64dd2f2600f5878c51d6b Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <i@zhuyi.fan>
Date: Mon, 17 Jun 2024 22:49:46 -0700
Subject: [PATCH] fix build issue

---
 libc/src/sys/statvfs/linux/CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libc/src/sys/statvfs/linux/CMakeLists.txt b/libc/src/sys/statvfs/linux/CMakeLists.txt
index f818863bb470..a6660c02badf 100644
--- a/libc/src/sys/statvfs/linux/CMakeLists.txt
+++ b/libc/src/sys/statvfs/linux/CMakeLists.txt
@@ -8,6 +8,7 @@ add_header_library(
     libc.src.__support.common
     libc.src.__support.CPP.optional
     libc.include.sys_syscall
+    libc.include.llvm-libc-types.struct_statvfs
 )
 
 add_entrypoint_object(
-- 
2.45.2

Copy link
Contributor

@SchrodingerZhu SchrodingerZhu left a comment

Choose a reason for hiding this comment

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

LGTM.

@@ -10,6 +10,7 @@
#include "hdr/limits_macros.h"
#include "hdr/sys_stat_macros.h"
#include "hdr/unistd_macros.h"
#include "llvm-libc-macros/sys-stat-macros.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have to add this to pass the compilation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I remember not having it will cause CI error. Do you wanna double check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, can you help me merge when you see everything is ok? thanks.

Copy link
Contributor

@SchrodingerZhu SchrodingerZhu Jul 4, 2024

Choose a reason for hiding this comment

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

You already have hdr/sys_stat_macros.h so you should not include llvm-libc-macros/sys-stat-macros.h.
Then you should also remove libc.include.llvm-libc-macros.sys-stat-macros from the dependency list.

hdr/sys_stat_macros.h is called proxy header. Once you have that, you should not use the internal llvm-libc-macros/sys-stat-macros.h

@izaakschroeder izaakschroeder mentioned this pull request Jul 3, 2024
39 tasks
@SchrodingerZhu
Copy link
Contributor

Ok. I see this error. I will be investigating it.

@SchrodingerZhu
Copy link
Contributor

I reproduced the error locally. This is very interesting. The LINK_MAX is right there in the header.

@SchrodingerZhu
Copy link
Contributor

SchrodingerZhu commented Jul 6, 2024

Please consider apply this patch to fix the build issue:

From 18c25535427ed01e30379d0209706e447515978c Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <i@zhuyi.fan>
Date: Sat, 6 Jul 2024 16:18:13 -0700
Subject: [PATCH] fix

---
 libc/src/unistd/linux/pathconf_utils.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libc/src/unistd/linux/pathconf_utils.cpp b/libc/src/unistd/linux/pathconf_utils.cpp
index 5112d2e907cc..c764b7f20a74 100644
--- a/libc/src/unistd/linux/pathconf_utils.cpp
+++ b/libc/src/unistd/linux/pathconf_utils.cpp
@@ -6,12 +6,18 @@
 //
 //===----------------------------------------------------------------------===//
 
+// This header must go before limits_macros.h otherwise libc header may choose
+// to undefine LINK_MAX.
+#include <linux/limits.h> // For LINK_MAX and other limits
+
 #include "hdr/limits_macros.h"
 #include "hdr/unistd_macros.h"
 #include "src/__support/OSUtil/syscall.h" // For internal syscall function.
 #include "src/__support/common.h"
 #include "src/errno/libc_errno.h"
 #include "src/sys/statvfs/linux/statfs_utils.h"
+
+// other linux specific includes
 #include <linux/bfs_fs.h>
 #if __has_include(<linux/ufs_fs.h>)
 #include <linux/ufs_fs.h>
@@ -19,8 +25,7 @@
 // from https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/
 #define UFS_MAGIC 0x00011954
 #endif
-#include <linux/limits.h> // For LINK_MAX and other limits
-#include <linux/magic.h>  // For common FS magics
+#include <linux/magic.h> // For common FS magics
 
 namespace LIBC_NAMESPACE {
 
-- 
2.45.2

@SchrodingerZhu SchrodingerZhu merged commit 7f3c40a into llvm:main Jul 7, 2024
6 checks passed
@SchrodingerZhu
Copy link
Contributor

Thank you for your patch!

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 7, 2024

LLVM Buildbot has detected a new failure on builder premerge-monolithic-linux running on premerge-linux-1 while building libc at step 6 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/2201

Here is the relevant piece of the build log for the reference:

Step 6 (build-unified-tree) failure: build (failure)
...
13.963 [6116/58/5964] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/Expr.cpp.o
13.986 [6115/58/5965] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenACC.cpp.o
13.988 [6114/58/5966] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenCL.cpp.o
14.022 [6113/58/5967] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOverload.cpp.o
14.036 [6112/58/5968] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaPPC.cpp.o
14.076 [6111/58/5969] Building CXX object tools/clang/tools/extra/clang-tidy/concurrency/CMakeFiles/obj.clangTidyConcurrencyModule.dir/ThreadCanceltypeAsynchronousCheck.cpp.o
14.099 [6110/58/5970] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaAttr.cpp.o
14.130 [6109/58/5971] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaCast.cpp.o
14.131 [6108/58/5972] Building CXX object tools/clang/tools/extra/clangd/tool/CMakeFiles/obj.clangdMain.dir/ClangdMain.cpp.o
14.131 [6107/58/5973] Building CXX object tools/flang/lib/Optimizer/Dialect/CUF/CMakeFiles/obj.CUFDialect.dir/CUFOps.cpp.o
FAILED: tools/flang/lib/Optimizer/Dialect/CUF/CMakeFiles/obj.CUFDialect.dir/CUFOps.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/clang++ -DBUILD_EXAMPLES -DFLANG_INCLUDE_TESTS=1 -DFLANG_LITTLE_ENDIAN=1 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/build/buildbot/premerge-monolithic-linux/build/tools/flang/lib/Optimizer/Dialect/CUF -I/build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Optimizer/Dialect/CUF -I/build/buildbot/premerge-monolithic-linux/llvm-project/flang/include -I/build/buildbot/premerge-monolithic-linux/build/tools/flang/include -I/build/buildbot/premerge-monolithic-linux/build/include -I/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include -isystem /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/../mlir/include -isystem /build/buildbot/premerge-monolithic-linux/build/tools/mlir/include -isystem /build/buildbot/premerge-monolithic-linux/build/tools/clang/include -isystem /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/../clang/include -gmlt -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-string-conversion -Wno-ctad-maybe-unsupported -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/flang/lib/Optimizer/Dialect/CUF/CMakeFiles/obj.CUFDialect.dir/CUFOps.cpp.o -MF tools/flang/lib/Optimizer/Dialect/CUF/CMakeFiles/obj.CUFDialect.dir/CUFOps.cpp.o.d -o tools/flang/lib/Optimizer/Dialect/CUF/CMakeFiles/obj.CUFDialect.dir/CUFOps.cpp.o -c /build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Optimizer/Dialect/CUF/CUFOps.cpp
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Optimizer/Dialect/CUF/CUFOps.cpp:16:
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/include/flang/Optimizer/Dialect/FIRAttr.h:162:10: fatal error: 'flang/Optimizer/Dialect/FIREnumAttr.h.inc' file not found
#include "flang/Optimizer/Dialect/FIREnumAttr.h.inc"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
14.136 [6107/57/5974] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/CodeCompleteConsumer.cpp.o
14.146 [6107/56/5975] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaCUDA.cpp.o
14.150 [6107/55/5976] Building CXX object tools/clang/tools/extra/clang-include-fixer/find-all-symbols/CMakeFiles/obj.findAllSymbols.dir/FindAllSymbolsAction.cpp.o
14.151 [6107/54/5977] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaCoroutine.cpp.o
14.152 [6107/53/5978] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaSYCL.cpp.o
14.155 [6107/52/5979] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaStmtAttr.cpp.o
14.176 [6107/51/5980] Building CXX object tools/clang/tools/extra/clangd/tool/CMakeFiles/obj.clangdMain.dir/Check.cpp.o
14.180 [6107/50/5981] Building CXX object tools/clang/tools/extra/clang-tidy/llvm/CMakeFiles/obj.clangTidyLLVMModule.dir/HeaderGuardCheck.cpp.o
14.198 [6107/49/5982] Building CXX object tools/clang/tools/extra/clang-doc/CMakeFiles/obj.clangDoc.dir/ClangDoc.cpp.o
14.200 [6107/48/5983] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaFixItUtils.cpp.o
14.200 [6107/47/5984] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExprMember.cpp.o
14.202 [6107/46/5985] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/Sema.cpp.o
14.216 [6107/45/5986] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDecl.cpp.o
14.238 [6107/44/5987] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/AnalysisBasedWarnings.cpp.o
14.243 [6107/43/5988] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaAvailability.cpp.o
14.253 [6107/42/5989] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaCodeComplete.cpp.o
14.281 [6107/41/5990] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaConcept.cpp.o
14.295 [6107/40/5991] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExprObjC.cpp.o
14.310 [6107/39/5992] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaLookup.cpp.o
14.317 [6107/38/5993] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclCXX.cpp.o
14.336 [6107/37/5994] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaModule.cpp.o
14.347 [6107/36/5995] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExprCXX.cpp.o
14.374 [6107/35/5996] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaObjCProperty.cpp.o
14.390 [6107/34/5997] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExpr.cpp.o
14.420 [6107/33/5998] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaPseudoObject.cpp.o
14.440 [6107/32/5999] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o
14.448 [6107/31/6000] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaObjC.cpp.o
14.477 [6107/30/6001] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o
14.481 [6107/29/6002] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaStmtAsm.cpp.o
14.544 [6107/28/6003] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaStmt.cpp.o
14.549 [6107/27/6004] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaRISCV.cpp.o
14.560 [6107/26/6005] Building X86GenDAGISel.inc...

@SchrodingerZhu
Copy link
Contributor

This does not seem to be related to the changes inside this patch.

@mikhailramalho
Copy link
Member

folks, this patch broke rv32 compilation: https://lab.llvm.org/staging/#/builders/149/builds/8399
Here's the error:

/home/mgadelha/tools/llvm-project/libc/src/sys/statvfs/linux/statfs_utils.h:80:21: error: implicit conversion loses integer precision: 'const __u64' (aka 'const unsigned long long') to 'fsblkcnt_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
   80 |   out.f_blocks = in.f_blocks;
      |                ~ ~~~^~~~~~~~
/home/mgadelha/tools/llvm-project/libc/src/sys/statvfs/linux/statfs_utils.h:81:20: error: implicit conversion loses integer precision: 'const __u64' (aka 'const unsigned long long') to 'fsblkcnt_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
   81 |   out.f_bfree = in.f_bfree;
      |               ~ ~~~^~~~~~~
/home/mgadelha/tools/llvm-project/libc/src/sys/statvfs/linux/statfs_utils.h:82:21: error: implicit conversion loses integer precision: 'const __u64' (aka 'const unsigned long long') to 'fsblkcnt_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
   82 |   out.f_bavail = in.f_bavail;
      |                ~ ~~~^~~~~~~~
/home/mgadelha/tools/llvm-project/libc/src/sys/statvfs/linux/statfs_utils.h:83:20: error: implicit conversion loses integer precision: 'const __u64' (aka 'const unsigned long long') to 'fsfilcnt_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
   83 |   out.f_files = in.f_files;
      |               ~ ~~~^~~~~~~
/home/mgadelha/tools/llvm-project/libc/src/sys/statvfs/linux/statfs_utils.h:84:20: error: implicit conversion loses integer precision: 'const __u64' (aka 'const unsigned long long') to 'fsfilcnt_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
   84 |   out.f_ffree = in.f_ffree;
      |               ~ ~~~^~~~~~~
/home/mgadelha/tools/llvm-project/libc/src/sys/statvfs/linux/statfs_utils.h:85:21: error: implicit conversion loses integer precision: 'const __u64' (aka 'const unsigned long long') to 'fsfilcnt_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
   85 |   out.f_favail = in.f_ffree;
      |                ~ ~~~^~~~~~~
/home/mgadelha/tools/llvm-project/libc/src/sys/statvfs/linux/statfs_utils.h:87:68: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
   87 |                static_cast<decltype(out.f_fsid)>(in.f_fsid.val[1]) << 32;
      |                                                                    ^  ~~
7 errors generated.

May I ask if you can take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[libc] implement pathconf/fpathconf
7 participants