else
l->l_ld = (ElfW(Dyn) *) ((ElfW(Addr)) l->l_ld + l->l_addr);
- elf_get_dynamic_info (l, false);
+ elf_get_dynamic_info (l);
/* Make sure we are not dlopen'ing an object that has the
DF_1_NOOPEN flag set, or a PIE object. */
break;
}
- elf_get_dynamic_info (main_map, false);
+ elf_get_dynamic_info (main_map);
# ifdef ELF_MACHINE_BEFORE_RTLD_RELOC
ELF_MACHINE_BEFORE_RTLD_RELOC (main_map, main_map->l_info);
--- /dev/null
+/* Inline functions for dynamic linking.
+ Copyright (C) 1995-2021 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/>. */
+
+#ifndef _DL_STATIC_TLS_H
+#define _DL_STATIC_TLS_H
+
+/* This macro is used as a callback from elf_machine_rel{a,} when a
+ static TLS reloc is about to be performed. Since (in dl-load.c) we
+ permit dynamic loading of objects that might use such relocs, we
+ have to check whether each use is actually doable. If the object
+ whose TLS segment the reference resolves to was allocated space in
+ the static TLS block at startup, then it's ok. Otherwise, we make
+ an attempt to allocate it in surplus space on the fly. If that
+ can't be done, we fall back to the error that DF_STATIC_TLS is
+ intended to produce. */
+#define HAVE_STATIC_TLS(map, sym_map) \
+ (__builtin_expect ((sym_map)->l_tls_offset != NO_TLS_OFFSET \
+ && ((sym_map)->l_tls_offset \
+ != FORCED_DYNAMIC_TLS_OFFSET), 1))
+
+#define CHECK_STATIC_TLS(map, sym_map) \
+ do { \
+ if (!HAVE_STATIC_TLS (map, sym_map)) \
+ _dl_allocate_static_tls (sym_map); \
+ } while (0)
+
+#define TRY_STATIC_TLS(map, sym_map) \
+ (__builtin_expect ((sym_map)->l_tls_offset \
+ != FORCED_DYNAMIC_TLS_OFFSET, 1) \
+ && (__builtin_expect ((sym_map)->l_tls_offset != NO_TLS_OFFSET, 1) \
+ || _dl_try_allocate_static_tls (sym_map, true) == 0))
+
+int _dl_try_allocate_static_tls (struct link_map *map, bool optional)
+ attribute_hidden;
+
+#endif
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-/* This macro is used as a callback from elf_machine_rel{a,} when a
- static TLS reloc is about to be performed. Since (in dl-load.c) we
- permit dynamic loading of objects that might use such relocs, we
- have to check whether each use is actually doable. If the object
- whose TLS segment the reference resolves to was allocated space in
- the static TLS block at startup, then it's ok. Otherwise, we make
- an attempt to allocate it in surplus space on the fly. If that
- can't be done, we fall back to the error that DF_STATIC_TLS is
- intended to produce. */
-#define HAVE_STATIC_TLS(map, sym_map) \
- (__builtin_expect ((sym_map)->l_tls_offset != NO_TLS_OFFSET \
- && ((sym_map)->l_tls_offset \
- != FORCED_DYNAMIC_TLS_OFFSET), 1))
-
-#define CHECK_STATIC_TLS(map, sym_map) \
- do { \
- if (!HAVE_STATIC_TLS (map, sym_map)) \
- _dl_allocate_static_tls (sym_map); \
- } while (0)
-
-#define TRY_STATIC_TLS(map, sym_map) \
- (__builtin_expect ((sym_map)->l_tls_offset \
- != FORCED_DYNAMIC_TLS_OFFSET, 1) \
- && (__builtin_expect ((sym_map)->l_tls_offset != NO_TLS_OFFSET, 1) \
- || _dl_try_allocate_static_tls (sym_map, true) == 0))
-
-int _dl_try_allocate_static_tls (struct link_map *map, bool optional)
- attribute_hidden;
-
+#include <dl-machine.h>
#include <elf.h>
#ifdef RESOLVE_MAP
# endif
#endif
-#include <dl-machine.h>
-
-
#ifdef RESOLVE_MAP
# if defined RTLD_BOOTSTRAP || defined STATIC_PIE_BOOTSTRAP
#define _GET_DYNAMIC_INFO_H
#include <assert.h>
+#include <dl-machine-rel.h>
#include <libc-diag.h>
static inline void __attribute__ ((unused, always_inline))
-elf_get_dynamic_info (struct link_map *l, bool check)
+elf_get_dynamic_info (struct link_map *l)
{
#if __ELF_NATIVE_CLASS == 32
typedef Elf32_Word d_tag_utype;
typedef Elf64_Xword d_tag_utype;
#endif
-#if !defined RTLD_BOOTSTRAP && !defined STATIC_PIE_BOOTSTRAP
+#ifndef STATIC_PIE_BOOTSTRAP
if (l->l_ld == NULL)
return;
#endif
if (info[DT_REL] != NULL)
assert (info[DT_RELENT]->d_un.d_val == sizeof (ElfW(Rel)));
#endif
-#ifdef RTLD_BOOTSTRAP
- if (check)
- {
- /* Only the bind now flags are allowed. */
- assert (info[VERSYMIDX (DT_FLAGS_1)] == NULL
- || (info[VERSYMIDX (DT_FLAGS_1)]->d_un.d_val & ~DF_1_NOW) == 0);
- /* Flags must not be set for ld.so. */
- assert (info[DT_FLAGS] == NULL
- || (info[DT_FLAGS]->d_un.d_val & ~DF_BIND_NOW) == 0);
-# ifdef STATIC_PIE_BOOTSTRAP
- assert (info[DT_RUNPATH] == NULL);
- assert (info[DT_RPATH] == NULL);
-# endif
- }
-#else
+#ifdef STATIC_PIE_BOOTSTRAP
+ assert (info[DT_RUNPATH] == NULL);
+ assert (info[DT_RPATH] == NULL);
+#endif
if (info[DT_FLAGS] != NULL)
{
/* Flags are used. Translate to the old form where available.
if (info[DT_RUNPATH] != NULL)
/* If both RUNPATH and RPATH are given, the latter is ignored. */
info[DT_RPATH] = NULL;
-#endif
}
#endif
#include <fpu_control.h>
#include <hp-timing.h>
#include <libc-lock.h>
-#include "dynamic-link.h"
#include <dl-librecon.h>
#include <unsecvars.h>
#include <dl-cache.h>
#include <dl-main.h>
#include <gnu/lib-names.h>
#include <dl-tunables.h>
+#include <get-dynamic-info.h>
#include <assert.h>
+/* This #define produces dynamic linking inline functions for
+ bootstrap relocation instead of general-purpose relocation.
+ Since ld.so must not have any undefined symbols the result
+ is trivial: always the map of ld.so itself. */
+#define RTLD_BOOTSTRAP
+#define RESOLVE_MAP(map, scope, sym, version, flags) map
+#include "dynamic-link.h"
+
/* Only enables rtld profiling for architectures which provides non generic
hp-timing support. The generic support requires either syscall
(clock_gettime), which will incur in extra overhead on loading time.
# define bootstrap_map info.l
#endif
- /* This #define produces dynamic linking inline functions for
- bootstrap relocation instead of general-purpose relocation.
- Since ld.so must not have any undefined symbols the result
- is trivial: always the map of ld.so itself. */
-#define RTLD_BOOTSTRAP
-#define RESOLVE_MAP(map, scope, sym, version, flags) map
-#include "get-dynamic-info.h"
-#include "dynamic-link.h"
-
static ElfW(Addr) __attribute_used__
_dl_start (void *arg)
{
/* Read our own dynamic section and fill in the info array. */
bootstrap_map.l_ld = (void *) bootstrap_map.l_addr + elf_machine_dynamic ();
- elf_get_dynamic_info (&bootstrap_map, true);
+ elf_get_dynamic_info (&bootstrap_map);
#if NO_TLS_OFFSET != 0
bootstrap_map.l_tls_offset = NO_TLS_OFFSET;
if (! rtld_is_main)
{
/* Extract the contents of the dynamic section for easy access. */
- elf_get_dynamic_info (main_map, false);
+ elf_get_dynamic_info (main_map);
/* If the main map is libc.so, update the base namespace to
refer to this map. If libc.so is loaded later, this happens
l->l_map_end += l->l_addr;
l->l_text_end += l->l_addr;
l->l_ld = (void *) ((ElfW(Addr)) l->l_ld + l->l_addr);
- elf_get_dynamic_info (l, false);
+ elf_get_dynamic_info (l);
_dl_setup_hash (l);
l->l_relocated = 1;
#include <sysdep.h>
#include <tls.h>
#include <dl-tlsdesc.h>
+#include <dl-static-tls.h>
#include <dl-irel.h>
+#include <dl-machine-rel.h>
#include <cpu-features.c>
/* Translate a processor specific dynamic tag to the index in l_info array. */
#define ELF_MACHINE_JMP_SLOT AARCH64_R(JUMP_SLOT)
-/* AArch64 uses RELA not REL */
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
#define DL_PLATFORM_INIT dl_platform_init ()
static inline void __attribute__ ((unused))
}
}
-inline void
+static inline void
__attribute__ ((always_inline))
elf_machine_rela_relative (ElfW(Addr) l_addr,
const ElfW(Rela) *reloc,
#define ELF_MACHINE_NAME "alpha"
#include <string.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
/* Mask identifying addresses reserved for the user program,
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_ALPHA_JMP_SLOT
-/* The alpha never uses Elf64_Rel relocations. */
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
/* We define an initialization functions. This is called very early in
* _dl_sysdep_start. */
#define DL_PLATFORM_INIT dl_platform_init ()
#include <string.h>
#include <link.h>
#include <dl-tls.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
/* Dynamic Linking ABI for ARCv2 ISA.
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_ARC_JUMP_SLOT
-/* ARC uses Rela relocations. */
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
/* Fixup a PLT entry to bounce directly to the function at VALUE. */
static inline ElfW(Addr)
}
}
-inline void
+static inline void
__attribute__ ((always_inline))
elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
void *const reloc_addr_arg)
*reloc_addr += l_addr;
}
-inline void
+static inline void
__attribute__ ((always_inline))
elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
--- /dev/null
+/* ELF dynamic relocation type supported by the architecture. ARM version.
+ Copyright (C) 2001-2021 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/>. */
+
+#ifndef _DL_MACHINE_REL_H
+#define _DL_MACHINE_REL_H
+
+/* ARM never uses Elf32_Rela relocations for the dynamic linker.
+ Prelinked libraries may use Elf32_Rela though. */
+#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
+#define ELF_MACHINE_NO_REL 0
+
+/* ARM never uses Elf32_Rela relocations for the dynamic linker.
+ Prelinked libraries may use Elf32_Rela though. */
+#define ELF_MACHINE_PLT_REL 1
+
+#endif
#include <tls.h>
#include <dl-tlsdesc.h>
#include <dl-irel.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
#ifndef CLEAR_CACHE
# error CLEAR_CACHE definition required to handle TEXTREL
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_ARM_JUMP_SLOT
-/* ARM never uses Elf32_Rela relocations for the dynamic linker.
- Prelinked libraries may use Elf32_Rela though. */
-#define ELF_MACHINE_PLT_REL 1
-
/* We define an initialization functions. This is called very early in
_dl_sysdep_start. */
#define DL_PLATFORM_INIT dl_platform_init ()
#endif /* !dl_machine_h */
-/* ARM never uses Elf32_Rela relocations for the dynamic linker.
- Prelinked libraries may use Elf32_Rela though. */
-#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
-#define ELF_MACHINE_NO_REL 0
-
/* Names of the architecture-specific auditing callback functions. */
#define ARCH_LA_PLTENTER arm_gnu_pltenter
#define ARCH_LA_PLTEXIT arm_gnu_pltexit
#include <sys/param.h>
#include <sysdep.h>
#include <dl-tls.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
/* Return nonzero if ELF header is compatible with the running host. */
static inline int
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_CKCORE_JUMP_SLOT
-/* C-SKY never uses Elf32_Rel relocations. */
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
/* We define an initialization functions. This is called very early in
_dl_sysdep_start. */
#define DL_PLATFORM_INIT dl_platform_init ()
--- /dev/null
+/* ELF dynamic relocation type supported by the architecture.
+ Copyright (C) 2001-2021 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/>. */
+
+#ifndef _DL_MACHINE_REL_H
+#define _DL_MACHINE_REL_H
+
+/* Defined if the architecture supports Elf{32,64}_Rel relocations. */
+#define ELF_MACHINE_NO_REL 1
+/* Defined if the architecture supports Elf{32,64}_Rela relocations. */
+#define ELF_MACHINE_NO_RELA 0
+
+#endif
#include <string.h>
#include <link.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
/* Return nonzero iff ELF header is compatible with the running host. */
#include <dl-fptr.h>
#include <abort-instr.h>
#include <tls.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
/* These two definitions must match the definition of the stub in
bfd/elf32-hppa.c (see plt_stub[]).
#define ELF_MACHINE_JMP_SLOT R_PARISC_IPLT
#define ELF_MACHINE_SIZEOF_JMP_SLOT PLT_ENTRY_SIZE
-/* We only use RELA. */
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
/* Return the address of the entry point. */
#define ELF_MACHINE_START_ADDRESS(map, start) \
({ \
--- /dev/null
+/* ELF dynamic relocation type supported by the architecture. ARM version.
+ Copyright (C) 2001-2021 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/>. */
+
+#ifndef _DL_MACHINE_REL_H
+#define _DL_MACHINE_REL_H
+
+/* The i386 never uses Elf32_Rela relocations for the dynamic linker.
+ Prelinked libraries may use Elf32_Rela though. */
+#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
+#define ELF_MACHINE_NO_REL 0
+
+/* The i386 never uses Elf32_Rela relocations for the dynamic linker.
+ Prelinked libraries may use Elf32_Rela though. */
+#define ELF_MACHINE_PLT_REL 1
+
+#endif
#include <sysdep.h>
#include <tls.h>
#include <dl-tlsdesc.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
/* Return nonzero iff ELF header is compatible with the running host. */
static inline int __attribute__ ((unused))
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_386_JMP_SLOT
-/* The i386 never uses Elf32_Rela relocations for the dynamic linker.
- Prelinked libraries may use Elf32_Rela though. */
-#define ELF_MACHINE_PLT_REL 1
-
/* We define an initialization functions. This is called very early in
_dl_sysdep_start. */
#define DL_PLATFORM_INIT dl_platform_init ()
#endif /* !dl_machine_h */
-/* The i386 never uses Elf32_Rela relocations for the dynamic linker.
- Prelinked libraries may use Elf32_Rela though. */
-#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
-#define ELF_MACHINE_NO_REL 0
-
#ifdef RESOLVE_MAP
/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
#include <errno.h>
#include <dl-fptr.h>
#include <tls.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
/* Translate a processor specific dynamic tag to the index
in l_info array. */
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_IA64_IPLTLSB
-/* According to the IA-64 specific documentation, Rela is always used. */
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
/* Return the address of the entry point. */
#define ELF_MACHINE_START_ADDRESS(map, start) \
({ \
#include <sys/param.h>
#include <sysdep.h>
#include <dl-tls.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
/* Return nonzero iff ELF header is compatible with the running host. */
static inline int
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_68K_JMP_SLOT
-/* The m68k never uses Elf32_Rel relocations. */
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
static inline Elf32_Addr
elf_machine_fixup_plt (struct link_map *map, lookup_t t,
const ElfW(Sym) *refsym, const ElfW(Sym) *sym,
#include <sys/param.h>
#include <tls.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
/* Return nonzero iff ELF header is compatible with the running host. */
static inline int
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_MICROBLAZE_JUMP_SLOT
-/* The microblaze never uses Elf32_Rel relocations. */
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
static inline Elf32_Addr
elf_machine_fixup_plt (struct link_map *map, lookup_t t,
const ElfW(Sym) *refsym, const ElfW(Sym) *sym,
--- /dev/null
+/* ELF dynamic relocation type supported by the architecture. ARM version.
+ Copyright (C) 2001-2021 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/>. */
+
+#ifndef _DL_MACHINE_REL_H
+#define _DL_MACHINE_REL_H
+
+#define ELF_MACHINE_PLT_REL 1
+#define ELF_MACHINE_NO_REL 0
+#define ELF_MACHINE_NO_RELA 0
+
+#endif
#include <sysdep.h>
#include <sys/asm.h>
#include <dl-tls.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
/* The offset of gp from GOT might be system-dependent. It's set by
ld. The same value is also */
((((type) == ELF_MACHINE_JMP_SLOT) * ELF_RTYPE_CLASS_PLT) \
| (((type) == R_MIPS_COPY) * ELF_RTYPE_CLASS_COPY))
-#define ELF_MACHINE_PLT_REL 1
-#define ELF_MACHINE_NO_REL 0
-#define ELF_MACHINE_NO_RELA 0
-
/* Translate a processor specific dynamic tag to the index
in l_info array. */
#define DT_MIPS(x) (DT_MIPS_##x - DT_LOPROC + DT_NUM)
#include <string.h>
#include <link.h>
#include <dl-tls.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
/* Return nonzero iff ELF header is compatible with the running host. */
static inline int
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_NIOS2_JUMP_SLOT
-/* The Nios II never uses Elf32_Rel relocations. */
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
/* Fixup a PLT entry to bounce directly to the function at VALUE. */
static inline Elf32_Addr
#include <dl-tls.h>
#include <dl-irel.h>
#include <hwcapinfo.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
/* Translate a processor specific dynamic tag to the index
in l_info array. */
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_PPC_JMP_SLOT
-/* The PowerPC never uses REL relocations. */
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
/* We define an initialization function to initialize HWCAP/HWCAP2 and
platform data so it can be copied into the TCB later. This is called
very early in _dl_sysdep_start for dynamically linked binaries. */
--- /dev/null
+/* PowerPC ELFv1 function descriptor definition.
+ Copyright (C) 2009-2021 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/>. */
+
+#ifndef _DL_FUNCDESC_H
+#define _DL_FUNCDESC_H
+
+#if _CALL_ELF != 2
+/* A PowerPC64 function descriptor. The .plt (procedure linkage
+ table) and .opd (official procedure descriptor) sections are
+ arrays of these. */
+typedef struct
+{
+ Elf64_Addr fd_func;
+ Elf64_Addr fd_toc;
+ Elf64_Addr fd_aux;
+} Elf64_FuncDesc;
+#endif
+
+#endif
#include <stdio.h>
#include <unistd.h>
#include <ldsodefs.h>
-#include <dl-machine.h>
+#include <dl-funcdesc.h>
#define ELF_MACHINE_IRELA 1
#include <sysdep.h>
#include <hwcapinfo.h>
#include <cpu-features.c>
+#include <dl-static-tls.h>
+#include <dl-funcdesc.h>
+#include <dl-machine-rel.h>
/* Translate a processor specific dynamic tag to the index
in l_info array. */
#define DT_PPC64(x) (DT_PPC64_##x - DT_LOPROC + DT_NUM)
-#if _CALL_ELF != 2
-/* A PowerPC64 function descriptor. The .plt (procedure linkage
- table) and .opd (official procedure descriptor) sections are
- arrays of these. */
-typedef struct
-{
- Elf64_Addr fd_func;
- Elf64_Addr fd_toc;
- Elf64_Addr fd_aux;
-} Elf64_FuncDesc;
-#endif
-
#define ELF_MULT_MACHINES_SUPPORTED
/* Return nonzero iff ELF header is compatible with the running host. */
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_PPC64_JMP_SLOT
-/* The PowerPC never uses REL relocations. */
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
/* We define an initialization function to initialize HWCAP/HWCAP2 and
platform data so it can be copied into the TCB later. This is called
very early in _dl_sysdep_start for dynamically linked binaries. */
#include <sys/asm.h>
#include <dl-tls.h>
#include <dl-irel.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
#ifndef _RTLD_PROLOGUE
# define _RTLD_PROLOGUE(entry) \
|| (__WORDSIZE == 64 && (type) == R_RISCV_TLS_TPREL64))) \
| (ELF_RTYPE_CLASS_COPY * ((type) == R_RISCV_COPY)))
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
/* Return nonzero iff ELF header is compatible with the running host. */
static inline int __attribute_used__
elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
#include <link.h>
#include <sysdeps/s390/dl-procinfo.h>
#include <dl-irel.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
/* This is an older, now obsolete value. */
#define EM_S390_OLD 0xA390
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_390_JMP_SLOT
-/* The S390 never uses Elf32_Rel relocations. */
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
/* We define an initialization functions. This is called very early in
_dl_sysdep_start. */
#define DL_PLATFORM_INIT dl_platform_init ()
#include <link.h>
#include <sysdeps/s390/dl-procinfo.h>
#include <dl-irel.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
#define ELF_MACHINE_IRELATIVE R_390_IRELATIVE
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_390_JMP_SLOT
-/* The 64 bit S/390 never uses Elf64_Rel relocations. */
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
/* We define an initialization functions. This is called very early in
_dl_sysdep_start. */
#define DL_PLATFORM_INIT dl_platform_init ()
#include <sys/param.h>
#include <sysdep.h>
#include <assert.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
/* Return nonzero iff ELF header is compatible with the running host. */
static inline int __attribute__ ((unused))
#endif /* !dl_machine_h */
-/* SH never uses Elf32_Rel relocations. */
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
#ifdef RESOLVE_MAP
/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
#include <tls.h>
#include <dl-plt.h>
#include <elf/dl-hwcaps.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
/* Return nonzero iff ELF header is compatible with the running host. */
static inline int
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_SPARC_JMP_SLOT
-/* The SPARC never uses Elf32_Rel relocations. */
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
/* Undo the sub %sp, 6*4, %sp; add %sp, 22*4, %o0 below to get at the
value we want in __libc_stack_end. */
#define DL_STACK_END(cookie) \
#include <ldsodefs.h>
#include <sysdep.h>
#include <dl-plt.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
#define ELF64_R_TYPE_ID(info) ((info) & 0xff)
#define ELF64_R_TYPE_DATA(info) ((info) >> 8)
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_SPARC_JMP_SLOT
-/* The SPARC never uses Elf64_Rel relocations. */
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
/* Set up the loaded object described by L so its unrelocated PLT
entries will jump to the on-demand fixup code in dl-runtime.c. */
#include <sysdep-vdso.h>
#if (defined(__PPC64__) || defined(__powerpc64__)) && _CALL_ELF != 2
-# include <dl-machine.h>
+# include <dl-funcdesc.h>
/* The correct solution is for _dl_vdso_vsym to return the address of the OPD
for the kernel VDSO function. That address would then be stored in the
__vdso_* variables and returned as the result of the IFUNC resolver function.
#include <sysdep.h>
#include <tls.h>
#include <dl-tlsdesc.h>
+#include <dl-static-tls.h>
+#include <dl-machine-rel.h>
/* Return nonzero iff ELF header is compatible with the running host. */
static inline int __attribute__ ((unused))
// XXX This is a work-around for a broken linker. Remove!
#define ELF_MACHINE_IRELATIVE R_X86_64_IRELATIVE
-/* The x86-64 never uses Elf64_Rel/Elf32_Rel relocations. */
-#define ELF_MACHINE_NO_REL 1
-#define ELF_MACHINE_NO_RELA 0
-
/* We define an initialization function. This is called very early in
_dl_sysdep_start. */
#define DL_PLATFORM_INIT dl_platform_init ()