From: Frank Mehnert <frank.mehnert(a)kernkonzept.com>
In a .p2align directive, the maximum number of bytes to skip shall be at
most the intended alignment minus 1. Certain assemblers warn otherwise:
spn.S:97:14: warning: maximum bytes expression exceeds alignment
and has no effect
.p2align 3,,8
^
Change-Id: I5ad48f6f3c3036d8d33d3710ed8d5b5a35bf1fea
Signed-off-by: Marcus Haehnel <marcus.haehnel(a)kernkonzept.com>
---
libc/string/x86_64/…
[View More]strcat.S | 2 +-
libc/string/x86_64/strcspn.S | 2 +-
libc/string/x86_64/strlen.S | 2 +-
libc/string/x86_64/strspn.S | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libc/string/x86_64/strcat.S b/libc/string/x86_64/strcat.S
index 55e09e5f1..209e19062 100644
--- a/libc/string/x86_64/strcat.S
+++ b/libc/string/x86_64/strcat.S
@@ -106,7 +106,7 @@ ENTRY (BP_SYM (strcat))
/* Align, it is a jump target. */
/* Next 3 insns are 8 bytes total, make sure we decode them in one go */
- .p2align 3,,8
+ .p2align 3,,7
3:
subq $8,%rax /* correct pointer increment. */
diff --git a/libc/string/x86_64/strcspn.S b/libc/string/x86_64/strcspn.S
index 7a06c8867..5ef565db7 100644
--- a/libc/string/x86_64/strcspn.S
+++ b/libc/string/x86_64/strcspn.S
@@ -94,7 +94,7 @@ L(1): leaq -4(%rdx), %rax /* prepare loop */
/* but it will also align entire function to 16 bytes, */
/* potentially creating largish padding at link time. */
/* We are aligning to 8 bytes instead: */
- .p2align 3,,8
+ .p2align 3,,7
L(3): addq $4, %rax /* adjust pointer for full loop round */
diff --git a/libc/string/x86_64/strlen.S b/libc/string/x86_64/strlen.S
index 9e84326c2..2fe2f58b2 100644
--- a/libc/string/x86_64/strlen.S
+++ b/libc/string/x86_64/strlen.S
@@ -102,7 +102,7 @@ ENTRY (strlen)
/* Align, it is a jump target. */
/* Next 3 insns are 8 bytes total, make sure we decode them in one go */
- .p2align 3,,8
+ .p2align 3,,7
3:
subq $8,%rax /* correct pointer increment. */
diff --git a/libc/string/x86_64/strspn.S b/libc/string/x86_64/strspn.S
index 366377649..8dc42656b 100644
--- a/libc/string/x86_64/strspn.S
+++ b/libc/string/x86_64/strspn.S
@@ -89,7 +89,7 @@ L(1): leaq -4(%rdx), %rax /* prepare loop */
/* but it will also align entire function to 16 bytes, */
/* potentially creating largish padding at link time. */
/* We are aligning to 8 bytes instead: */
- .p2align 3,,8
+ .p2align 3,,7
L(3):
addq $4, %rax /* adjust pointer for full loop round */
--
2.47.1
[View Less]
Hi all,
LTP test fstatat01.c [1] FTBFS on Buildroot bootlin-sh4-uclibc toolchain
(uclibc: 1.0.50, kernel headers: 4.19.255). It looks to me that other bootlin
uclibc based toolchains are working, therefore it's probably sh4 problem.
Looking into include/sys/stat.h in uclibc-ng [2], extern int fstatat (int __fd,
...) definition is guarded only by: # ifdef __REDIRECT_NTH.
But in glibc io/sys/stat.h [3] guardes it with # ifdef __USE_TIME64_REDIRECTS
added glibc 2.40 a4ed0471d7 ("Always define …
[View More]__USE_TIME_BITS64 when 64 bit time_t is used")
which replaced previous __USE_TIME_BITS64 added in in glibc 2.34 47f24c21ee [4]
("y2038: Add support for 64-bit time on legacy ABIs") [5]. Should similar change
be added to uclibc-ng?
Kind regards,
Petr
$ cd ~/br-test-pkg/bootlin-sh4-uclibc/build/ltp-testsuite-728759506cbe08612183275b3543007d1c47f7f4/testcases/kernel/syscalls/fstatat
$ make V=1 fstatat01
br-test-pkg/bootlin-sh4-uclibc/host/bin/sh4-linux-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -I../../../../include -I../../../../include -I../../../../include/old/ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -Ibr-test-pkg/bootlin-sh4-uclibc/host/bin/../sh4-buildroot-linux-uclibc/sysroot/usr/include/tirpc -g -O2 -fno-strict-aliasing -pipe -Wall -W -Wold-style-definition -std=gnu99 -L../../../../lib fstatat01.c -Lbr-test-pkg/bootlin-sh4-uclibc/host/bin/../sh4-buildroot-linux-uclibc/sysroot/usr/lib -ltirpc -lfts -lltp -o fstatat01
fstatat01.c:63:5: error: conflicting types for ‘fstatat’; have ‘int(int, const char *, struct stat64 *, int)’
63 | int fstatat(int dirfd, const char *filename, struct stat64 *statbuf, int flags)
| ^~~~~~~
In file included from br-test-pkg/bootlin-sh4-uclibc/host/sh4-buildroot-linux-uclibc/sysroot/usr/include/features.h:409,
from br-test-pkg/bootlin-sh4-uclibc/host/sh4-buildroot-linux-uclibc/sysroot/usr/include/sys/types.h:26,
from fstatat01.c:27:
br-test-pkg/bootlin-sh4-uclibc/host/sh4-buildroot-linux-uclibc/sysroot/usr/include/sys/stat.h:243:12: note: previous declaration of ‘fstatat’ with type ‘int(int, const char * restrict, struct stat * restrict, int)’
243 | extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
| ^~~~~~~~~~~~~~
[1] https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/sysc…
[2] https://cgit.openadk.org/cgi/cgit/uclibc-ng.git/tree/include/sys/stat.h#n247
[3] https://sourceware.org/git/?p=glibc.git;a=blob;f=io/sys/stat.h;h=4bea9e9a77…
[4] https://sourceware.org/git/?p=glibc.git;a=commit;h=a4ed0471d71739928a0d0fa3…
[5] https://sourceware.org/git/?p=glibc.git;a=commit;h=47f24c21ee38701ae275aa9e…
[View Less]
Hello,
uClibc-ng 1.0.50 + Linux headers 4.4 fails to build with:
In file included from ./include/sys/syscall.h:33,
from ./ldso/include/dl-syscall.h:12,
from ./ldso/include/ldso.h:52,
from ldso/ldso/ldso.c:32:
./ldso/include/dl-syscall.h: In function '_dl_fstat':
./include/bits/syscalls-common.h:34:63: error: '__NR__dl_fstat' undeclared (first use in this function); did you mean '_dl_fstat'?
# define INLINE_SYSCALL(name, nr, args...) …
[View More]INLINE_SYSCALL_NCS(__NR_##name, nr, args)
This is reproducible with Buildroot's arcturus_ucp1020_defconfig, and a
log is visible at:
https://gitlab.com/buildroot.org/buildroot/-/jobs/8864051076
With the full log at:
https://buildroot.org.gitlab.io/-/buildroot/-/jobs/8864051076/artifacts/bui…
Any clue?
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
[View Less]
From: Frank Mehnert <frank.mehnert(a)kernkonzept.com>
This variable is used either if __UCLIBC_HAS_FLOATS__ is defined or if
__UCLIBC_HAS_GLIBC_DIGIT_GROUPING__ is defined. Instead of adding more
complicated #ifdef magic, just mark this variable as possibly unused to
satisfy the compiler.
Signed-off-by: marcus.haehnel(a)kernkonzept.com
---
libc/stdio/_scanf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/stdio/_scanf.c b/libc/stdio/_scanf.c
index 3f3000d6f..…
[View More]cb72d14ac 100644
--- a/libc/stdio/_scanf.c
+++ b/libc/stdio/_scanf.c
@@ -1715,7 +1715,7 @@ int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc)
#define MAX_DIGITS 65 /* Allow one leading 0. */
unsigned char buf[MAX_DIGITS+2+ 100];
unsigned char usflag, base;
- unsigned char nonzero = 0;
+ unsigned char nonzero __attribute__((unused)) = 0;
unsigned char seendigit = 0;
#ifndef __UCLIBC_HAS_FLOATS__
--
2.47.1
[View Less]
Hi uClibc-ng hackers,
I released 1.0.51. See here for changes:
Dmitry Chestnykh (2):
mips64n32, time64: Select correct _dl_fstat impl
Revert "mips64: time64 for n32 ABI breaks a lot of tests, disable it for now"
Frank Mehnert (4):
uclibc: prevent warning about setting an unused variable
uclibc: prevent warning about declaring an unused function
prevent warning about setting an unused variable
fix possible overflow in pointer arithmetics strnlen()
…
[View More]Mingxiang Lu (1):
fix TLS memory leak with dlopen
Nadav Tasher (3):
features.h: error out when attempting to compile with TIME64 for 32bit targets on Linux versions prior to 5.1.0
Revert "features.h: error out when attempting to compile with TIME64 for 32bit targets on Linux versions prior to 5.1.0"
time64_helpers.h: error out when attempting to compile with TIME64 for 32bit targets on Linux versions prior to 5.1.0
Waldemar Brodkorb (4):
add process_vm_{read,write}v syscall wrapper from glibc
mips64: time64 for n32 ABI breaks a lot of tests, disable it for now
clock_adjtime: warn instead of error out
bump version for 1.0.51 release
best regards
Waldemar
[View Less]
From: Frank Mehnert <frank.mehnert(a)kernkonzept.com>
It is undefined behavior to compare two pointers belonging to different
objects. This includes the case where the addition overflows. Clang-20
seems to follow this rule more eagerly and optimizes away the old test.
Fix the test by performing the addition on uintptr_t values rather than
on on char pointers.
See also https://github.com/llvm/llvm-project/issues/121909.
Signed-off-by: Marcus Haehnel <marcus.haehnel(a)kernkonzept.com…
[View More]>
---
libc/string/generic/strnlen.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libc/string/generic/strnlen.c b/libc/string/generic/strnlen.c
index 4d4cde84f..82d4122ec 100644
--- a/libc/string/generic/strnlen.c
+++ b/libc/string/generic/strnlen.c
@@ -29,15 +29,17 @@
'\0' terminator is found in that many characters, return MAXLEN. */
size_t strnlen (const char *str, size_t maxlen)
{
- const char *char_ptr, *end_ptr = str + maxlen;
+ const char *char_ptr, *end_ptr;
const unsigned long int *longword_ptr;
unsigned long int longword, himagic, lomagic;
if (maxlen == 0)
return 0;
- if (__builtin_expect (end_ptr < str, 0))
+ if (__builtin_expect ((uintptr_t)str + maxlen < (uintptr_t)str, 0))
end_ptr = (const char *) ~0UL;
+ else
+ end_ptr = str + maxlen;
/* Handle the first few characters by reading one character at a time.
Do this until CHAR_PTR is aligned on a longword boundary. */
--
2.47.1
[View Less]