diff options
Diffstat (limited to 'libc/sysdeps/linux/xtensa/bits')
| -rw-r--r-- | libc/sysdeps/linux/xtensa/bits/elf-fdpic.h | 117 | ||||
| -rw-r--r-- | libc/sysdeps/linux/xtensa/bits/fcntl.h | 2 | ||||
| -rw-r--r-- | libc/sysdeps/linux/xtensa/bits/stat.h | 4 | ||||
| -rw-r--r-- | libc/sysdeps/linux/xtensa/bits/uClibc_arch_features.h | 3 | ||||
| -rw-r--r-- | libc/sysdeps/linux/xtensa/bits/xtensa-config.h | 20 | 
5 files changed, 141 insertions, 5 deletions
| diff --git a/libc/sysdeps/linux/xtensa/bits/elf-fdpic.h b/libc/sysdeps/linux/xtensa/bits/elf-fdpic.h new file mode 100644 index 000000000..19bb247b8 --- /dev/null +++ b/libc/sysdeps/linux/xtensa/bits/elf-fdpic.h @@ -0,0 +1,117 @@ +/* Copyright 2003, 2004 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. + +In addition to the permissions in the GNU Lesser General Public +License, the Free Software Foundation gives you unlimited +permission to link the compiled version of this file with other +programs, and to distribute those programs without any restriction +coming from the use of this file.  (The GNU Lesser General Public +License restrictions do apply in other respects; for example, they +cover modification of the file, and distribution when not linked +into another program.) + +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 +Library 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; see the file COPYING.LIB.  If +not, see <http://www.gnu.org/licenses/>.  */ + +#ifndef _BITS_ELF_FDPIC_H +#define _BITS_ELF_FDPIC_H + +/* These data structures are described in the FDPIC ABI extension. +   The kernel passes a process a memory map, such that for every LOAD +   segment there is an elf32_fdpic_loadseg entry.  A pointer to an +   elf32_fdpic_loadmap is passed in r7 at start-up, and a pointer to +   an additional such map is passed in r8 for the interpreter, when +   there is one.  */ + +#include <elf.h> + +/* This data structure represents a PT_LOAD segment.  */ +struct elf32_fdpic_loadseg +{ +  /* Core address to which the segment is mapped.  */ +  Elf32_Addr addr; +  /* VMA recorded in the program header.  */ +  Elf32_Addr p_vaddr; +  /* Size of this segment in memory.  */ +  Elf32_Word p_memsz; +}; + +struct elf32_fdpic_loadmap { +  /* Protocol version number, must be zero.  */ +  Elf32_Half version; +  /* Number of segments in this map.  */ +  Elf32_Half nsegs; +  /* The actual memory map.  */ +  struct elf32_fdpic_loadseg segs[/*nsegs*/]; +}; + +struct elf32_fdpic_loadaddr { +  struct elf32_fdpic_loadmap *map; +  void *got_value; +}; + +/* Map a pointer's VMA to its corresponding address according to the +   load map.  */ +static __always_inline void * +__reloc_pointer (void *p, +		 const struct elf32_fdpic_loadmap *map) +{ +  int c; + +#if 0 +  if (map->version != 0) +    /* Crash.  */ +    ((void(*)())0)(); +#endif + +  /* No special provision is made for NULL.  We don't want NULL +     addresses to go through relocation, so they shouldn't be in +     .rofixup sections, and, if they're present in dynamic +     relocations, they shall be mapped to the NULL address without +     undergoing relocations.  */ + +  for (c = 0; +       /* Take advantage of the fact that the loadmap is ordered by +	  virtual addresses.  In general there will only be 2 entries, +	  so it's not profitable to do a binary search.  */ +       c < map->nsegs && p >= (void*)map->segs[c].p_vaddr; +       c++) +    { +      /* This should be computed as part of the pointer comparison +	 above, but we want to use the carry in the comparison, so we +	 can't convert it to an integer type beforehand.  */ +      unsigned long offset = (char*)p - (char*)map->segs[c].p_vaddr; +      /* We only check for one-past-the-end for the last segment, +	 assumed to be the data segment, because other cases are +	 ambiguous in the absence of padding between segments, and +	 rofixup already serves as padding between text and data. +	 Unfortunately, unless we special-case the last segment, we +	 fail to relocate the _end symbol.  */ +      if (offset < map->segs[c].p_memsz +	  || (offset == map->segs[c].p_memsz && c + 1 == map->nsegs)) +	return (char*)map->segs[c].addr + offset; +    } + +  /* We might want to crash instead.  */ +  return (void*)-1; +} + +# define __RELOC_POINTER(ptr, loadaddr) \ +  (__reloc_pointer ((void*)(ptr), \ +		    (loadaddr).map)) + +void* +__self_reloc (const struct elf32_fdpic_loadmap *map, void ***p, void ***e); + +#endif /* _BITS_ELF_FDPIC_H */ diff --git a/libc/sysdeps/linux/xtensa/bits/fcntl.h b/libc/sysdeps/linux/xtensa/bits/fcntl.h index 5af9d2124..9bc5fa893 100644 --- a/libc/sysdeps/linux/xtensa/bits/fcntl.h +++ b/libc/sysdeps/linux/xtensa/bits/fcntl.h @@ -245,3 +245,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,  #endif  __END_DECLS +/* Include generic Linux declarations.  */ +#include <bits/fcntl-linux.h> diff --git a/libc/sysdeps/linux/xtensa/bits/stat.h b/libc/sysdeps/linux/xtensa/bits/stat.h index 045a017fd..43af825ec 100644 --- a/libc/sysdeps/linux/xtensa/bits/stat.h +++ b/libc/sysdeps/linux/xtensa/bits/stat.h @@ -54,7 +54,7 @@ struct stat      unsigned long __pad2;      __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */  #endif -#ifdef __USE_MISC +#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)      /* Nanosecond resolution timestamps are stored in a format         equivalent to 'struct timespec'.  This is the type used         whenever possible but the Unix namespace rules do not allow the @@ -94,7 +94,7 @@ struct stat64      unsigned long __pad2;      __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */ -#ifdef __USE_MISC +#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)      /* Nanosecond resolution timestamps are stored in a format         equivalent to 'struct timespec'.  This is the type used         whenever possible but the Unix namespace rules do not allow the diff --git a/libc/sysdeps/linux/xtensa/bits/uClibc_arch_features.h b/libc/sysdeps/linux/xtensa/bits/uClibc_arch_features.h index de9b38983..a15744c2f 100644 --- a/libc/sysdeps/linux/xtensa/bits/uClibc_arch_features.h +++ b/libc/sysdeps/linux/xtensa/bits/uClibc_arch_features.h @@ -11,9 +11,6 @@  /* can your target use syscall6() for mmap ? */  #define __UCLIBC_MMAP_HAS_6_ARGS__ -/* does your target use statx */ -#undef __UCLIBC_HAVE_STATX__ -  /* does your target align 64bit values in register pairs ? (32bit arches only) */  #define __UCLIBC_SYSCALL_ALIGN_64BIT__ diff --git a/libc/sysdeps/linux/xtensa/bits/xtensa-config.h b/libc/sysdeps/linux/xtensa/bits/xtensa-config.h index b99928b1e..bfcd571d2 100644 --- a/libc/sysdeps/linux/xtensa/bits/xtensa-config.h +++ b/libc/sysdeps/linux/xtensa/bits/xtensa-config.h @@ -32,21 +32,41 @@     macros.  */  #undef XCHAL_HAVE_NSA +#ifdef __XCHAL_HAVE_NSA +#define XCHAL_HAVE_NSA			__XCHAL_HAVE_NSA +#else  #define XCHAL_HAVE_NSA			1 +#endif  #undef XCHAL_HAVE_LOOPS +#ifdef __XCHAL_HAVE_LOOPS +#define XCHAL_HAVE_LOOPS		__XCHAL_HAVE_LOOPS +#else  #define XCHAL_HAVE_LOOPS		1 +#endif  /* Assume the maximum number of AR registers.  This currently only affects     the __window_spill function, and it is always safe to flush extra.  */  #undef XCHAL_NUM_AREGS +#ifdef __XCHAL_NUM_AREGS +#define XCHAL_NUM_AREGS			__XCHAL_NUM_AREGS +#else  #define XCHAL_NUM_AREGS			64 +#endif  #undef XCHAL_HAVE_S32C1I +#ifdef __XCHAL_HAVE_S32C1I +#define XCHAL_HAVE_S32C1I		__XCHAL_HAVE_S32C1I +#else  #define XCHAL_HAVE_S32C1I		1 +#endif  #undef XCHAL_HAVE_EXCLUSIVE +#ifdef __XCHAL_HAVE_EXCLUSIVE +#define XCHAL_HAVE_EXCLUSIVE		__XCHAL_HAVE_EXCLUSIVE +#else  #define XCHAL_HAVE_EXCLUSIVE		0 +#endif  #endif /* !XTENSA_CONFIG_H */ | 
