From 297b6bb585320c9ee650258fb3d3e7e812cdc5a8 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Fri, 14 May 2004 10:59:09 +0000 Subject: Alexandre Oliva writes: Here are a number of minor changes to FR-V-specific bits of the uClibc port: - I've adjusted the definition of _dl_mmap to cope with the fact that there will be a definition for an mmap2-only system. - We don't have COPY relocs, so optimize the copy reloc-related code away. - Change the page size to 16KiB, to match the ABI spec, and not a stale value I'd copied from a linker config file. Oops. - Fix error handling in clone and vfork; parts of the changes by David Howells - Rearrange includes in crtreloc.c. - Change the API of __syscall_error, to reduce code size. - Improve __syscall_return in terms of code size, so as to enable tail-calling of __syscall_error, at least within libc. Ideally, __syscall_error should be hidden within libc.so, but this didn't work because of libdl. I haven't looked into why, and figured I'd leave it visible for now. - Rename enumerators and macros in sys/ucontext.h to reduce namespace pollution. --- ldso/ldso/frv/dl-syscalls.h | 18 ++++++++---------- ldso/ldso/frv/dl-sysdep.h | 11 +++++++---- 2 files changed, 15 insertions(+), 14 deletions(-) (limited to 'ldso') diff --git a/ldso/ldso/frv/dl-syscalls.h b/ldso/ldso/frv/dl-syscalls.h index b51a78a79..3cfe2d7b1 100644 --- a/ldso/ldso/frv/dl-syscalls.h +++ b/ldso/ldso/frv/dl-syscalls.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003 Red Hat, Inc. +/* Copyright (C) 2003, 2004 Red Hat, Inc. Contributed by Alexandre Oliva This file is part of uClibc. @@ -27,28 +27,28 @@ extern int _dl_errno; /* The code below is extracted from libc/sysdeps/linux/frv/_mmap.c */ +#if DYNAMIC_LOADER_IN_SIMULATOR #define __NR___syscall_mmap2 __NR_mmap2 static inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, off_t, offset); +/* Make sure we don't get another definition of _dl_mmap from the + machine-independent code. */ +#undef __NR_mmap +#undef __NR_mmap2 + /* This is always 12, even on architectures where PAGE_SHIFT != 12. */ # ifndef MMAP2_PAGE_SHIFT # define MMAP2_PAGE_SHIFT 12 # endif -#if DYNAMIC_LOADER_IN_SIMULATOR #include /* for PAGE_SIZE */ inline static void *_dl_memset(void*,int,size_t); inline static ssize_t _dl_pread(int fd, void *buf, size_t count, off_t offset); -#endif -#ifndef DYNAMIC_LOADER_IN_SIMULATOR -inline -#endif static __ptr_t _dl_mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset) { -#ifdef DYNAMIC_LOADER_IN_SIMULATOR size_t plen = (len + PAGE_SIZE - 1) & -PAGE_SIZE; /* This is a hack to enable the dynamic loader to run within a @@ -128,14 +128,12 @@ _dl_mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset) flags |= MAP_FIXED; addr = ret; } -#endif if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) { #if 0 __set_errno (EINVAL); #endif return MAP_FAILED; } -#ifdef DYNAMIC_LOADER_IN_SIMULATOR if ((flags & MAP_FIXED) != 0) { if (_dl_pread(fd, addr, len, offset) != (ssize_t)len) @@ -144,9 +142,9 @@ _dl_mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset) _dl_memset (addr + len, 0, plen - len); return addr; } -#endif return(__syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT))); } +#endif #ifdef __NR_pread #ifdef DYNAMIC_LOADER_IN_SIMULATOR diff --git a/ldso/ldso/frv/dl-sysdep.h b/ldso/ldso/frv/dl-sysdep.h index e0faf89ed..46f8461f7 100644 --- a/ldso/ldso/frv/dl-sysdep.h +++ b/ldso/ldso/frv/dl-sysdep.h @@ -29,6 +29,8 @@ USA. */ */ #undef ELF_USES_RELOCA +#define DL_NO_COPY_RELOCS + /* * Initialization sequence for a GOT. Copy the resolver function * descriptor and the pointer to the elf_resolve/link_map data @@ -62,10 +64,11 @@ extern int _dl_linux_resolve(void) __attribute__((__visibility__("hidden"))); #define do_rem(result, n, base) result = (n % base) -/* 4096 bytes alignment */ -#define PAGE_ALIGN 0xfffff000 -#define ADDR_ALIGN 0xfff -#define OFFS_ALIGN 0x7ffff000 +/* 16KiB page alignment. Should perhaps be made dynamic using + getpagesize(), based on AT_PAGESZ from auxvt? */ +#define PAGE_ALIGN 0xffffc000 +#define ADDR_ALIGN 0x3fff +#define OFFS_ALIGN 0x7fffc000 struct funcdesc_ht; -- cgit v1.2.3