#include <assert.h>
#include <byteswap.h>
#include <endian.h>
+#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "libelfP.h"
+#define pread_retry(fd, buf, len, off) \
+ TEMP_FAILURE_RETRY (pread (fd, buf, len, off))
+
+
Elf_Arsym *
elf_getarsym (elf, ptr)
Elf *elf;
{
/* We must read index from the file. */
assert (elf->fildes != -1);
- if (pread (elf->fildes, &elf->state.ar.ar_hdr,
- sizeof (struct ar_hdr), elf->start_offset + SARMAG)
+ if (pread_retry (elf->fildes, &elf->state.ar.ar_hdr,
+ sizeof (struct ar_hdr), elf->start_offset + SARMAG)
!= sizeof (struct ar_hdr))
{
/* It is not possible to read the index. Maybe it does not
uint32_t n;
if (elf->map_address == NULL)
{
- if (pread (elf->fildes, &n, sizeof (n),
- elf->start_offset + SARMAG + sizeof (struct ar_hdr))
+ if (pread_retry (elf->fildes, &n, sizeof (n),
+ elf->start_offset + SARMAG + sizeof (struct ar_hdr))
!= sizeof (n))
{
/* Cannot read the number of entries. */
char *new_str = (char *) (elf->state.ar.ar_sym + n + 1);
/* Now read the data from the file. */
- if ((size_t) pread (elf->fildes, file_data,
- n * sizeof (uint32_t), elf->start_offset
- + SARMAG + sizeof (struct ar_hdr)
- + sizeof (uint32_t)) != n * sizeof (uint32_t)
- || ((size_t) pread (elf->fildes, new_str,
- index_size - n * sizeof (uint32_t),
- elf->start_offset
- + SARMAG + sizeof (struct ar_hdr)
- + (n + 1) * sizeof (uint32_t))
+ if ((size_t) pread_retry (elf->fildes, file_data,
+ n * sizeof (uint32_t),
+ elf->start_offset + SARMAG
+ + sizeof (struct ar_hdr)
+ + sizeof (uint32_t))
+ != n * sizeof (uint32_t)
+ || ((size_t) pread_retry (elf->fildes, new_str,
+ index_size - n * sizeof (uint32_t),
+ elf->start_offset
+ + SARMAG + sizeof (struct ar_hdr)
+ + (n + 1) * sizeof (uint32_t))
!= index_size - n * sizeof (uint32_t)))
{
/* We were not able to read the data. */
base_cpu = @base_cpu@
bin_PROGRAMS = readelf nm size strip ld elflint findtextrel addr2line \
- elfcmp objdump ar ranlib
+ elfcmp objdump ranlib
ld_dsos = libld_elf_i386_pic.a
endif
if BUILD_STATIC
-libdw = ../libdw/libdw.a
+libdw = ../libdw/libdw.a $(libelf) $(libebl)
libelf = ../libelf/libelf.a
else
libdw = ../libdw/libdw.so
addr2line_LDADD = $(libdw) $(libmudflap)
elfcmp_LDADD = $(libebl) $(libelf) $(libmudflap) -ldl
objdump_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
-ar_LDADD = $(libelf) $(libmudflap)
ranlib_LDADD = $(libelf) $(libeu) $(libmudflap)
ldlex.o: ldscript.c