Age | Commit message (Collapse) | Author |
|
is available
The reallocarray() primitive is only provided by the malloc-standard
implementation: neither malloc nor malloc-simple provide it. This
causes issues when building for example util-linux on noMMU platforms
as:
- noMMU platforms can't use malloc-standard, so either malloc or
malloc-simple are used, which means reallocarray() is not
implemented
- util-linux detects the absence of reallocarray(), and provides its
own implementation, but the prototype clashes with the prototype in
uClibc's <stdlib.h>
The combination of which causes the following build failure:
In file included from lib/color-names.c:7:
./include/c.h:586:21: error: static declaration of ‘reallocarray’ follows non-static declaration
586 | static inline void *reallocarray(void *ptr, size_t nmemb, size_t size)
| ^~~~~~~~~~~~
In file included from ./include/c.h:16:
/home/thomas/projets/buildroot/output/host/arm-buildroot-uclinux-uclibcgnueabi/sysroot/usr/include/stdlib.h:898:14: note: previous declaration of ‘reallocarray’ with type ‘void *(void *, size_t, size_t)’ {aka ‘void *(void *, unsigned int, unsigned int)’}
898 | extern void *reallocarray (void *__ptr, size_t __m, size_t __n);
| ^~~~~~~~~~~~
make[3]: *** [Makefile:12354: lib/libtcolors_la-color-names.lo] Error 1
To fix this, let's not expose the prototype of reallocarray() if we
don't provide the implementation for it.
Upstream: https://mailman.openadk.org/mailman3/hyperkitty/list/devel@uclibc-ng.org/thread/BX4ENNZYO23YQJQF5XITW7TETSJHEFK5/
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
|
|
|
|
|
Signed-off-by: Jeffrey H. Johnson <trnsz@pobox.com>
|
|
Avoid the warning by marking the unused parameter appropriately.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
Recent Clang versions (Starting from 20) have this macro built-in. The
compiler does not warn about this normally because <stdint.h> is a
system header. In special cases where stdint.h may be included as normal
header it does warn however. Avoid re-defining if a definition already
exists.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
The _start symbol does not necessarily have to be on the first page of
the application. But the __ehdr_start symbol is always at address zero
for PIE binaries.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
So far, uclibc relied on the informal behaviour of GNU ld to put the
link address of the _DYNAMIC symbol in the first GOT entry. This does
not work with LLVM lld which does not follow this convention.
Consequently, glibc has abandoned its usage in favour of using
__ehdr_start as magic symbol to infer the load address [1].
Note that this implies that the link time address of __ehdr_start is
*always* 0! So far, this seems to be the case on all platforms.
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=28203
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
The LLVM linker seems to be quite clever. When resolving relocations,
accesses to the GOT are potentially replaced by PC relative addressing
to the requested symbol. This breaks the old method of calculating the
load address by using an unrelocated GOT entry value. Instead, rely on
__ehdr_start having a link address of zero.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
Signed-off-by: Thorsten Glaser <tg@debian.org>
|
|
ld.so must be compiled with -ffreestanding to avoid emits of
memset/memcpy from gcc.
Disable some extra warnings for Blackfin to avoid a compile
error.
|
|
The _dl_auxvt is also used on non shared builds to access the values of
the vector from getauxval. Putting the definitions in ldso.h leads to
issues because that header also implements fcntl.h functionality making
it incompatible with files that include that header directly.
Factor out the _dl_auxvt related declarations to a new header dl-auxvt.h
and include from ldso.h as well as include it directly from
__uClibc_main.c to make the definitions available.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
Commit 227b7c825b6c79479f7222be03e83991b927da26 introduced a dependency
on _dl_auxvt but missed to include the header defining the symbol.
Include the ldso.h header that defines this and safeguard other parts of
that header that do not play nice if fcntl.h has already been included.
The latter is the case only for __uClibc_main.c.
Reviewed-by: Georg Kotheimer <georg.kotheimer@kernkonzept.com>
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
Previously the getauxval implementation was limited to the auxiliary
vector entries cached in _dl_auxvt. To also support entries outside of
that cached subset, store the start address of the auxiliary vector,
and if an uncached entry type is encountered search the entire auxiliary
vector.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
While for dynamic linking the _dl_auxvt array is provided in
dl-startup.c as part of the ldso, is was undefined for statically
linked binaries. This resulted in a corresponding linker error if
a statically linked program used getauxval.
To provide _dl_auxvt also for statically linked binaries, a definition
of _dl_auxvt is added to dl-support.c and initialized by _dl_aux_init().
Signed-off-by: Marcus Haehnel <marcus.haehnel@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@kernkonzept.com>
|
|
Fix null pointer access in case SUPPORT_LD_DEBUG configuration option is
enabled (hit in _dl_do_reloc, but fix same old_val/reloc_addr usage pattern
in _dl_do_lazy_reloc too).
Reported-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
Link: https://mailman.openadk.org/mailman3/hyperkitty/list/devel@uclibc-ng.org/thread/ODLJ53XJU5ZG3OLHVJMVWSNBYIFHFBAT/
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
|
|
If gethostent_r fails, the h_errnop error code should be set.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
Clang-19 defines NAN in <float.h>. Check if NAN is already defined to
prevent a compiler warning.
Change-Id: I29ebcb2a7a0c1eade46a73074a1701ea67869128
Signed-off-by: Marcus Haehnel <marcus.haehnel@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@kernkonzept.com>
|
|
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
targets on Linux versions prior to 5.1.0
Using 64bit time on 32bit targets was only introduced in Linux 5.1.0.
On versions prior to that, compiling uClibc-ng produces incorrect headers
that cause the `clock_nanosleep` syscall to receive incorrect arguments.
This change was previously introduced in `features.h`, but was reverted due to inclusion errors when compiling other
projects.
Signed-off-by: Nadav Tasher <tashernadav@gmail.com>
|
|
32bit targets on Linux versions prior to 5.1.0"
This reverts previous changes made to features.h which caused redefinitions when including `features.h`.
The reverted functionality will be reintroduced in a future commit.
Signed-off-by: Nadav Tasher <tashernadav@gmail.com>
|
|
Signed-off-by: Marcus Haehnel <marcus.haehnel@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@kernkonzept.com
|
|
targets on Linux versions prior to 5.1.0
Using 64bit time on 32bit targets was only introduced in Linux 5.1.0.
On versions prior to that, compiling uClibc-ng produces incorrect headers
that cause the `clock_nanosleep` syscall to receive incorrect arguments.
Signed-off-by: Nadav Tasher <tashernadav@gmail.com>
|
|
Signed-off-by: Mingxiang Lu <lu.mingxiang@h3c.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
|
|
This reverts commit dd01754e21da71706af07f3e56eade66fc9164fb.
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
With time64 enabled we have to use statx() instead of stat() or fstat()
If the _dl_fstat implementation isn't selected correctly
we can have multiple errors inside dynamic linker
during startup of the system and of the almost every process
Add sparc exclusion like in other places inside this header
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
|
|
|
|
|
|
Neither glibc nor musl use __GNU macro to hide getrandom.
While there sync with glibc and add GRND_INSECURE flag.
|
|
|
|
|
|
d0c8c185b439187b12644457bb2aa0326f25aaf7 was not complete, add
missing architectures.
|
|
|
|
The data in jis0208.h initializes a two-dimensional array, so insert the
missing braces to prevent a compiler warning about missing braces around
initializer.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
Use `unsigned char *s` rather than `char *s`. First, this fixes compiler
warnings when these functions are called from utf8dec_wchar() passing
the `in` pointer of type `unsigned char *`.
Second, these functions are always called with characters >= 0x80 so the
sign bit is set. Shifting right a negative signed value will insert `1`
from the left side, so `foo >> 1` where foo is negative will always have
the sign bit set. So at least "case 2" would never return true.
There is a similar problem with tests like
(*(s+1) >= 0xA0) && (*(s+1) <= 0xBF)
This condition is always false with `char *s`.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
As the condition for terminating the loop compares the loop variable
against an ElfW() variable which is, depending on the platform, either
uint32_t or uint64_t, use 'unsigned int' rather than 'int' for the loop
variable to prevent corresponding compiler warnings.
Note that it would not make sense to use 'unsigned long' because the
number of program headers will never exceed 32-bit.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
gcc suggests to set parentheses around '-'/'+' inside '<<' if the
corresponding warnings are enabled. Make the compiler happy and make
the code easier to understand for developers.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
Perform an explicit cast to prevent the corresponding compiler warning.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
The "%p" format specifier requires a void pointer. Cast parameters of
type ElfW(Addr) to 'void *'.
This fixes warnings if _dl_if_debug_print() performs parameter type
checking.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
If the conditions are not grouped we can reach
this block even if `__NR_stat` is not defined.
`defined __NR_stat && ((!defined(__UCLIBC_USE_TIME64__) || defined(__sparc__))`
gives us false but `LINUX_VERSION_CODE <= KERNEL_VERSION(5,1,0))`
may give us true. So if linux headers version is below 5.1.0 and
__NR_stat is not defined we can have compilation error
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
While building software that sets _POSIX_C_SOURCE=200809L and uses
stat.st_mtim for ARM, it was noticed that st_mtim was not defined.
This seems to be because common/bits/stat.h was picked up, which does
not take __USE_XOPEN2K8 as a reason to enable st_mtim and related
fields. This appears to be an oversight, and porting the check from
common-generic/bits/stat.h to other architectures does indeed fix the
build issue.
This patch is based on commit 50bd6d06e ("Fix memory corruption due to
struct stat field").
Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net>
|
|
|
|
- Fallback to __NR_stat syscall in ld.so if we use 4.x kernel headers.
4.x kernel doesn't support 64-bit time so we can use old syscall
- Add preprocessor conditions to have fstat64 and fstatat64 in libc
with old kernel headers
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
ARMv8 has particular restrictions which coprocessor can be used and as
such these instructions, which were likely used for backwards
compatibility purposes, cannot be used on ARMv8. We solve this by
checking for ARMv8 and then using the corresponding mnemonics which were
placed in comments alongside the instructions causing issues.
Fixes the following errors:
.../setjmp.S:59:6: error: invalid operand for instruction
stc p11, cr8, [r12], #68
^
.../setjmp.S:62:6: error: invalid operand for instruction
mrc p10, 7, r2, cr1, cr0, 0
^
.../__longjmp.S:69:6: error: invalid operand for instruction
ldc p11, cr8, [r12], #68
^
.../__longjmp.S:73:6: error: invalid operand for instruction
mcr p10, 7, r1, cr1, cr0, 0
^
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|