Age | Commit message (Collapse) | Author |
|
The parameters are not used in the function variant without vdso
support, so tell this to the compiler to avoid a warning. Also fix the
indentation to be in-line with other functions in the file.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
This change implements Xtensa FDPIC ABI as specified in the first
version of the following document:
https://github.com/jcmvbkbc/xtensa-abi/blob/master/fdpic-xtensa.txt
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
With gcc-14 warnings caused by type mismatches turn to errors:
- got_entry is a pointer in the _dl_linux_resolver(), but the function
_dl_linux_resolver() returns unsigned long. Convert got_entry to
unsigned long when returning
- first argument of _dl_funcdesc_for() is a pointer, but (symbol_addr +
reloc_value) is unsigned long in the _dl_do_reloc(). Convert function
argument to (void *)
- struct funcdesc_value::entry_point is a pointer, but DL_RELOC_ADDR
returns ElfW(Addr). Convert DL_RELOC_ADDR result to (void *) before
assigning to funcdesc_value::entry_point
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
With gcc-14 warnings caused by type mismatches turn to errors:
- (void **) needs explicit conversion operator to become
struct funcdesc_value **entry
- both subexpressions of the ternary operator must be pointers
- %p should be used instead of %x to print a pointer
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
In aarch64 when the general dynamic access model is used for tls data
the linker emits two dynamic relocs (R_AARCH64_TLS_DTPMOD(64) and
R_AARCH64_TLS_DTPREL(64)) that must be applied by ld.so during object
loading.
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
- Add macroses for vDSO functions names because
in some architectures these names differ from the default ones.
- Add header guards in dl-syscalls.h .
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
- Cleanup dl-vdso.c code.
- Pass `void *` as first arg to `load_vdso()`, using 32-bit type
is completely wrong on 64bit architectures.
- Split libc code and vDSO-related code.
Move arch-specific implementations into separate files.
The performance improvement is for example 50-60 times on ARMv7
and about 4 times on x86_64.
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
|
|
|
|
|
|
By some reason sparc ld.so cannot work properly with
statx() system call, so fallback to regular stat() family in ld.so.
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
We use semicolons in the place of
`DL_RELOCATE_RELR()` and `DL_DO_RELOCATE_RELR()` 'calling'
so the semicolon in the macro definition leads to
semicolon duplication after preprocessing.
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
While they are not a problem per-se they cause issues with some tooling
(such as clang coverage) and are confusing to the reader.
|
|
There is a check for (*rpnt == NULL) a few lines above but the "else"
case performing an allocation does only exist if SHARED is not defined.
If SHARED is defined, the allocation is not performed and it may happen
(at least in theory) that *rpnt == NULL when executing
(*rpnt)->dyn = tpnt;
Add the null-pointer check.
Signed-off-by: Frank Mehnert <frank.mehnert@kernkonzept.com>
|
|
|
|
Here is the warning:
ldso/ldso/dl-elf.c: In function '_dl_fixup':
./ldso/include/dl-elf.h:259:37: warning: declaration of 'reloc_addr' shadows a previous local [-Wshadow]
259 | ElfW(Addr) *reloc_addr = 0; \
| ^~~~~~~~~~
./ldso/include/dl-elf.h:290:33: note: in expansion of macro 'DL_DO_RELOCATE_RELR'
290 | DL_DO_RELOCATE_RELR(dyn->loadaddr, relr_start, relr_end); \
| ^~~~~~~~~~~~~~~~~~~
ldso/ldso/dl-elf.c:1032:9: note: in expansion of macro 'DL_RELOCATE_RELR'
1032 | DL_RELOCATE_RELR(tpnt);
| ^~~~~~~~~~~~~~~~
In file included from ldso/ldso/ldso.c:1462:
ldso/ldso/dl-elf.c:1012:20: note: shadowed declaration is here
1012 | ElfW(Addr) reloc_addr
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
Nowadays modern libcs like Glibc and musl currently
support processing of RELATIVE relocations compressed
with DT_RELR format. However I have noticed that uClibc-ng
doesn't support this feature and if the source will be linked with
`-Wl,-z,pack-relative-relos` (bfd) or `-Wl,--pack-dyn-relocs=relr`
(lld) then ld.so cannot properly load the produced DSO.
This patch is intended to fix this issue and adds applying
of DT_RELR relative relocation.
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
|
|
The Linux kernels ELF-FDPIC binfmt program loader can support loading and
running conventional ELF format binaries on noMMU kernels when compiled
appropriately. That is when they are constant displacement binaries such
as generated using the -pie compile option.
Add a configure option to allow selecting ELF binary support in noMMU
mode configurations on architectures that support this. The main
requirement is to generate the ldso run-time loader to perform relocation
at load time. These configurations do not support shared libraries, so
there is no need to generate a full shared library, only the static
version is required.
The use of ELF format binaries does mean a slightly simpler toolchain
generation (does not require a -uclinux- for some architectures) and does
not require an extra tool like elf2flt.
This initial support targets M68K, ARM and RISC-V architectures. No kernel
changes are required, the required support for this is already in mainline
kernels (certainly as of linux-6.6).
Note that for the M68K and ARM architectures that the initialized
registers and stack layout at process startup is slightly different for
the flat format loader and the ELF/ELF-FDPIC loaders. So we need some
changes to the startup code (crt1.S) for them.
I have not done extensive testing outside of M68K, ARM and RISC-V.
I had to make changes to a couple of the dl-startup.h architecture files
to get them to build for this noMMU case. I did not dig down too deep on
the reasons, but they still seem ok for the MMU case as well.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
|
|
Fixes segfaults in curl with gnutls encryption.
|
|
|
|
|
|
|
|
|
|
New ARCv3 ISA includes both 64-bit and 32-bit CPU family.
This patch adds support for 32-bit ARCv3 HS5x processors.
Signed-off-by: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
|
|
Add a header file with assembler macros to be able to handle in one
place the differences between ARCv2 and ARCv3 ISAs. It is a preparatory
step before the introduction of support for ARCv3 CPUs.
Signed-off-by: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
|
|
Option '-mno-long-calls' is not supported by all arc gcc compilers.
For instance, this option is not supported by GCC for ARCv3 processors.
Check if this option is supported before applying it.
Signed-off-by: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
|
|
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
Xtensa does not define PERFORM_BOOTSTRAP_RELOC so it doesn't need
ARCH_NEEDS_BOOTSTRAP_RELOCS definition. Remove it.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
Xtensa PERFORM_BOOTSTRAP_GOT macro uses mprotect to make bits of GOT
writable, but noMMU linux kernel returns ENOSYS to mprotect syscalls,
and syscall wrapper tries to update errno with the error code. This
happens well before the relocations are done and results in writes to
unrelated locations, memory corruption or protection violations.
Only define PERFORM_BOOTSTRAP_GOT when building xtensa configuration
with MMU support.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
3 architectures currently define PERFORM_BOOTSTRAP_GOT: avr32, mips and
xtensa. A block of code that applies relative relocations in the
DL_START is disabled when PERFORM_BOOTSTRAP_GOT is defined, unless it's
avr32 or mips, effectively disabling it only for xtensa.
This may be simplified by removing the call to elf_machine_relative from
the xtensa PERFORM_BOOTSTRAP_GOT and always using common code.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
on mips
Updated config to allow compilation of rcrt1.o for mips and modified it's crt1.S to perform relocates in __start.
The mips architecture performs relocations differently then most other architectures. reloc_static_pie was rewritten, taking code from dl-startup.c, in order to perfrom the additional relocations. Modifications were made to mips' dl-startup.h to allow for the use of contained macros without including _start definition.
Signed-off-by: linted <linted@users.noreply.github.com>
|
|
When searching for shared libraries, it could happen that redudant '/'
were added to the pathname with would later be reported via dladdr() in
the dli_fname member.
Signed-off-by: Daniel Dorau <d.dorau@avm.de>
|
|
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
|
|
default
This patch fixes segfault of all user space processes (including init, which caused a panic) on recent buildroot powerpc32 builds.
The issue has been reported by Romain Naour in this thread: https://mailman.uclibc-ng.org/pipermail/devel/2021-May/002068.html
Recent buildroot toolchain enables secure PLT in powerpc gcc.
The latter will then supply -msecure-plt to gas invocations by default.
Recent buildroot also enables PIE by defaults.
For the secure PLT to work in PIC, the r30 register needs to point to the GOT.
Old "bss plt" was just a one-instruction-wide PLT slot, pointed-to by a R_PPC_JMP_SLOT relocation, which was written on-the-fly to contain a branch instruction to the correct address. It therefore had to stay writable.
New secure PLT only contains read-only code which loads the branch address from the writable GOT.
Note: secure PLT without PIC does not need r30 to be set. Because offset between plt stub code and got is known at link-time. In this case the PLT entry looks like:
1009b3e0 <__uClibc_main@plt>:
1009b3e0: 3d 60 10 0e lis r11,4110
1009b3e4: 81 6b 03 74 lwz r11,884(r11)
1009b3e8: 7d 69 03 a6 mtctr r11
1009b3ec: 4e 80 04 20 bctr
Whereas secure PLT with PIC - offset between plt and got is unknown at link-time - looks like this:
000af800 <00000000.plt_pic32.__uClibc_main>:
af800: 81 7e 03 80 lwz r11,896(r30)
af804: 7d 69 03 a6 mtctr r11
af808: 4e 80 04 20 bctr
af80c: 60 00 00 00 nop
Signed-off-by: Yann Sionneau <yann@sionneau.net>
|
|
|
|
This commit adds support for Kalray VLIW family (kvx)
Kalray kv3 core is embedded in Kalray Coolidge SoC. This core which is the
third of the KV family has the following features:
32/64 bits execution mode
6-issue VLIW architecture
64 x 64bits general purpose registers
SIMD instructions
little-endian
In order to build a usable toolchain, build scripts are provided at the
following address: https://github.com/kalray/build-scripts.
Kalray uses FOSS which is available at https://github.com/kalray
This includes Linux kernel, uClibc-ng, gcc, binutils, etc.
Signed-off-by: Clément Léger <cleger@kalray.eu>
Signed-off-by: Guillaume Thouvenin <gthouvenin@kalray.eu>
Signed-off-by: Laurent Thevenoux <lthevenoux@kalray.eu>
Signed-off-by: Marc Poulhies <mpoulhies@kalray.eu>
Signed-off-by: Marius Gligor <mgligor@kalray.eu>
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
|
|
SEND_STDERR_DEBUG does nothing if __SUPPORT_LD_DEBUG_EARLY__ is not defined
thus causing a warning.
Fixes this:
In file included from ldso/ldso/ldso.c:86:0:
ldso/ldso/dl-startup.c: In function '_dl_start':
ldso/ldso/dl-startup.c:313:13: warning: variable 'strtab' set but not used [-Wunused-but-set-variable]
char *strtab;
^~~~~~
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
|
|
Fixes the following compilation warning for 64-bit arch with TLS support:
CC ldso/libdl/libdl.oS
ldso/libdl/libdl.c: In function 'do_dlsym':
ldso/libdl/libdl.c:739:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
ret = _dl_tls_symaddr ((struct link_map *)sym_ref.tpnt, (Elf32_Addr)ret);
^
|
|
|
|
Before this commit tst-tls-at-ctor test would segfault.
After it passes.
testsuite run before: https://pastebin.com/504JgQXa
testsuite run after: https://pastebin.com/d2aNciVt
Stafford Horne already fixed it in glibc:
* https://github.com/openrisc/or1k-glibc/blob/bcd87396ebe78228645c0731b06c934dfd88855a/sysdeps/or1k/dl-machine.h#L298
* https://github.com/openrisc/or1k-glibc/blob/bcd87396ebe78228645c0731b06c934dfd88855a/sysdeps/or1k/dl-machine.h#L99
|
|
Similar to glibc commit
https://sourceware.org/git/?p=glibc.git;a=commit;h=6bbfc5c09fc5b5e3d4a0cddbbd4e2e457767dae7
we need to handle Linux kernel change, which removed stat64 family from default syscall set.
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Waldemar Brodkorb <wbrodkorb@conet.de>
|
|
basically from or1k port of uClibc-ng, with fixes for structures in
pthreadtypes.h from 64 bit architectures.
18 testsuite failures counted.
|
|
|
|
|
|
|
|
Support EM_CSKY 252 elf format.
Changelog:
Increase EM_NUM to 253
Signed-off-by: Guo Ren <ren_guo@c-sky.com>
Signed-off-by: Mao Han <han_mao@c-sky.com>
|