From 029be165f7d0d5609cb18ed4675cc98128ce7bb8 Mon Sep 17 00:00:00 2001 From: Kang Seonghoon Date: Thu, 24 Aug 2023 18:26:27 +0900 Subject: [PATCH 1/2] glibc: get correct files compiled into libc_nonshared.a The scope of libc_nonshared.a was greatly changed in glibc 2.33 and 2.34, but only the change from 2.34 was reflected so far. Glibc 2.33 finally switched to versioned symbols for stat functions, meaning that libc_nonshared.a no longer contains them since 2.33. Relevant files were therefore reverted to 2.32 versions and renamed accordingly. This commit also removes errno.c, which was probably added to libc_nonshared.a based on a wrong assumption that glibc/include/errno.h requires glibc/csu/errno.c. In reality errno.h should refer to __libc_errno (not to be confused with the public __errno_location), which should be imported from libc.so. The inclusion of errno.c resulted in wrong compile options as well; this commit fixes them as well. Fixes #16152 --- lib/libc/glibc/io/fstat-2.32.c | 55 ++++++++++++++++++++ lib/libc/glibc/io/fstat64-2.32.c | 52 +++++++++++++++++++ lib/libc/glibc/io/fstatat-2.32.c | 52 +++++++++++++++++++ lib/libc/glibc/io/fstatat64-2.32.c | 52 +++++++++++++++++++ lib/libc/glibc/io/lstat-2.32.c | 55 ++++++++++++++++++++ lib/libc/glibc/io/lstat64-2.32.c | 52 +++++++++++++++++++ lib/libc/glibc/io/mknod-2.32.c | 55 ++++++++++++++++++++ lib/libc/glibc/io/mknodat-2.32.c | 53 +++++++++++++++++++ lib/libc/glibc/io/stat-2.32.c | 54 ++++++++++++++++++++ lib/libc/glibc/io/stat64-2.32.c | 52 +++++++++++++++++++ src/glibc.zig | 82 +++++++++++++++++------------- 11 files changed, 579 insertions(+), 35 deletions(-) create mode 100644 lib/libc/glibc/io/fstat-2.32.c create mode 100644 lib/libc/glibc/io/fstat64-2.32.c create mode 100644 lib/libc/glibc/io/fstatat-2.32.c create mode 100644 lib/libc/glibc/io/fstatat64-2.32.c create mode 100644 lib/libc/glibc/io/lstat-2.32.c create mode 100644 lib/libc/glibc/io/lstat64-2.32.c create mode 100644 lib/libc/glibc/io/mknod-2.32.c create mode 100644 lib/libc/glibc/io/mknodat-2.32.c create mode 100644 lib/libc/glibc/io/stat-2.32.c create mode 100644 lib/libc/glibc/io/stat64-2.32.c diff --git a/lib/libc/glibc/io/fstat-2.32.c b/lib/libc/glibc/io/fstat-2.32.c new file mode 100644 index 000000000000..6ce077dc4ae2 --- /dev/null +++ b/lib/libc/glibc/io/fstat-2.32.c @@ -0,0 +1,55 @@ +/* Copyright (C) 1996-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +#undef fstat +#undef __fstat +int +attribute_hidden +__fstat (int fd, struct stat *buf) +{ + return __fxstat (_STAT_VER, fd, buf); +} + +weak_hidden_alias (__fstat, fstat) diff --git a/lib/libc/glibc/io/fstat64-2.32.c b/lib/libc/glibc/io/fstat64-2.32.c new file mode 100644 index 000000000000..c4dd3acd6046 --- /dev/null +++ b/lib/libc/glibc/io/fstat64-2.32.c @@ -0,0 +1,52 @@ +/* Copyright (C) 1996-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +#undef fstat64 +int +attribute_hidden +fstat64 (int fd, struct stat64 *buf) +{ + return __fxstat64 (_STAT_VER, fd, buf); +} diff --git a/lib/libc/glibc/io/fstatat-2.32.c b/lib/libc/glibc/io/fstatat-2.32.c new file mode 100644 index 000000000000..edc773487abf --- /dev/null +++ b/lib/libc/glibc/io/fstatat-2.32.c @@ -0,0 +1,52 @@ +/* Copyright (C) 2005-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +#undef fstatat +int +attribute_hidden +fstatat (int fd, const char *file, struct stat *buf, int flag) +{ + return __fxstatat (_STAT_VER, fd, file, buf, flag); +} diff --git a/lib/libc/glibc/io/fstatat64-2.32.c b/lib/libc/glibc/io/fstatat64-2.32.c new file mode 100644 index 000000000000..b57133bd9093 --- /dev/null +++ b/lib/libc/glibc/io/fstatat64-2.32.c @@ -0,0 +1,52 @@ +/* Copyright (C) 2005-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +#undef fstatat64 +int +attribute_hidden +fstatat64 (int fd, const char *file, struct stat64 *buf, int flag) +{ + return __fxstatat64 (_STAT_VER, fd, file, buf, flag); +} diff --git a/lib/libc/glibc/io/lstat-2.32.c b/lib/libc/glibc/io/lstat-2.32.c new file mode 100644 index 000000000000..7134741106d7 --- /dev/null +++ b/lib/libc/glibc/io/lstat-2.32.c @@ -0,0 +1,55 @@ +/* Copyright (C) 1996-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +#undef lstat +#undef __lstat +int +attribute_hidden +__lstat (const char *file, struct stat *buf) +{ + return __lxstat (_STAT_VER, file, buf); +} + +weak_hidden_alias (__lstat, lstat) diff --git a/lib/libc/glibc/io/lstat64-2.32.c b/lib/libc/glibc/io/lstat64-2.32.c new file mode 100644 index 000000000000..a890da71a853 --- /dev/null +++ b/lib/libc/glibc/io/lstat64-2.32.c @@ -0,0 +1,52 @@ +/* Copyright (C) 1996-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +#undef lstat64 +int +attribute_hidden +lstat64 (const char *file, struct stat64 *buf) +{ + return __lxstat64 (_STAT_VER, file, buf); +} diff --git a/lib/libc/glibc/io/mknod-2.32.c b/lib/libc/glibc/io/mknod-2.32.c new file mode 100644 index 000000000000..ac968292303d --- /dev/null +++ b/lib/libc/glibc/io/mknod-2.32.c @@ -0,0 +1,55 @@ +/* Copyright (C) 1995-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + + +#include +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +int +attribute_hidden +__mknod (const char *path, mode_t mode, dev_t dev) +{ + return __xmknod (_MKNOD_VER, path, mode, &dev); +} + +weak_hidden_alias (__mknod, mknod) diff --git a/lib/libc/glibc/io/mknodat-2.32.c b/lib/libc/glibc/io/mknodat-2.32.c new file mode 100644 index 000000000000..65c9f1aa9c2d --- /dev/null +++ b/lib/libc/glibc/io/mknodat-2.32.c @@ -0,0 +1,53 @@ +/* Copyright (C) 1995-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + + +#include +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +int +attribute_hidden +mknodat (int fd, const char *path, mode_t mode, dev_t dev) +{ + return __xmknodat (_MKNOD_VER, fd, path, mode, &dev); +} diff --git a/lib/libc/glibc/io/stat-2.32.c b/lib/libc/glibc/io/stat-2.32.c new file mode 100644 index 000000000000..8c3cd877c8c3 --- /dev/null +++ b/lib/libc/glibc/io/stat-2.32.c @@ -0,0 +1,54 @@ +/* Copyright (C) 1996-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +#undef stat +int +attribute_hidden +__stat (const char *file, struct stat *buf) +{ + return __xstat (_STAT_VER, file, buf); +} + +weak_hidden_alias (__stat, stat) diff --git a/lib/libc/glibc/io/stat64-2.32.c b/lib/libc/glibc/io/stat64-2.32.c new file mode 100644 index 000000000000..8b6b662f3ac4 --- /dev/null +++ b/lib/libc/glibc/io/stat64-2.32.c @@ -0,0 +1,52 @@ +/* Copyright (C) 1996-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +#undef stat64 +int +attribute_hidden +stat64 (const char *file, struct stat64 *buf) +{ + return __xstat64 (_STAT_VER, file, buf); +} diff --git a/src/glibc.zig b/src/glibc.zig index 2321063166b4..707ba32929d6 100644 --- a/src/glibc.zig +++ b/src/glibc.zig @@ -172,6 +172,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr const target = comp.getTarget(); const target_ver = target.os.version_range.linux.glibc; + const nonshared_stat = target_ver.order(.{ .major = 2, .minor = 32, .patch = 0 }) != .gt; const start_old_init_fini = target_ver.order(.{ .major = 2, .minor = 33, .patch = 0 }) != .gt; // In all cases in this function, we add the C compiler flags to @@ -271,54 +272,72 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr }, .libc_nonshared_a => { const s = path.sep_str; - const linux_prefix = lib_libc_glibc ++ - "sysdeps" ++ s ++ "unix" ++ s ++ "sysv" ++ s ++ "linux" ++ s; - const Flavor = enum { nonshared, shared }; const Dep = struct { path: []const u8, - flavor: Flavor = .shared, - exclude: bool = false, + include: bool = true, }; const deps = [_]Dep{ + .{ .path = lib_libc_glibc ++ "stdlib" ++ s ++ "atexit.c" }, + .{ .path = lib_libc_glibc ++ "stdlib" ++ s ++ "at_quick_exit.c" }, + .{ .path = lib_libc_glibc ++ "sysdeps" ++ s ++ "pthread" ++ s ++ "pthread_atfork.c" }, + .{ .path = lib_libc_glibc ++ "debug" ++ s ++ "stack_chk_fail_local.c" }, + + // libc_nonshared.a redirected stat functions to xstat until glibc 2.33, + // when they were finally versioned like other symbols. + .{ + .path = lib_libc_glibc ++ "io" ++ s ++ "stat-2.32.c", + .include = nonshared_stat, + }, + .{ + .path = lib_libc_glibc ++ "io" ++ s ++ "fstat-2.32.c", + .include = nonshared_stat, + }, + .{ + .path = lib_libc_glibc ++ "io" ++ s ++ "lstat-2.32.c", + .include = nonshared_stat, + }, .{ - .path = lib_libc_glibc ++ "stdlib" ++ s ++ "atexit.c", - .flavor = .nonshared, + .path = lib_libc_glibc ++ "io" ++ s ++ "stat64-2.32.c", + .include = nonshared_stat, }, .{ - .path = lib_libc_glibc ++ "stdlib" ++ s ++ "at_quick_exit.c", - .flavor = .nonshared, + .path = lib_libc_glibc ++ "io" ++ s ++ "fstat64-2.32.c", + .include = nonshared_stat, }, .{ - .path = lib_libc_glibc ++ "sysdeps" ++ s ++ "pthread" ++ s ++ "pthread_atfork.c", - .flavor = .nonshared, + .path = lib_libc_glibc ++ "io" ++ s ++ "lstat64-2.32.c", + .include = nonshared_stat, }, .{ - .path = lib_libc_glibc ++ "debug" ++ s ++ "stack_chk_fail_local.c", - .flavor = .nonshared, + .path = lib_libc_glibc ++ "io" ++ s ++ "fstatat-2.32.c", + .include = nonshared_stat, }, - .{ .path = lib_libc_glibc ++ "csu" ++ s ++ "errno.c" }, + .{ + .path = lib_libc_glibc ++ "io" ++ s ++ "fstatat64-2.32.c", + .include = nonshared_stat, + }, + .{ + .path = lib_libc_glibc ++ "io" ++ s ++ "mknodat-2.32.c", + .include = nonshared_stat, + }, + .{ + .path = lib_libc_glibc ++ "io" ++ s ++ "mknod-2.32.c", + .include = nonshared_stat, + }, + + // __libc_start_main used to require statically linked init/fini callbacks + // until glibc 2.34 when they were assimilated into the shared library. .{ .path = lib_libc_glibc ++ "csu" ++ s ++ "elf-init-2.33.c", - .exclude = !start_old_init_fini, + .include = start_old_init_fini, }, - .{ .path = linux_prefix ++ "stat.c" }, - .{ .path = linux_prefix ++ "fstat.c" }, - .{ .path = linux_prefix ++ "lstat.c" }, - .{ .path = linux_prefix ++ "stat64.c" }, - .{ .path = linux_prefix ++ "fstat64.c" }, - .{ .path = linux_prefix ++ "lstat64.c" }, - .{ .path = linux_prefix ++ "fstatat.c" }, - .{ .path = linux_prefix ++ "fstatat64.c" }, - .{ .path = linux_prefix ++ "mknodat.c" }, - .{ .path = lib_libc_glibc ++ "io" ++ s ++ "mknod.c" }, - .{ .path = linux_prefix ++ "stat_t64_cp.c" }, }; var files_buf: [deps.len]Compilation.CSourceFile = undefined; var files_index: usize = 0; for (deps) |dep| { - if (dep.exclude) continue; + if (!dep.include) continue; var args = std.ArrayList([]const u8).init(arena); try args.appendSlice(&[_][]const u8{ @@ -342,13 +361,6 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr try args.append("-DCAN_USE_REGISTER_ASM_EBP"); } - const shared_def = switch (dep.flavor) { - .nonshared => "-DLIBC_NONSHARED=1", - // glibc passes `-DSHARED` for these. However, empirically if - // we do that here we will see undefined symbols such as `__GI_memcpy`. - // So we pass the same thing as for nonshared. - .shared => "-DLIBC_NONSHARED=1", - }; try args.appendSlice(&[_][]const u8{ "-D_LIBC_REENTRANT", "-include", @@ -358,7 +370,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr "-include", try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-symbols.h"), "-DPIC", - shared_def, + "-DLIBC_NONSHARED=1", "-DTOP_NAMESPACE=glibc", }); files_buf[files_index] = .{ From 982bbc2753241b8271d058a3d1bc84037d84bd94 Mon Sep 17 00:00:00 2001 From: Kang Seonghoon Date: Thu, 24 Aug 2023 19:56:16 +0900 Subject: [PATCH 2/2] glibc: remove unused stat-related files for 2.33+ Effectively reverts 3dcd3612dca6f649a1e05f558c5d6ed462d2e4a4. --- .../unix/sysv/linux/alpha/kernel_stat.h | 91 ------------------- .../sysdeps/unix/sysv/linux/arm/kernel_stat.h | 40 -------- .../unix/sysv/linux/hppa/kernel_stat.h | 36 -------- .../unix/sysv/linux/i386/kernel_stat.h | 40 -------- .../glibc/sysdeps/unix/sysv/linux/kstat_cp.h | 2 - .../unix/sysv/linux/m68k/kernel_stat.h | 40 -------- .../unix/sysv/linux/mips/kernel_stat.h | 75 --------------- .../sysv/linux/s390/s390-32/kernel_stat.h | 40 -------- .../sysdeps/unix/sysv/linux/sh/kernel_stat.h | 40 -------- .../sysv/linux/sparc/sparc32/kernel_stat.h | 37 -------- .../sysv/linux/sparc/sparc64/kernel_stat.h | 58 ------------ 11 files changed, 499 deletions(-) delete mode 100644 lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/kernel_stat.h delete mode 100644 lib/libc/glibc/sysdeps/unix/sysv/linux/arm/kernel_stat.h delete mode 100644 lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/kernel_stat.h delete mode 100644 lib/libc/glibc/sysdeps/unix/sysv/linux/i386/kernel_stat.h delete mode 100644 lib/libc/glibc/sysdeps/unix/sysv/linux/kstat_cp.h delete mode 100644 lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/kernel_stat.h delete mode 100644 lib/libc/glibc/sysdeps/unix/sysv/linux/mips/kernel_stat.h delete mode 100644 lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h delete mode 100644 lib/libc/glibc/sysdeps/unix/sysv/linux/sh/kernel_stat.h delete mode 100644 lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h delete mode 100644 lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/kernel_stat.h deleted file mode 100644 index a292920969b2..000000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/kernel_stat.h +++ /dev/null @@ -1,91 +0,0 @@ -/* Definition of `struct stat' used in the kernel. */ -struct kernel_stat - { - unsigned int st_dev; - unsigned int st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_rdev; - long int st_size; - unsigned long int st_atime_sec; - unsigned long int st_mtime_sec; - unsigned long int st_ctime_sec; - unsigned int st_blksize; - int st_blocks; - unsigned int st_flags; - unsigned int st_gen; - }; - -/* Definition of `struct stat64' used in the kernel. */ -struct kernel_stat64 - { - unsigned long st_dev; - unsigned long st_ino; - unsigned long st_rdev; - long st_size; - unsigned long st_blocks; - - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_blksize; - unsigned int st_nlink; - unsigned int __pad0; - - unsigned long st_atime_sec; - unsigned long st_atimensec; - unsigned long st_mtime_sec; - unsigned long st_mtimensec; - unsigned long st_ctime_sec; - unsigned long st_ctimensec; - long __glibc_reserved[3]; - }; - -/* Definition of `struct stat' used by glibc 2.0. */ -struct glibc2_stat - { - __dev_t st_dev; - __ino_t st_ino; - __mode_t st_mode; - __nlink_t st_nlink; - __uid_t st_uid; - __gid_t st_gid; - __dev_t st_rdev; - __off_t st_size; - __time_t st_atime_sec; - __time_t st_mtime_sec; - __time_t st_ctime_sec; - unsigned int st_blksize; - int st_blocks; - unsigned int st_flags; - unsigned int st_gen; - }; - -/* Definition of `struct stat' used by glibc 2.1. */ -struct glibc21_stat - { - __dev_t st_dev; - __ino64_t st_ino; - __mode_t st_mode; - __nlink_t st_nlink; - __uid_t st_uid; - __gid_t st_gid; - __dev_t st_rdev; - __off_t st_size; - __time_t st_atime_sec; - __time_t st_mtime_sec; - __time_t st_ctime_sec; - __blkcnt64_t st_blocks; - __blksize_t st_blksize; - unsigned int st_flags; - unsigned int st_gen; - int __pad3; - long __glibc_reserved[4]; - }; - -#define STAT_IS_KERNEL_STAT 0 -#define STAT64_IS_KERNEL_STAT64 1 -#define XSTAT_IS_XSTAT64 1 -#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/kernel_stat.h deleted file mode 100644 index b1bc1459f08e..000000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/kernel_stat.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Definition of `struct stat' used in the kernel.. */ -struct kernel_stat - { - unsigned short int st_dev; - unsigned short int __pad1; -#define _HAVE___PAD1 - unsigned long int st_ino; - unsigned short int st_mode; - unsigned short int st_nlink; - unsigned short int st_uid; - unsigned short int st_gid; - unsigned short int st_rdev; - unsigned short int __pad2; -#define _HAVE___PAD2 - unsigned long int st_size; - unsigned long int st_blksize; - unsigned long int st_blocks; - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - unsigned long int __glibc_reserved4; -#define _HAVE___UNUSED4 - unsigned long int __glibc_reserved5; -#define _HAVE___UNUSED5 - }; - -#define _HAVE_STAT___UNUSED4 -#define _HAVE_STAT___UNUSED5 -#define _HAVE_STAT___PAD1 -#define _HAVE_STAT___PAD2 -#define _HAVE_STAT_NSEC -#define _HAVE_STAT64___PAD1 -#define _HAVE_STAT64___PAD2 -#define _HAVE_STAT64___ST_INO -#define _HAVE_STAT64_NSEC - -#define STAT_IS_KERNEL_STAT 0 -#define STAT64_IS_KERNEL_STAT64 1 -#define XSTAT_IS_XSTAT64 0 -#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/kernel_stat.h deleted file mode 100644 index e8ad135e7023..000000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/kernel_stat.h +++ /dev/null @@ -1,36 +0,0 @@ -/* definition of "struct stat" from the kernel */ -struct kernel_stat { - unsigned long st_dev; /* dev_t is 32 bits on parisc */ - unsigned long st_ino; /* 32 bits */ - unsigned short st_mode; /* 16 bits */ - unsigned short st_nlink; /* 16 bits */ - unsigned short st_reserved1; /* old st_uid */ - unsigned short st_reserved2; /* old st_gid */ - unsigned long st_rdev; - unsigned long st_size; - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - long st_blksize; - long st_blocks; - unsigned long __glibc_reserved1; /* ACL stuff */ - unsigned long __glibc_reserved2; /* network */ - unsigned long __glibc_reserved3; /* network */ - unsigned long __glibc_reserved4; /* cnodes */ - unsigned short __glibc_reserved5; /* netsite */ - short st_fstype; - unsigned long st_realdev; - unsigned short st_basemode; - unsigned short st_spareshort; - unsigned long st_uid; - unsigned long st_gid; - unsigned long st_spare4[3]; -}; - -#define _HAVE_STAT_NSEC -#define _HAVE_STAT64_NSEC - -#define STAT_IS_KERNEL_STAT 0 -#define STAT64_IS_KERNEL_STAT64 1 -#define XSTAT_IS_XSTAT64 0 -#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/kernel_stat.h deleted file mode 100644 index b1bc1459f08e..000000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/kernel_stat.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Definition of `struct stat' used in the kernel.. */ -struct kernel_stat - { - unsigned short int st_dev; - unsigned short int __pad1; -#define _HAVE___PAD1 - unsigned long int st_ino; - unsigned short int st_mode; - unsigned short int st_nlink; - unsigned short int st_uid; - unsigned short int st_gid; - unsigned short int st_rdev; - unsigned short int __pad2; -#define _HAVE___PAD2 - unsigned long int st_size; - unsigned long int st_blksize; - unsigned long int st_blocks; - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - unsigned long int __glibc_reserved4; -#define _HAVE___UNUSED4 - unsigned long int __glibc_reserved5; -#define _HAVE___UNUSED5 - }; - -#define _HAVE_STAT___UNUSED4 -#define _HAVE_STAT___UNUSED5 -#define _HAVE_STAT___PAD1 -#define _HAVE_STAT___PAD2 -#define _HAVE_STAT_NSEC -#define _HAVE_STAT64___PAD1 -#define _HAVE_STAT64___PAD2 -#define _HAVE_STAT64___ST_INO -#define _HAVE_STAT64_NSEC - -#define STAT_IS_KERNEL_STAT 0 -#define STAT64_IS_KERNEL_STAT64 1 -#define XSTAT_IS_XSTAT64 0 -#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/kstat_cp.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/kstat_cp.h deleted file mode 100644 index 69397db0d2ee..000000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/kstat_cp.h +++ /dev/null @@ -1,2 +0,0 @@ -/* Empty, it is overridden by an architecture which might require copy to or - from a kernel_stat stat struct to glibc export stat{64}. */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/kernel_stat.h deleted file mode 100644 index b1bc1459f08e..000000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/kernel_stat.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Definition of `struct stat' used in the kernel.. */ -struct kernel_stat - { - unsigned short int st_dev; - unsigned short int __pad1; -#define _HAVE___PAD1 - unsigned long int st_ino; - unsigned short int st_mode; - unsigned short int st_nlink; - unsigned short int st_uid; - unsigned short int st_gid; - unsigned short int st_rdev; - unsigned short int __pad2; -#define _HAVE___PAD2 - unsigned long int st_size; - unsigned long int st_blksize; - unsigned long int st_blocks; - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - unsigned long int __glibc_reserved4; -#define _HAVE___UNUSED4 - unsigned long int __glibc_reserved5; -#define _HAVE___UNUSED5 - }; - -#define _HAVE_STAT___UNUSED4 -#define _HAVE_STAT___UNUSED5 -#define _HAVE_STAT___PAD1 -#define _HAVE_STAT___PAD2 -#define _HAVE_STAT_NSEC -#define _HAVE_STAT64___PAD1 -#define _HAVE_STAT64___PAD2 -#define _HAVE_STAT64___ST_INO -#define _HAVE_STAT64_NSEC - -#define STAT_IS_KERNEL_STAT 0 -#define STAT64_IS_KERNEL_STAT64 1 -#define XSTAT_IS_XSTAT64 0 -#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/kernel_stat.h deleted file mode 100644 index 19524f7ea442..000000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/kernel_stat.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef _KERNEL_STAT_H -#define _KERNEL_STAT_H - -#include -/* As tempting as it is to define XSTAT_IS_XSTAT64 for n64, the - userland data structures are not identical, because of different - padding. */ -/* Definition of `struct stat' used in the kernel. */ -#if _MIPS_SIM != _ABIO32 -struct kernel_stat - { - unsigned int st_dev; - unsigned int __pad1[3]; - unsigned long long st_ino; - unsigned int st_mode; - unsigned int st_nlink; - int st_uid; - int st_gid; - unsigned int st_rdev; - unsigned int __pad2[3]; - long long st_size; - unsigned int st_atime_sec; - unsigned int st_atime_nsec; - unsigned int st_mtime_sec; - unsigned int st_mtime_nsec; - unsigned int st_ctime_sec; - unsigned int st_ctime_nsec; - unsigned int st_blksize; - unsigned int __pad3; - unsigned long long st_blocks; - }; -#else -struct kernel_stat - { - unsigned long int st_dev; - long int __pad1[3]; /* Reserved for network id */ - unsigned long int st_ino; - unsigned long int st_mode; - unsigned long int st_nlink; - long int st_uid; - long int st_gid; - unsigned long int st_rdev; - long int __pad2[2]; - long int st_size; - long int __pad3; - unsigned int st_atime_sec; - unsigned int st_atime_nsec; - unsigned int st_mtime_sec; - unsigned int st_mtime_nsec; - unsigned int st_ctime_sec; - unsigned int st_ctime_nsec; - long int st_blksize; - long int st_blocks; - char st_fstype[16]; /* Filesystem type name, unsupported */ - long st_pad4[8]; - /* Linux specific fields */ - unsigned int st_flags; - unsigned int st_gen; - }; -#endif - -#define STAT_IS_KERNEL_STAT 0 -#define STAT64_IS_KERNEL_STAT64 0 -#define XSTAT_IS_XSTAT64 0 -#if _MIPS_SIM == _ABI64 -# define STATFS_IS_STATFS64 1 -#else -# define STATFS_IS_STATFS64 0 -#endif -/* MIPS64 has unsigned 32 bit timestamps fields, so use statx as well. */ -#if _MIPS_SIM == _ABI64 -# define STAT_HAS_TIME32 -#endif - -#endif diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h deleted file mode 100644 index b1bc1459f08e..000000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Definition of `struct stat' used in the kernel.. */ -struct kernel_stat - { - unsigned short int st_dev; - unsigned short int __pad1; -#define _HAVE___PAD1 - unsigned long int st_ino; - unsigned short int st_mode; - unsigned short int st_nlink; - unsigned short int st_uid; - unsigned short int st_gid; - unsigned short int st_rdev; - unsigned short int __pad2; -#define _HAVE___PAD2 - unsigned long int st_size; - unsigned long int st_blksize; - unsigned long int st_blocks; - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - unsigned long int __glibc_reserved4; -#define _HAVE___UNUSED4 - unsigned long int __glibc_reserved5; -#define _HAVE___UNUSED5 - }; - -#define _HAVE_STAT___UNUSED4 -#define _HAVE_STAT___UNUSED5 -#define _HAVE_STAT___PAD1 -#define _HAVE_STAT___PAD2 -#define _HAVE_STAT_NSEC -#define _HAVE_STAT64___PAD1 -#define _HAVE_STAT64___PAD2 -#define _HAVE_STAT64___ST_INO -#define _HAVE_STAT64_NSEC - -#define STAT_IS_KERNEL_STAT 0 -#define STAT64_IS_KERNEL_STAT64 1 -#define XSTAT_IS_XSTAT64 0 -#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sh/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sh/kernel_stat.h deleted file mode 100644 index b1bc1459f08e..000000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/sh/kernel_stat.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Definition of `struct stat' used in the kernel.. */ -struct kernel_stat - { - unsigned short int st_dev; - unsigned short int __pad1; -#define _HAVE___PAD1 - unsigned long int st_ino; - unsigned short int st_mode; - unsigned short int st_nlink; - unsigned short int st_uid; - unsigned short int st_gid; - unsigned short int st_rdev; - unsigned short int __pad2; -#define _HAVE___PAD2 - unsigned long int st_size; - unsigned long int st_blksize; - unsigned long int st_blocks; - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - unsigned long int __glibc_reserved4; -#define _HAVE___UNUSED4 - unsigned long int __glibc_reserved5; -#define _HAVE___UNUSED5 - }; - -#define _HAVE_STAT___UNUSED4 -#define _HAVE_STAT___UNUSED5 -#define _HAVE_STAT___PAD1 -#define _HAVE_STAT___PAD2 -#define _HAVE_STAT_NSEC -#define _HAVE_STAT64___PAD1 -#define _HAVE_STAT64___PAD2 -#define _HAVE_STAT64___ST_INO -#define _HAVE_STAT64_NSEC - -#define STAT_IS_KERNEL_STAT 0 -#define STAT64_IS_KERNEL_STAT64 1 -#define XSTAT_IS_XSTAT64 0 -#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h deleted file mode 100644 index 4a2df42d375e..000000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Definition of `struct stat' used in the kernel */ -struct kernel_stat - { - unsigned short int st_dev; - unsigned long int st_ino; - unsigned short int st_mode; - short int st_nlink; - unsigned short int st_uid; - unsigned short int st_gid; - unsigned short int st_rdev; - long int st_size; - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - long int st_blksize; - long int st_blocks; - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; - }; - -#define _HAVE___UNUSED4 -#define _HAVE___UNUSED5 - -#define _HAVE_STAT___UNUSED4 -#define _HAVE_STAT___UNUSED5 -#define _HAVE_STAT___PAD1 -#define _HAVE_STAT___PAD2 -#define _HAVE_STAT64___UNUSED4 -#define _HAVE_STAT64___UNUSED5 -#define _HAVE_STAT64___PAD2 -#define _HAVE_STAT_NSEC -#define _HAVE_STAT64_NSEC - -#define STAT_IS_KERNEL_STAT 0 -#define STAT64_IS_KERNEL_STAT64 1 -#define XSTAT_IS_XSTAT64 0 -#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h deleted file mode 100644 index 29d18908da92..000000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef _KERNEL_STAT_H -#define _KERNEL_STAT_H - -/* Definition of `struct stat' used in the kernel */ -struct kernel_stat - { - unsigned int st_dev; - unsigned long int st_ino; - unsigned int st_mode; - short int st_nlink; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_rdev; - long int st_size; - long int st_atime_sec; - long int st_mtime_sec; - long int st_ctime_sec; - long int st_blksize; - long int st_blocks; - unsigned long int __glibc_reserved1; - unsigned long int __glibc_reserved2; - }; - -/* Definition of `struct stat64' used in the kernel. */ -struct kernel_stat64 - { - unsigned long int st_dev; - unsigned long int st_ino; - unsigned long int st_nlink; - - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int __pad0; - - unsigned long int st_rdev; - long int st_size; - long int st_blksize; - long int st_blocks; - - unsigned long int st_atime_sec; - unsigned long int st_atime_nsec; - unsigned long int st_mtime_sec; - unsigned long int st_mtime_nsec; - unsigned long int st_ctime_sec; - unsigned long int st_ctime_nsec; - long int __glibc_reserved[3]; - }; - -#define STAT_IS_KERNEL_STAT 0 -#define STAT64_IS_KERNEL_STAT64 0 -#define XSTAT_IS_XSTAT64 1 -#ifdef __arch64__ -# define STATFS_IS_STATFS64 1 -#else -# define STATFS_IS_STATFS64 0 -#endif -#endif /* _KERNEL_STAT_H */