From e5294612b9ea64b36b9c5d41b497d371d05d5a11 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 15 Aug 2005 22:19:26 +0000 Subject: [PATCH] Correct build programs caused by commit from devel tree. elf_begin robustification. --- libelf/ChangeLog | 2 ++ libelf/elf_begin.c | 5 +++-- libelf/elf_getarsym.c | 33 ++++++++++++++++++++------------- src/Makefile.am | 5 ++--- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/libelf/ChangeLog b/libelf/ChangeLog index 0ef52dc14..5c68569ec 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,5 +1,7 @@ 2005-08-15 Ulrich Drepper + * elf_begin.c (__libelf_next_arhdr): Use TEMP_FAILURE_RETRY. + * Makefile (libelf_a_SOURCES): Add elf_getaroff.c. * libelf.map: Export elf_getaroff. * libelf.h: Declare elf_getaroff. diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c index 56c7a4815..c4b335953 100644 --- a/libelf/elf_begin.c +++ b/libelf/elf_begin.c @@ -740,8 +740,9 @@ __libelf_next_arhdr (elf) { ar_hdr = &elf->state.ar.ar_hdr; - if (pread (elf->fildes, ar_hdr, sizeof (struct ar_hdr), - elf->state.ar.offset) + if (TEMP_FAILURE_RETRY (pread (elf->fildes, ar_hdr, + sizeof (struct ar_hdr), + elf->state.ar.offset)) != sizeof (struct ar_hdr)) { /* Something went wrong while reading the file. */ diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c index 1dafa9ace..67b2697ca 100644 --- a/libelf/elf_getarsym.c +++ b/libelf/elf_getarsym.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -31,6 +32,10 @@ #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; @@ -69,8 +74,8 @@ elf_getarsym (elf, ptr) { /* 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 @@ -120,8 +125,8 @@ elf_getarsym (elf, ptr) 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. */ @@ -179,15 +184,17 @@ elf_getarsym (elf, ptr) 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. */ diff --git a/src/Makefile.am b/src/Makefile.am index 29a537c2d..234d1b6f6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -38,7 +38,7 @@ native_ld = @native_ld@ 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 @@ -67,7 +67,7 @@ libmudflap = -lmudflap endif if BUILD_STATIC -libdw = ../libdw/libdw.a +libdw = ../libdw/libdw.a $(libelf) $(libebl) libelf = ../libelf/libelf.a else libdw = ../libdw/libdw.so @@ -95,7 +95,6 @@ findtextrel_LDADD = $(libdw) $(libelf) $(libmudflap) 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 -- 2.47.2