-
Notifications
You must be signed in to change notification settings - Fork 521
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
978 additions
and
7,558 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
packages/glibc/0001-cdefs-Limit-definition-of-fortification-macros.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
From 020b43544a26237d752eae4a715c403f29226542 Mon Sep 17 00:00:00 2001 | ||
From: Siddhesh Poyarekar <siddhesh@sourceware.org> | ||
Date: Thu, 2 Feb 2023 07:49:02 -0500 | ||
Subject: [PATCH 1/8] cdefs: Limit definition of fortification macros | ||
|
||
Define the __glibc_fortify and other macros only when __FORTIFY_LEVEL > | ||
0. This has the effect of not defining these macros on older C90 | ||
compilers that do not have support for variable length argument lists. | ||
|
||
Also trim off the trailing backslashes from the definition of | ||
__glibc_fortify and __glibc_fortify_n macros. | ||
|
||
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> | ||
Reviewed-by: Florian Weimer <fweimer@redhat.com> | ||
(cherry picked from commit 2337e04e21ba6040926ec871e403533f77043c40) | ||
--- | ||
misc/sys/cdefs.h | 6 ++++-- | ||
1 file changed, 4 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h | ||
index 66d6702123..c37a3ff637 100644 | ||
--- a/misc/sys/cdefs.h | ||
+++ b/misc/sys/cdefs.h | ||
@@ -152,6 +152,7 @@ | ||
# define __glibc_objsize(__o) __bos (__o) | ||
#endif | ||
|
||
+#if __USE_FORTIFY_LEVEL > 0 | ||
/* Compile time conditions to choose between the regular, _chk and _chk_warn | ||
variants. These conditions should get evaluated to constant and optimized | ||
away. */ | ||
@@ -187,7 +188,7 @@ | ||
? __ ## f ## _alias (__VA_ARGS__) \ | ||
: (__glibc_unsafe_len (__l, __s, __osz) \ | ||
? __ ## f ## _chk_warn (__VA_ARGS__, __osz) \ | ||
- : __ ## f ## _chk (__VA_ARGS__, __osz))) \ | ||
+ : __ ## f ## _chk (__VA_ARGS__, __osz))) | ||
|
||
/* Fortify function f, where object size argument passed to f is the number of | ||
elements and not total size. */ | ||
@@ -197,7 +198,8 @@ | ||
? __ ## f ## _alias (__VA_ARGS__) \ | ||
: (__glibc_unsafe_len (__l, __s, __osz) \ | ||
? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \ | ||
- : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)))) \ | ||
+ : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)))) | ||
+#endif | ||
|
||
#if __GNUC_PREREQ (4,3) | ||
# define __warnattr(msg) __attribute__((__warning__ (msg))) | ||
-- | ||
2.25.1 | ||
|
51 changes: 0 additions & 51 deletions
51
packages/glibc/0001-stdlib-Suppress-gcc-diagnostic-that-char8_t-is-a-key.patch
This file was deleted.
Oops, something went wrong.
63 changes: 63 additions & 0 deletions
63
packages/glibc/0002-LoongArch-Add-new-relocation-types.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
From 9f8513dc64119a424b312db97cef5d87d376defa Mon Sep 17 00:00:00 2001 | ||
From: caiyinyu <caiyinyu@loongson.cn> | ||
Date: Tue, 31 Jan 2023 20:40:10 +0800 | ||
Subject: [PATCH 2/8] LoongArch: Add new relocation types. | ||
|
||
--- | ||
elf/elf.h | 40 ++++++++++++++++++++++++++++++++++++++++ | ||
1 file changed, 40 insertions(+) | ||
|
||
diff --git a/elf/elf.h b/elf/elf.h | ||
index b6a75c13a8..4bc0e4299c 100644 | ||
--- a/elf/elf.h | ||
+++ b/elf/elf.h | ||
@@ -4159,6 +4159,46 @@ enum | ||
#define R_LARCH_GNU_VTINHERIT 57 | ||
#define R_LARCH_GNU_VTENTRY 58 | ||
|
||
+/* reserved 59-63 */ | ||
+ | ||
+#define R_LARCH_B16 64 | ||
+#define R_LARCH_B21 65 | ||
+#define R_LARCH_B26 66 | ||
+#define R_LARCH_ABS_HI20 67 | ||
+#define R_LARCH_ABS_LO12 68 | ||
+#define R_LARCH_ABS64_LO20 69 | ||
+#define R_LARCH_ABS64_HI12 70 | ||
+#define R_LARCH_PCALA_HI20 71 | ||
+#define R_LARCH_PCALA_LO12 72 | ||
+#define R_LARCH_PCALA64_LO20 73 | ||
+#define R_LARCH_PCALA64_HI12 74 | ||
+#define R_LARCH_GOT_PC_HI20 75 | ||
+#define R_LARCH_GOT_PC_LO12 76 | ||
+#define R_LARCH_GOT64_PC_LO20 77 | ||
+#define R_LARCH_GOT64_PC_HI12 78 | ||
+#define R_LARCH_GOT_HI20 79 | ||
+#define R_LARCH_GOT_LO12 80 | ||
+#define R_LARCH_GOT64_LO20 81 | ||
+#define R_LARCH_GOT64_HI12 82 | ||
+#define R_LARCH_TLS_LE_HI20 83 | ||
+#define R_LARCH_TLS_LE_LO12 84 | ||
+#define R_LARCH_TLS_LE64_LO20 85 | ||
+#define R_LARCH_TLS_LE64_HI12 86 | ||
+#define R_LARCH_TLS_IE_PC_HI20 87 | ||
+#define R_LARCH_TLS_IE_PC_LO12 88 | ||
+#define R_LARCH_TLS_IE64_PC_LO20 89 | ||
+#define R_LARCH_TLS_IE64_PC_HI12 90 | ||
+#define R_LARCH_TLS_IE_HI20 91 | ||
+#define R_LARCH_TLS_IE_LO12 92 | ||
+#define R_LARCH_TLS_IE64_LO20 93 | ||
+#define R_LARCH_TLS_IE64_HI12 94 | ||
+#define R_LARCH_TLS_LD_PC_HI20 95 | ||
+#define R_LARCH_TLS_LD_HI20 96 | ||
+#define R_LARCH_TLS_GD_PC_HI20 97 | ||
+#define R_LARCH_TLS_GD_HI20 98 | ||
+#define R_LARCH_32_PCREL 99 | ||
+#define R_LARCH_RELAX 100 | ||
+ | ||
/* ARC specific declarations. */ | ||
|
||
/* Processor specific flags for the Ehdr e_flags field. */ | ||
-- | ||
2.25.1 | ||
|
34 changes: 0 additions & 34 deletions
34
packages/glibc/0002-wcsmbs-Add-missing-test-c8rtomb-test-mbrtoc8-depende.patch
This file was deleted.
Oops, something went wrong.
157 changes: 157 additions & 0 deletions
157
packages/glibc/0003-Use-64-bit-time_t-interfaces-in-strftime-and-strptim.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
From fb7b95dc47b0d5ecd48339512d091b6b23e7d900 Mon Sep 17 00:00:00 2001 | ||
From: Andreas Schwab <schwab@suse.de> | ||
Date: Thu, 26 Jan 2023 14:25:05 +0100 | ||
Subject: [PATCH 3/8] Use 64-bit time_t interfaces in strftime and strptime | ||
(bug 30053) | ||
|
||
Both functions use time_t only internally, so the ABI is not affected. | ||
|
||
(cherry picked from commit 41349f6f67c83e7bafe49f985b56493d2c4c9c77) | ||
--- | ||
NEWS | 6 +++++ | ||
time/Makefile | 3 ++- | ||
time/strftime_l.c | 4 +++ | ||
time/strptime_l.c | 4 ++- | ||
time/tst-strftime4-time64.c | 1 + | ||
time/tst-strftime4.c | 52 +++++++++++++++++++++++++++++++++++++ | ||
6 files changed, 68 insertions(+), 2 deletions(-) | ||
create mode 100644 time/tst-strftime4-time64.c | ||
create mode 100644 time/tst-strftime4.c | ||
|
||
diff --git a/NEWS b/NEWS | ||
index ad5196a5f1..4da140db31 100644 | ||
--- a/NEWS | ||
+++ b/NEWS | ||
@@ -5,6 +5,12 @@ See the end for copying conditions. | ||
Please send GNU C library bug reports via <https://sourceware.org/bugzilla/> | ||
using `glibc' in the "product" field. | ||
|
||
+Version 2.37.1 | ||
+ | ||
+The following bugs are resolved with this release: | ||
+ | ||
+ [30053] time: strftime %s returns -1 after 2038 on 32 bits systems | ||
+ | ||
Version 2.37 | ||
|
||
Major new features: | ||
diff --git a/time/Makefile b/time/Makefile | ||
index d86f2105c5..92bc3db315 100644 | ||
--- a/time/Makefile | ||
+++ b/time/Makefile | ||
@@ -50,7 +50,7 @@ tests := test_time clocktest tst-posixtz tst-strptime tst_wcsftime \ | ||
tst-clock tst-clock2 tst-clock_nanosleep tst-cpuclock1 \ | ||
tst-adjtime tst-ctime tst-difftime tst-mktime4 tst-clock_settime \ | ||
tst-settimeofday tst-itimer tst-gmtime tst-timegm \ | ||
- tst-timespec_get tst-timespec_getres | ||
+ tst-timespec_get tst-timespec_getres tst-strftime4 | ||
|
||
tests-time64 := \ | ||
tst-adjtime-time64 \ | ||
@@ -65,6 +65,7 @@ tests-time64 := \ | ||
tst-itimer-time64 \ | ||
tst-mktime4-time64 \ | ||
tst-settimeofday-time64 \ | ||
+ tst-strftime4-time64 \ | ||
tst-timegm-time64 \ | ||
tst-timespec_get-time64 \ | ||
tst-timespec_getres-time64 \ | ||
diff --git a/time/strftime_l.c b/time/strftime_l.c | ||
index e09561c39c..402c6c4111 100644 | ||
--- a/time/strftime_l.c | ||
+++ b/time/strftime_l.c | ||
@@ -159,6 +159,10 @@ extern char *tzname[]; | ||
#ifdef _LIBC | ||
# define tzname __tzname | ||
# define tzset __tzset | ||
+ | ||
+# define time_t __time64_t | ||
+# define __gmtime_r(t, tp) __gmtime64_r (t, tp) | ||
+# define mktime(tp) __mktime64 (tp) | ||
#endif | ||
|
||
#if !HAVE_TM_GMTOFF | ||
diff --git a/time/strptime_l.c b/time/strptime_l.c | ||
index 80fd705b8d..85c3249fcc 100644 | ||
--- a/time/strptime_l.c | ||
+++ b/time/strptime_l.c | ||
@@ -30,8 +30,10 @@ | ||
#ifdef _LIBC | ||
# define HAVE_LOCALTIME_R 0 | ||
# include "../locale/localeinfo.h" | ||
-#endif | ||
|
||
+# define time_t __time64_t | ||
+# define __localtime_r(t, tp) __localtime64_r (t, tp) | ||
+#endif | ||
|
||
#if ! HAVE_LOCALTIME_R && ! defined localtime_r | ||
# ifdef _LIBC | ||
diff --git a/time/tst-strftime4-time64.c b/time/tst-strftime4-time64.c | ||
new file mode 100644 | ||
index 0000000000..4d47ee7d79 | ||
--- /dev/null | ||
+++ b/time/tst-strftime4-time64.c | ||
@@ -0,0 +1 @@ | ||
+#include "tst-strftime4.c" | ||
diff --git a/time/tst-strftime4.c b/time/tst-strftime4.c | ||
new file mode 100644 | ||
index 0000000000..659716d0fa | ||
--- /dev/null | ||
+++ b/time/tst-strftime4.c | ||
@@ -0,0 +1,52 @@ | ||
+/* Test strftime and strptime after 2038-01-19 03:14:07 UTC (bug 30053). | ||
+ Copyright (C) 2023 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. | ||
+ | ||
+ 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 | ||
+ <https://www.gnu.org/licenses/>. */ | ||
+ | ||
+#include <time.h> | ||
+#include <stdlib.h> | ||
+#include <stdio.h> | ||
+#include <string.h> | ||
+#include <support/check.h> | ||
+ | ||
+static int | ||
+do_test (void) | ||
+{ | ||
+ TEST_VERIFY_EXIT (setenv ("TZ", "UTC0", 1) == 0); | ||
+ tzset (); | ||
+ if (sizeof (time_t) > 4) | ||
+ { | ||
+ time_t wrap = (time_t) 2147483648LL; | ||
+ char buf[80]; | ||
+ struct tm *tm = gmtime (&wrap); | ||
+ TEST_VERIFY_EXIT (tm != NULL); | ||
+ TEST_VERIFY_EXIT (strftime (buf, sizeof buf, "%s", tm) > 0); | ||
+ puts (buf); | ||
+ TEST_VERIFY (strcmp (buf, "2147483648") == 0); | ||
+ | ||
+ struct tm tm2; | ||
+ char *p = strptime (buf, "%s", &tm2); | ||
+ TEST_VERIFY_EXIT (p != NULL && *p == '\0'); | ||
+ time_t t = mktime (&tm2); | ||
+ printf ("%lld\n", (long long) t); | ||
+ TEST_VERIFY (t == wrap); | ||
+ } | ||
+ else | ||
+ FAIL_UNSUPPORTED ("32-bit time_t"); | ||
+ return 0; | ||
+} | ||
+ | ||
+#include <support/test-driver.c> | ||
-- | ||
2.25.1 | ||
|
Oops, something went wrong.