c->mapend))
return N_("ELF load command address/offset not page-aligned");
if (__glibc_unlikely
- (__mprotect ((caddr_t) (l->l_addr + c->mapend),
+ (__mprotect ((caddr_t) dl_rx_ptr (l, c->mapend),
loadcmds[nloadcmds - 1].mapstart - c->mapend,
PROT_NONE) < 0))
return DL_MAP_SEGMENTS_ERROR_MPROTECT;
l->l_map_end = l->l_map_start + maplength;
l->l_contiguous = !has_holes;
- /* TODO: l_addr is 0 in an exe, but it should cover the load segments. */
- uintptr_t l_addr = 0;
- unsigned long allocend = ALIGN_UP (loadcmds[nloadcmds - 1].allocend,
- GLRO(dl_pagesize));
- asm volatile ("cvtd %0, %x0" : "+r"(l_addr));
- asm volatile ("scbnds %0, %0, %x1" : "+r"(l_addr) : "r"(allocend));
- l->l_addr = l_addr;
-
goto postmap;
}
#endif
{
if (c->dataend > c->mapstart
/* Map the segment contents from the file. */
- && (__mmap ((void *) (l->l_addr + c->mapstart),
+ && (__mmap ((void *) dl_rx_ptr (l, c->mapstart),
c->dataend - c->mapstart, c->prot,
MAP_FIXED|MAP_COPY|MAP_FILE,
fd, c->mapoff)
after the data mapped from the file. */
elfptr_t zero, zeroend, zeropage;
- zero = l->l_addr + c->dataend;
+ zero = dl_rx_ptr (l, c->dataend);
zeroend = l->l_addr + c->allocend;
zeropage = ((zero + GLRO(dl_pagesize) - 1)
& ~(GLRO(dl_pagesize) - 1));
GL(dl_sysinfo) = DL_SYSINFO_DEFAULT;
#endif
-#ifdef __CHERI_PURE_CAPABILITY__
- /* Base is 0 in non-pie static executable, but it needs to be a valid
- capability. Use the zero capability instead of AT_BASE. */
- elfptr_t zerocap;
- asm volatile ("cvtd %0,xzr" : "=r"(zerocap));
- _dl_main_map.l_addr = zerocap;
-#endif
-
_dl_auxv = av;
dl_parse_auxv_t auxv_values;
/* Use an explicit initialization loop here because memset may not
const ElfW(Rel) *relative = (const void *) reladdr;
const ElfW(Rel) *r = relative + nrelative;
const ElfW(Rel) *end = (const void *) (reladdr + relsize);
- elfptr_t l_addr = map->l_addr;
+ ElfW(Addr) l_addr = map->l_addr;
const ElfW(Sym) *const symtab
= (const void *) D_PTR (map, l_info[DT_SYMTAB]);
const struct r_found_version *version,
void *const reloc_addr, int skip_ifunc);
static inline void __attribute__((always_inline))
-elf_machine_rel_relative (elfptr_t l_addr, const ElfW(Rel) *reloc,
+elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc,
void *const reloc_addr);
# endif
# if ! ELF_MACHINE_NO_RELA
# if ELF_MACHINE_NO_RELA || defined ELF_MACHINE_PLT_REL
static inline void __attribute__((always_inline))
elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
- elfptr_t l_addr, const ElfW(Rel) *reloc,
+ ElfW(Addr) l_addr, const ElfW(Rel) *reloc,
int skip_ifunc);
# else
static inline void __attribute__((always_inline))
elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
- elfptr_t l_addr, const ElfW(Rela) *reloc,
+ ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
int skip_ifunc);
# endif
#endif
#ifdef __CHERI_PURE_CAPABILITY__
elf_machine_rtld_base_setup (&bootstrap_map, arg);
- bootstrap_map.l_addr = elf_machine_load_address_from_args (arg);
bootstrap_map.l_ld = elf_machine_runtime_dynamic ();
#else
/* Figure out the run-time load address of the dynamic linker itself. */
case PT_PHDR:
/* Find out the load address. */
main_map->l_addr = (elfptr_t) phdr - ph->p_vaddr;
-#ifdef __CHERI_PURE_CAPABILITY__
- // TODO: we still need laddr
- asm volatile ("cvtd %0, %x0" : "+r"(main_map->l_addr));
-#endif
break;
case PT_DYNAMIC:
/* This tells us where to find the dynamic section,
{
/* These first few members are part of the protocol with the debugger.
This is the same format used in SVR4. */
- elfptr_t l_addr; /* Difference between the address in the ELF
+ ElfW(Addr) l_addr; /* Difference between the address in the ELF
file and the addresses in memory. */
char *l_name; /* Absolute file name object was found in. */
static inline void
__attribute__ ((always_inline))
elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
- uintptr_t l_addr,
+ ElfW(Addr) l_addr,
const ElfW(Rela) *reloc,
int skip_ifunc)
{