if (elf_fxstat (_STAT_VER, fd, &st) < 0)
if (__fxstat64 (_STAT_VER, fd, &st) < 0)
_dl_map_object_from_fd (const char *name, int fd, char *realname,			struct link_map *loader, int l_type, int mode){  /* This is the expected ELF header.  */#define ELF32_CLASS ELFCLASS32#define ELF64_CLASS ELFCLASS64#ifndef VALID_ELF_HEADER# define VALID_ELF_HEADER(hdr,exp,size)	(memcmp (hdr, exp, size) == 0)# define VALID_ELF_OSABI(osabi)		(osabi == ELFOSABI_SYSV)# define VALID_ELF_ABIVERSION(ver)	(ver == 0)#endif  static const unsigned char expected[EI_PAD] =  {    [EI_MAG0] = ELFMAG0,    [EI_MAG1] = ELFMAG1,    [EI_MAG2] = ELFMAG2,    [EI_MAG3] = ELFMAG3,    [EI_CLASS] = ELFW(CLASS),    [EI_DATA] = byteorder,    [EI_VERSION] = EV_CURRENT,    [EI_OSABI] = ELFOSABI_SYSV,    [EI_ABIVERSION] = 0  };  struct link_map *l = NULL;  inline caddr_t map_segment (ElfW(Addr) mapstart, size_t len,			      int prot, int fixed, off_t offset)    {      caddr_t mapat = __mmap ((caddr_t) mapstart, len, prot,			      fixed|MAP_COPY|MAP_FILE,			      fd, offset);      if (mapat == MAP_FAILED)	LOSE (errno, N_("failed to map segment from shared object"));      return mapat;    }  const ElfW(Ehdr) *header;  const ElfW(Phdr) *phdr;  const ElfW(Phdr) *ph;  size_t maplength;  int type;  char *readbuf;  ssize_t readlength;  struct elf_stat st;  /* Get file information.  */  if (elf_fxstat (_STAT_VER, fd, &st) < 0)    LOSE (errno, N_("cannot stat shared object"));  /* Look again to see if the real name matched another already loaded.  */  for (l = _dl_loaded; l; l = l->l_next)    if (l->l_ino == st.st_ino && l->l_dev == st.st_dev)      {	/* The object is already loaded.	   Just bump its reference count and return it.  */	__close (fd);	/* If the name is not in the list of names for this object add	   it.  */	free (realname);	add_name_to_object (l, name);	++l->l_opencount;	return l;      }  if (mode & RTLD_NOLOAD)    /* We are not supposed to load the object unless it is already       loaded.  So return now.  */    return NULL;  /* Print debugging message.  */  if (__builtin_expect (_dl_debug_files, 0))    _dl_debug_message (1, "file=", name, ";  generating link map\n", NULL);  /* Read the header directly.  */  readbuf = alloca (_dl_pagesize);  readlength = __libc_read (fd, readbuf, _dl_pagesize);  if (readlength < (ssize_t) sizeof (*header))    LOSE (errno, N_("cannot read file data"));  header = (void *) readbuf;  /* Check the header for basic validity.  */  if (__builtin_expect (!VALID_ELF_HEADER (header->e_ident, expected, EI_PAD),			0))    {      /* Something is wrong.  */      if (*(Elf32_Word *) &header->e_ident !=#if BYTE_ORDER == LITTLE_ENDIAN	  ((ELFMAG0 << (EI_MAG0 * 8)) |	   (ELFMAG1 << (EI_MAG1 * 8)) |	   (ELFMAG2 << (EI_MAG2 * 8)) |	   (ELFMAG3 << (EI_MAG3 * 8)))#else	  ((ELFMAG0 << (EI_MAG3 * 8)) |	   (ELFMAG1 << (EI_MAG2 * 8)) |	   (ELFMAG2 << (EI_MAG1 * 8)) |	   (ELFMAG3 << (EI_MAG0 * 8)))#endif	  )	LOSE (0, N_("invalid ELF header"));      if (header->e_ident[EI_CLASS] != ELFW(CLASS))	{	  if (__ELF_NATIVE_CLASS == 32)	    LOSE (0, N_("ELF file class not 32-bit"));	  else	    LOSE (0, N_("ELF file class not 64-bit"));	}      if (header->e_ident[EI_DATA] != byteorder)	{	  if (BYTE_ORDER == BIG_ENDIAN)	    LOSE (0, "ELF file data encoding not big-endian");	  else	    LOSE (0, "ELF file data encoding not little-endian");	}      if (header->e_ident[EI_VERSION] != EV_CURRENT)	LOSE (0, N_("ELF file version ident does not match current one"));      /* XXX We should be able so set system specific versions which are	 allowed here.  */      if (!VALID_ELF_OSABI (header->e_ident[EI_OSABI]))	LOSE (0, N_("ELF file OS ABI invalid."));      if (!VALID_ELF_ABIVERSION (header->e_ident[EI_ABIVERSION]))	LOSE (0, N_("ELF file ABI version invalid."));      LOSE (0, N_("internal error"));    }