authorgravatar for public+git@mearie.orgKang Seonghoon <public+git@mearie.org> 2023-08-24 18:26:27+09:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-06-05 22:43:54-07:00
log5293bdfe636a619a460ca547cc9e4dfa254d7d42
tree61fcf7f858689d5f3bf6040ee69be2d0cd32bd6b
parentfd8b50ca5caffb099686a7d8de5941ec339d43ca

glibc patch: 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.

10 files changed, 532 insertions(+), 0 deletions(-)

lib/libc/glibc/io/fstat-2.32.c created+55
...@@ -0,0 +1,55 @@
1/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 In addition to the permissions in the GNU Lesser General Public
10 License, the Free Software Foundation gives you unlimited
11 permission to link the compiled version of this file with other
12 programs, and to distribute those programs without any restriction
13 coming from the use of this file. (The GNU Lesser General Public
14 License restrictions do apply in other respects; for example, they
15 cover modification of the file, and distribution when not linked
16 into another program.)
17
18 Note that people who make modified versions of this file are not
19 obligated to grant this special exception for their modified
20 versions; it is their choice whether to do so. The GNU Lesser
21 General Public License gives permission to release a modified
22 version without this exception; this exception also makes it
23 possible to release a modified version which carries forward this
24 exception.
25
26 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 Lesser General Public License for more details.
30
31 You should have received a copy of the GNU Lesser General Public
32 License along with the GNU C Library; if not, see
33 <https://www.gnu.org/licenses/>. */
34
35#include <sys/stat.h>
36
37/* This definition is only used if inlining fails for this function; see
38 the last page of <sys/stat.h>. The real work is done by the `x'
39 function which is passed a version number argument. We arrange in the
40 makefile that when not inlined this function is always statically
41 linked; that way a dynamically-linked executable always encodes the
42 version number corresponding to the data structures it uses, so the `x'
43 functions in the shared library can adapt without needing to recompile
44 all callers. */
45
46#undef fstat
47#undef __fstat
48int
49attribute_hidden
50__fstat (int fd, struct stat *buf)
51{
52 return __fxstat (_STAT_VER, fd, buf);
53}
54
55weak_hidden_alias (__fstat, fstat)
lib/libc/glibc/io/fstat64-2.32.c created+52
...@@ -0,0 +1,52 @@
1/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 In addition to the permissions in the GNU Lesser General Public
10 License, the Free Software Foundation gives you unlimited
11 permission to link the compiled version of this file with other
12 programs, and to distribute those programs without any restriction
13 coming from the use of this file. (The GNU Lesser General Public
14 License restrictions do apply in other respects; for example, they
15 cover modification of the file, and distribution when not linked
16 into another program.)
17
18 Note that people who make modified versions of this file are not
19 obligated to grant this special exception for their modified
20 versions; it is their choice whether to do so. The GNU Lesser
21 General Public License gives permission to release a modified
22 version without this exception; this exception also makes it
23 possible to release a modified version which carries forward this
24 exception.
25
26 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 Lesser General Public License for more details.
30
31 You should have received a copy of the GNU Lesser General Public
32 License along with the GNU C Library; if not, see
33 <https://www.gnu.org/licenses/>. */
34
35#include <sys/stat.h>
36
37/* This definition is only used if inlining fails for this function; see
38 the last page of <sys/stat.h>. The real work is done by the `x'
39 function which is passed a version number argument. We arrange in the
40 makefile that when not inlined this function is always statically
41 linked; that way a dynamically-linked executable always encodes the
42 version number corresponding to the data structures it uses, so the `x'
43 functions in the shared library can adapt without needing to recompile
44 all callers. */
45
46#undef fstat64
47int
48attribute_hidden
49fstat64 (int fd, struct stat64 *buf)
50{
51 return __fxstat64 (_STAT_VER, fd, buf);
52}
lib/libc/glibc/io/fstatat-2.32.c created+52
...@@ -0,0 +1,52 @@
1/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 In addition to the permissions in the GNU Lesser General Public
10 License, the Free Software Foundation gives you unlimited
11 permission to link the compiled version of this file with other
12 programs, and to distribute those programs without any restriction
13 coming from the use of this file. (The GNU Lesser General Public
14 License restrictions do apply in other respects; for example, they
15 cover modification of the file, and distribution when not linked
16 into another program.)
17
18 Note that people who make modified versions of this file are not
19 obligated to grant this special exception for their modified
20 versions; it is their choice whether to do so. The GNU Lesser
21 General Public License gives permission to release a modified
22 version without this exception; this exception also makes it
23 possible to release a modified version which carries forward this
24 exception.
25
26 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 Lesser General Public License for more details.
30
31 You should have received a copy of the GNU Lesser General Public
32 License along with the GNU C Library; if not, see
33 <https://www.gnu.org/licenses/>. */
34
35#include <sys/stat.h>
36
37/* This definition is only used if inlining fails for this function; see
38 the last page of <sys/stat.h>. The real work is done by the `x'
39 function which is passed a version number argument. We arrange in the
40 makefile that when not inlined this function is always statically
41 linked; that way a dynamically-linked executable always encodes the
42 version number corresponding to the data structures it uses, so the `x'
43 functions in the shared library can adapt without needing to recompile
44 all callers. */
45
46#undef fstatat
47int
48attribute_hidden
49fstatat (int fd, const char *file, struct stat *buf, int flag)
50{
51 return __fxstatat (_STAT_VER, fd, file, buf, flag);
52}
lib/libc/glibc/io/fstatat64-2.32.c created+52
...@@ -0,0 +1,52 @@
1/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 In addition to the permissions in the GNU Lesser General Public
10 License, the Free Software Foundation gives you unlimited
11 permission to link the compiled version of this file with other
12 programs, and to distribute those programs without any restriction
13 coming from the use of this file. (The GNU Lesser General Public
14 License restrictions do apply in other respects; for example, they
15 cover modification of the file, and distribution when not linked
16 into another program.)
17
18 Note that people who make modified versions of this file are not
19 obligated to grant this special exception for their modified
20 versions; it is their choice whether to do so. The GNU Lesser
21 General Public License gives permission to release a modified
22 version without this exception; this exception also makes it
23 possible to release a modified version which carries forward this
24 exception.
25
26 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 Lesser General Public License for more details.
30
31 You should have received a copy of the GNU Lesser General Public
32 License along with the GNU C Library; if not, see
33 <https://www.gnu.org/licenses/>. */
34
35#include <sys/stat.h>
36
37/* This definition is only used if inlining fails for this function; see
38 the last page of <sys/stat.h>. The real work is done by the `x'
39 function which is passed a version number argument. We arrange in the
40 makefile that when not inlined this function is always statically
41 linked; that way a dynamically-linked executable always encodes the
42 version number corresponding to the data structures it uses, so the `x'
43 functions in the shared library can adapt without needing to recompile
44 all callers. */
45
46#undef fstatat64
47int
48attribute_hidden
49fstatat64 (int fd, const char *file, struct stat64 *buf, int flag)
50{
51 return __fxstatat64 (_STAT_VER, fd, file, buf, flag);
52}
lib/libc/glibc/io/lstat-2.32.c created+55
...@@ -0,0 +1,55 @@
1/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 In addition to the permissions in the GNU Lesser General Public
10 License, the Free Software Foundation gives you unlimited
11 permission to link the compiled version of this file with other
12 programs, and to distribute those programs without any restriction
13 coming from the use of this file. (The GNU Lesser General Public
14 License restrictions do apply in other respects; for example, they
15 cover modification of the file, and distribution when not linked
16 into another program.)
17
18 Note that people who make modified versions of this file are not
19 obligated to grant this special exception for their modified
20 versions; it is their choice whether to do so. The GNU Lesser
21 General Public License gives permission to release a modified
22 version without this exception; this exception also makes it
23 possible to release a modified version which carries forward this
24 exception.
25
26 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 Lesser General Public License for more details.
30
31 You should have received a copy of the GNU Lesser General Public
32 License along with the GNU C Library; if not, see
33 <https://www.gnu.org/licenses/>. */
34
35#include <sys/stat.h>
36
37/* This definition is only used if inlining fails for this function; see
38 the last page of <sys/stat.h>. The real work is done by the `x'
39 function which is passed a version number argument. We arrange in the
40 makefile that when not inlined this function is always statically
41 linked; that way a dynamically-linked executable always encodes the
42 version number corresponding to the data structures it uses, so the `x'
43 functions in the shared library can adapt without needing to recompile
44 all callers. */
45
46#undef lstat
47#undef __lstat
48int
49attribute_hidden
50__lstat (const char *file, struct stat *buf)
51{
52 return __lxstat (_STAT_VER, file, buf);
53}
54
55weak_hidden_alias (__lstat, lstat)
lib/libc/glibc/io/lstat64-2.32.c created+52
...@@ -0,0 +1,52 @@
1/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 In addition to the permissions in the GNU Lesser General Public
10 License, the Free Software Foundation gives you unlimited
11 permission to link the compiled version of this file with other
12 programs, and to distribute those programs without any restriction
13 coming from the use of this file. (The GNU Lesser General Public
14 License restrictions do apply in other respects; for example, they
15 cover modification of the file, and distribution when not linked
16 into another program.)
17
18 Note that people who make modified versions of this file are not
19 obligated to grant this special exception for their modified
20 versions; it is their choice whether to do so. The GNU Lesser
21 General Public License gives permission to release a modified
22 version without this exception; this exception also makes it
23 possible to release a modified version which carries forward this
24 exception.
25
26 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 Lesser General Public License for more details.
30
31 You should have received a copy of the GNU Lesser General Public
32 License along with the GNU C Library; if not, see
33 <https://www.gnu.org/licenses/>. */
34
35#include <sys/stat.h>
36
37/* This definition is only used if inlining fails for this function; see
38 the last page of <sys/stat.h>. The real work is done by the `x'
39 function which is passed a version number argument. We arrange in the
40 makefile that when not inlined this function is always statically
41 linked; that way a dynamically-linked executable always encodes the
42 version number corresponding to the data structures it uses, so the `x'
43 functions in the shared library can adapt without needing to recompile
44 all callers. */
45
46#undef lstat64
47int
48attribute_hidden
49lstat64 (const char *file, struct stat64 *buf)
50{
51 return __lxstat64 (_STAT_VER, file, buf);
52}
lib/libc/glibc/io/mknod-2.32.c created+55
...@@ -0,0 +1,55 @@
1/* Copyright (C) 1995-2020 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 In addition to the permissions in the GNU Lesser General Public
10 License, the Free Software Foundation gives you unlimited
11 permission to link the compiled version of this file with other
12 programs, and to distribute those programs without any restriction
13 coming from the use of this file. (The GNU Lesser General Public
14 License restrictions do apply in other respects; for example, they
15 cover modification of the file, and distribution when not linked
16 into another program.)
17
18 Note that people who make modified versions of this file are not
19 obligated to grant this special exception for their modified
20 versions; it is their choice whether to do so. The GNU Lesser
21 General Public License gives permission to release a modified
22 version without this exception; this exception also makes it
23 possible to release a modified version which carries forward this
24 exception.
25
26 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 Lesser General Public License for more details.
30
31 You should have received a copy of the GNU Lesser General Public
32 License along with the GNU C Library; if not, see
33 <https://www.gnu.org/licenses/>. */
34
35
36#include <sys/types.h>
37#include <sys/stat.h>
38
39/* This definition is only used if inlining fails for this function; see
40 the last page of <sys/stat.h>. The real work is done by the `x'
41 function which is passed a version number argument. We arrange in the
42 makefile that when not inlined this function is always statically
43 linked; that way a dynamically-linked executable always encodes the
44 version number corresponding to the data structures it uses, so the `x'
45 functions in the shared library can adapt without needing to recompile
46 all callers. */
47
48int
49attribute_hidden
50__mknod (const char *path, mode_t mode, dev_t dev)
51{
52 return __xmknod (_MKNOD_VER, path, mode, &dev);
53}
54
55weak_hidden_alias (__mknod, mknod)
lib/libc/glibc/io/mknodat-2.32.c created+53
...@@ -0,0 +1,53 @@
1/* Copyright (C) 1995-2020 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 In addition to the permissions in the GNU Lesser General Public
10 License, the Free Software Foundation gives you unlimited
11 permission to link the compiled version of this file with other
12 programs, and to distribute those programs without any restriction
13 coming from the use of this file. (The GNU Lesser General Public
14 License restrictions do apply in other respects; for example, they
15 cover modification of the file, and distribution when not linked
16 into another program.)
17
18 Note that people who make modified versions of this file are not
19 obligated to grant this special exception for their modified
20 versions; it is their choice whether to do so. The GNU Lesser
21 General Public License gives permission to release a modified
22 version without this exception; this exception also makes it
23 possible to release a modified version which carries forward this
24 exception.
25
26 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 Lesser General Public License for more details.
30
31 You should have received a copy of the GNU Lesser General Public
32 License along with the GNU C Library; if not, see
33 <https://www.gnu.org/licenses/>. */
34
35
36#include <sys/types.h>
37#include <sys/stat.h>
38
39/* This definition is only used if inlining fails for this function; see
40 the last page of <sys/stat.h>. The real work is done by the `x'
41 function which is passed a version number argument. We arrange in the
42 makefile that when not inlined this function is always statically
43 linked; that way a dynamically-linked executable always encodes the
44 version number corresponding to the data structures it uses, so the `x'
45 functions in the shared library can adapt without needing to recompile
46 all callers. */
47
48int
49attribute_hidden
50mknodat (int fd, const char *path, mode_t mode, dev_t dev)
51{
52 return __xmknodat (_MKNOD_VER, fd, path, mode, &dev);
53}
lib/libc/glibc/io/stat-2.32.c created+54
...@@ -0,0 +1,54 @@
1/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 In addition to the permissions in the GNU Lesser General Public
10 License, the Free Software Foundation gives you unlimited
11 permission to link the compiled version of this file with other
12 programs, and to distribute those programs without any restriction
13 coming from the use of this file. (The GNU Lesser General Public
14 License restrictions do apply in other respects; for example, they
15 cover modification of the file, and distribution when not linked
16 into another program.)
17
18 Note that people who make modified versions of this file are not
19 obligated to grant this special exception for their modified
20 versions; it is their choice whether to do so. The GNU Lesser
21 General Public License gives permission to release a modified
22 version without this exception; this exception also makes it
23 possible to release a modified version which carries forward this
24 exception.
25
26 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 Lesser General Public License for more details.
30
31 You should have received a copy of the GNU Lesser General Public
32 License along with the GNU C Library; if not, see
33 <https://www.gnu.org/licenses/>. */
34
35#include <sys/stat.h>
36
37/* This definition is only used if inlining fails for this function; see
38 the last page of <sys/stat.h>. The real work is done by the `x'
39 function which is passed a version number argument. We arrange in the
40 makefile that when not inlined this function is always statically
41 linked; that way a dynamically-linked executable always encodes the
42 version number corresponding to the data structures it uses, so the `x'
43 functions in the shared library can adapt without needing to recompile
44 all callers. */
45
46#undef stat
47int
48attribute_hidden
49__stat (const char *file, struct stat *buf)
50{
51 return __xstat (_STAT_VER, file, buf);
52}
53
54weak_hidden_alias (__stat, stat)
lib/libc/glibc/io/stat64-2.32.c created+52
...@@ -0,0 +1,52 @@
1/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 In addition to the permissions in the GNU Lesser General Public
10 License, the Free Software Foundation gives you unlimited
11 permission to link the compiled version of this file with other
12 programs, and to distribute those programs without any restriction
13 coming from the use of this file. (The GNU Lesser General Public
14 License restrictions do apply in other respects; for example, they
15 cover modification of the file, and distribution when not linked
16 into another program.)
17
18 Note that people who make modified versions of this file are not
19 obligated to grant this special exception for their modified
20 versions; it is their choice whether to do so. The GNU Lesser
21 General Public License gives permission to release a modified
22 version without this exception; this exception also makes it
23 possible to release a modified version which carries forward this
24 exception.
25
26 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 Lesser General Public License for more details.
30
31 You should have received a copy of the GNU Lesser General Public
32 License along with the GNU C Library; if not, see
33 <https://www.gnu.org/licenses/>. */
34
35#include <sys/stat.h>
36
37/* This definition is only used if inlining fails for this function; see
38 the last page of <sys/stat.h>. The real work is done by the `x'
39 function which is passed a version number argument. We arrange in the
40 makefile that when not inlined this function is always statically
41 linked; that way a dynamically-linked executable always encodes the
42 version number corresponding to the data structures it uses, so the `x'
43 functions in the shared library can adapt without needing to recompile
44 all callers. */
45
46#undef stat64
47int
48attribute_hidden
49stat64 (const char *file, struct stat64 *buf)
50{
51 return __xstat64 (_STAT_VER, file, buf);
52}