public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Trust AC_SYS_LARGEFILE to provide large file support
@ 2015-10-08 20:05 Josh Stone
  0 siblings, 0 replies; 4+ messages in thread
From: Josh Stone @ 2015-10-08 20:05 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 51963 bytes --]

AC_SYS_LARGEFILE defines _FILE_OFFSET_BITS in config.h if needed for
LFS, and this automatically maps things like open to open64.  But quite
a few places used explicit 64-bit names, which won't work on platforms
like FreeBSD where off_t is always 64-bit and there are no foo64 names.
It's better to just trust that AC_SYS_LARGEFILE is doing it correctly.

But we can verify this too, as some file could easily forget to include
config.h.  The new tests/run-lfs-symbols.sh checks all build targets
against lfs-symbols (taken from lintian) to make sure everything was
implicitly mapped to 64-bit variants when _FILE_OFFSET_BITS is set.

Signed-off-by: Josh Stone <jistone@redhat.com>
---
 config/ChangeLog                     |   4 ++
 config/eu.am                         |   3 ++
 libdw/ChangeLog                      |   5 ++
 libdw/dwarf_begin.c                  |   4 +-
 libdwfl/ChangeLog                    |  25 ++++++++++
 libdwfl/argp-std.c                   |   2 +-
 libdwfl/core-file.c                  |  14 +++---
 libdwfl/dwfl_build_id_find_elf.c     |   4 +-
 libdwfl/dwfl_module_getdwarf.c       |   2 +-
 libdwfl/dwfl_report_elf.c            |   2 +-
 libdwfl/dwfl_segment_report_module.c |   2 +-
 libdwfl/find-debuginfo.c             |  16 +++----
 libdwfl/gzip.c                       |   4 +-
 libdwfl/image-header.c               |   2 +-
 libdwfl/libdwflP.h                   |   8 ++--
 libdwfl/link_map.c                   |   2 +-
 libdwfl/linux-kernel-modules.c       |  15 ++++--
 libdwfl/linux-proc-maps.c            |  10 ++--
 libdwfl/offline.c                    |   2 +-
 libdwfl/open.c                       |   4 +-
 libelf/ChangeLog                     |   5 ++
 libelf/elf_getdata_rawchunk.c        |   2 +-
 libelf/libelfP.h                     |   6 +--
 src/ChangeLog                        |  17 +++++++
 src/elflint.c                        |   4 +-
 src/findtextrel.c                    |   4 +-
 src/ld.c                             |   2 +-
 src/readelf.c                        |   6 +--
 src/strings.c                        |  68 +++++++++++++--------------
 src/strip.c                          |  12 ++---
 src/unstrip.c                        |   8 ++--
 tests/ChangeLog                      |  18 ++++++++
 tests/Makefile.am                    |   5 +-
 tests/alldts.c                       |   2 +-
 tests/arls.c                         |   4 ++
 tests/dwarf-getstring.c              |   2 +-
 tests/ecp.c                          |   4 ++
 tests/lfs-symbols                    |  73 +++++++++++++++++++++++++++++
 tests/rdwrmmap.c                     |   4 ++
 tests/run-lfs-symbols.sh             |  86 +++++++++++++++++++++++++++++++++++
 tests/test-elf_cntl_gelf_getshdr.c   |   4 ++
 tests/test-flag-nobits.c             |   6 ++-
 tests/testfile-nolfs.bz2             | Bin 0 -> 2563 bytes
 43 files changed, 368 insertions(+), 104 deletions(-)
 create mode 100644 tests/lfs-symbols
 create mode 100755 tests/run-lfs-symbols.sh
 create mode 100644 tests/testfile-nolfs.bz2

diff --git a/config/ChangeLog b/config/ChangeLog
index ba5cb387ab23..0f11b1dc3b9b 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,7 @@
+2015-10-08  Josh Stone  <jistone@redhat.com>
+
+	* eu.am (print-%): New target to print any variable.
+
 2015-10-05  Josh Stone  <jistone@redhat.com>
 
 	* eu.am (%.os): Add AM_V_CC silencers.
diff --git a/config/eu.am b/config/eu.am
index 6ad8f822bdb3..1e332efa1e9e 100644
--- a/config/eu.am
+++ b/config/eu.am
@@ -74,3 +74,6 @@ else
 textrel_found = $(textrel_msg)
 endif
 textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then $(textrel_found); fi
+
+print-%:
+	@echo $*=$($*)
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index efe6ccb8e2b1..b255f9a5da89 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-08  Josh Stone  <jistone@redhat.com>
+
+	* dwarf_begin.c (dwarf_begin): Replace stat64 and fstat64 with stat
+	and fstat.
+
 2015-10-05  Josh Stone  <jistone@redhat.com>
 
 	* Makefile.am (libdw.so): Add AM_V_CCLD and AM_V_at silencers.
diff --git a/libdw/dwarf_begin.c b/libdw/dwarf_begin.c
index d04e5b9f1b11..19d16e5c511c 100644
--- a/libdw/dwarf_begin.c
+++ b/libdw/dwarf_begin.c
@@ -73,9 +73,9 @@ dwarf_begin (int fd, Dwarf_Cmd cmd)
   if (elf == NULL)
     {
       /* Test why the `elf_begin" call failed.  */
-      struct stat64 st;
+      struct stat st;
 
-      if (fstat64 (fd, &st) == 0 && ! S_ISREG (st.st_mode))
+      if (fstat (fd, &st) == 0 && ! S_ISREG (st.st_mode))
 	__libdw_seterrno (DWARF_E_NO_REGFILE);
       else if (errno == EBADF)
 	__libdw_seterrno (DWARF_E_INVALID_FILE);
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index ee41405e8a9c..14d8528f6a02 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,28 @@
+2015-10-08  Josh Stone  <jistone@redhat.com>
+
+	* core-file.c (elf_begin_rand): Replace loff_t with off_t.
+	* open.c (decompress): Replace off64_t with off_t.
+	* gzip.c (unzip): Likewise.
+	* image-header.c (__libdw_image_header): Likewise.
+	* libdwflP.h: Likewise in function declarations.
+	* argp-std.c (parse_opt): Replace open64 with open.
+	* dwfl_build_id_find_elf.c (__libdwfl_open_mod_by_build_id,
+	dwfl_build_id_find_elf): Likewise.
+	* dwfl_module_getdwarf.c (open_elf_file): Likewise.
+	* dwfl_report_elf.c (dwfl_report_elf): Likewise.
+	* dwfl_segment_report_module.c (dwfl_segment_report_module): Likewise.
+	* link_map.c (report_r_debug): Likewise.
+	* offline.c (dwfl_report_offline): Likewise.
+	* linux-proc-maps.c (dwfl_linux_proc_find_elf): Likewise.
+	(read_proc_memory): Replace pread64 with pread.
+	* find-debuginfo.c (find_debuginfo_in_path): Replace stat64 and
+	fstat64 with stat and fstat.
+	(try_open): Likewise, and replace open64 with open.
+	* linux-kernel-modules.c: Manually define open and fopen to open64 and
+	fopen64 when needed, since the early fts.h include breaks that.
+	(try_kernel_name): Replace open64 with open.
+	(check_notes): Likewise.
+
 2015-10-07  Mark Wielaard  <mjw@redhat.com>
 
 	* dwfl_module_getdwarf.c (MAX): Removed.
diff --git a/libdwfl/argp-std.c b/libdwfl/argp-std.c
index 42b7e7838004..2bbf74fc5f53 100644
--- a/libdwfl/argp-std.c
+++ b/libdwfl/argp-std.c
@@ -273,7 +273,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
 
 	if (opt->core)
 	  {
-	    int fd = open64 (opt->core, O_RDONLY);
+	    int fd = open (opt->core, O_RDONLY);
 	    if (fd < 0)
 	      {
 		int code = errno;
diff --git a/libdwfl/core-file.c b/libdwfl/core-file.c
index ea0725bf547b..b317ecaa6e6c 100644
--- a/libdwfl/core-file.c
+++ b/libdwfl/core-file.c
@@ -43,7 +43,7 @@
    This implementation is pessimal for non-mmap cases and should
    be replaced by more diddling inside libelf internals.  */
 static Elf *
-elf_begin_rand (Elf *parent, loff_t offset, loff_t size, loff_t *next)
+elf_begin_rand (Elf *parent, off_t offset, off_t size, off_t *next)
 {
   if (parent == NULL)
     return NULL;
@@ -58,14 +58,14 @@ elf_begin_rand (Elf *parent, loff_t offset, loff_t size, loff_t *next)
     return NULL;
   }
 
-  loff_t min = (parent->kind == ELF_K_ELF ?
+  off_t min = (parent->kind == ELF_K_ELF ?
 		(parent->class == ELFCLASS32
 		 ? sizeof (Elf32_Ehdr) : sizeof (Elf64_Ehdr))
 		: parent->kind == ELF_K_AR ? SARMAG
 		: 0);
 
   if (unlikely (offset < min)
-      || unlikely (offset >= (loff_t) parent->maximum_size))
+      || unlikely (offset >= (off_t) parent->maximum_size))
     return fail (ELF_E_RANGE);
 
   /* For an archive, fetch just the size field
@@ -92,11 +92,11 @@ elf_begin_rand (Elf *parent, loff_t offset, loff_t size, loff_t *next)
       char *endp;
       size = strtoll (h.ar_size, &endp, 10);
       if (unlikely (endp == h.ar_size)
-	  || unlikely ((loff_t) parent->maximum_size - offset < size))
+	  || unlikely ((off_t) parent->maximum_size - offset < size))
 	return fail (ELF_E_INVALID_ARCHIVE);
     }
 
-  if (unlikely ((loff_t) parent->maximum_size - offset < size))
+  if (unlikely ((off_t) parent->maximum_size - offset < size))
     return fail (ELF_E_RANGE);
 
   /* Even if we fail at this point, update *NEXT to point past the file.  */
@@ -104,7 +104,7 @@ elf_begin_rand (Elf *parent, loff_t offset, loff_t size, loff_t *next)
     *next = offset + size;
 
   if (unlikely (offset == 0)
-      && unlikely (size == (loff_t) parent->maximum_size))
+      && unlikely (size == (off_t) parent->maximum_size))
     return elf_clone (parent, parent->cmd);
 
   /* Note the image is guaranteed live only as long as PARENT
@@ -114,7 +114,7 @@ elf_begin_rand (Elf *parent, loff_t offset, loff_t size, loff_t *next)
   Elf_Data *data = elf_getdata_rawchunk (parent, offset, size, ELF_T_BYTE);
   if (data == NULL)
     return NULL;
-  assert ((loff_t) data->d_size == size);
+  assert ((off_t) data->d_size == size);
   return elf_memory (data->d_buf, size);
 }
 
diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c
index 99a5059c9ddb..2e30b7abb1c5 100644
--- a/libdwfl/dwfl_build_id_find_elf.c
+++ b/libdwfl/dwfl_build_id_find_elf.c
@@ -89,7 +89,7 @@ __libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug, char **file_name,
 	break;
       memcpy (mempcpy (name, dir, dirlen), id_name, sizeof id_name);
 
-      fd = TEMP_FAILURE_RETRY (open64 (name, O_RDONLY));
+      fd = TEMP_FAILURE_RETRY (open (name, O_RDONLY));
       if (fd >= 0)
 	{
 	  if (*file_name != NULL)
@@ -146,7 +146,7 @@ dwfl_build_id_find_elf (Dwfl_Module *mod,
 	 name this callback will replace the Dwfl_Module main.name with the
 	 recorded executable file when MOD was identified as main executable
 	 (which then triggers opening and reporting of the executable).  */
-      int fd = open64 (mod->dwfl->executable_for_core, O_RDONLY);
+      int fd = open (mod->dwfl->executable_for_core, O_RDONLY);
       if (fd >= 0)
 	{
 	  *file_name = strdup (mod->dwfl->executable_for_core);
diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
index a35905775d00..8483fa216907 100644
--- a/libdwfl/dwfl_module_getdwarf.c
+++ b/libdwfl/dwfl_module_getdwarf.c
@@ -46,7 +46,7 @@ open_elf_file (Elf **elf, int *fd, char **name)
       /* If there was a pre-primed file name left that the callback left
 	 behind, try to open that file name.  */
       if (*fd < 0 && *name != NULL)
-	*fd = TEMP_FAILURE_RETRY (open64 (*name, O_RDONLY));
+	*fd = TEMP_FAILURE_RETRY (open (*name, O_RDONLY));
 
       if (*fd < 0)
 	return CBFAIL;
diff --git a/libdwfl/dwfl_report_elf.c b/libdwfl/dwfl_report_elf.c
index 624284cf6fe1..1c6e401d1ccd 100644
--- a/libdwfl/dwfl_report_elf.c
+++ b/libdwfl/dwfl_report_elf.c
@@ -291,7 +291,7 @@ dwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name, int fd,
   if (fd < 0)
     {
       closefd = true;
-      fd = open64 (file_name, O_RDONLY);
+      fd = open (file_name, O_RDONLY);
       if (fd < 0)
 	{
 	  __libdwfl_seterrno (DWFL_E_ERRNO);
diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c
index ca86c3115bb8..40553c948bfe 100644
--- a/libdwfl/dwfl_segment_report_module.c
+++ b/libdwfl/dwfl_segment_report_module.c
@@ -691,7 +691,7 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
       name = file_note_name;
       name_is_final = true;
       bool invalid = false;
-      fd = open64 (name, O_RDONLY);
+      fd = open (name, O_RDONLY);
       if (fd >= 0)
 	{
 	  Dwfl_Error error = __libdw_open_file (&fd, &elf, true, false);
diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c
index 6b8d1ac4b992..72461bc3d2a5 100644
--- a/libdwfl/find-debuginfo.c
+++ b/libdwfl/find-debuginfo.c
@@ -34,10 +34,10 @@
 #include "system.h"
 
 
-/* Try to open64 [DIR/][SUBDIR/]DEBUGLINK, return file descriptor or -1.
+/* Try to open [DIR/][SUBDIR/]DEBUGLINK, return file descriptor or -1.
    On success, *DEBUGINFO_FILE_NAME has the malloc'd name of the open file.  */
 static int
-try_open (const struct stat64 *main_stat,
+try_open (const struct stat *main_stat,
 	  const char *dir, const char *subdir, const char *debuglink,
 	  char **debuginfo_file_name)
 {
@@ -53,11 +53,11 @@ try_open (const struct stat64 *main_stat,
 	    : asprintf (&fname, "%s/%s/%s", dir, subdir, debuglink)) < 0)
     return -1;
 
-  struct stat64 st;
-  int fd = TEMP_FAILURE_RETRY (open64 (fname, O_RDONLY));
+  struct stat st;
+  int fd = TEMP_FAILURE_RETRY (open (fname, O_RDONLY));
   if (fd < 0)
     free (fname);
-  else if (fstat64 (fd, &st) == 0
+  else if (fstat (fd, &st) == 0
 	   && st.st_ino == main_stat->st_ino
 	   && st.st_dev == main_stat->st_dev)
     {
@@ -205,9 +205,9 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name,
     }
 
   /* XXX dev/ino should be cached in struct dwfl_file.  */
-  struct stat64 main_stat;
-  if (unlikely ((mod->main.fd != -1 ? fstat64 (mod->main.fd, &main_stat)
-		 : file_name != NULL ? stat64 (file_name, &main_stat)
+  struct stat main_stat;
+  if (unlikely ((mod->main.fd != -1 ? fstat (mod->main.fd, &main_stat)
+		 : file_name != NULL ? stat (file_name, &main_stat)
 		 : -1) < 0))
     {
       main_stat.st_dev = 0;
diff --git a/libdwfl/gzip.c b/libdwfl/gzip.c
index b7dde5d42308..c81e52e33fb2 100644
--- a/libdwfl/gzip.c
+++ b/libdwfl/gzip.c
@@ -75,7 +75,7 @@
    is not null on entry, we'll use it in lieu of repeating a read.  */
 
 Dwfl_Error internal_function
-unzip (int fd, off64_t start_offset,
+unzip (int fd, off_t start_offset,
        void *mapped, size_t mapped_size,
        void **whole, size_t *whole_size)
 {
@@ -231,7 +231,7 @@ unzip (int fd, off64_t start_offset,
       return DWFL_E_BADELF;
     if (start_offset != 0)
       {
-	off64_t off = lseek (d, start_offset, SEEK_SET);
+	off_t off = lseek (d, start_offset, SEEK_SET);
 	if (off != start_offset)
 	  {
 	    close (d);
diff --git a/libdwfl/image-header.c b/libdwfl/image-header.c
index a4f6799ac48a..62ccc3e35979 100644
--- a/libdwfl/image-header.c
+++ b/libdwfl/image-header.c
@@ -57,7 +57,7 @@
 
 Dwfl_Error
 internal_function
-__libdw_image_header (int fd, off64_t *start_offset,
+__libdw_image_header (int fd, off_t *start_offset,
 		      void *mapped, size_t mapped_size)
 {
   if (likely (mapped_size > H_END))
diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h
index 42a2669e7851..63556d511b6e 100644
--- a/libdwfl/libdwflP.h
+++ b/libdwfl/libdwflP.h
@@ -588,21 +588,21 @@ extern GElf_Addr __libdwfl_segment_end (Dwfl *dwfl, GElf_Addr end)
   internal_function;
 
 /* Decompression wrappers: decompress whole file into memory.  */
-extern Dwfl_Error __libdw_gunzip  (int fd, off64_t start_offset,
+extern Dwfl_Error __libdw_gunzip  (int fd, off_t start_offset,
 				   void *mapped, size_t mapped_size,
 				   void **whole, size_t *whole_size)
   internal_function;
-extern Dwfl_Error __libdw_bunzip2 (int fd, off64_t start_offset,
+extern Dwfl_Error __libdw_bunzip2 (int fd, off_t start_offset,
 				   void *mapped, size_t mapped_size,
 				   void **whole, size_t *whole_size)
   internal_function;
-extern Dwfl_Error __libdw_unlzma (int fd, off64_t start_offset,
+extern Dwfl_Error __libdw_unlzma (int fd, off_t start_offset,
 				  void *mapped, size_t mapped_size,
 				  void **whole, size_t *whole_size)
   internal_function;
 
 /* Skip the image header before a file image: updates *START_OFFSET.  */
-extern Dwfl_Error __libdw_image_header (int fd, off64_t *start_offset,
+extern Dwfl_Error __libdw_image_header (int fd, off_t *start_offset,
 					void *mapped, size_t mapped_size)
   internal_function;
 
diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c
index 9f0b4a2cb507..13cac52912e3 100644
--- a/libdwfl/link_map.c
+++ b/libdwfl/link_map.c
@@ -385,7 +385,7 @@ report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata,
 	{
 	  /* This code is mostly inlined dwfl_report_elf.  */
 	  // XXX hook for sysroot
-	  int fd = open64 (name, O_RDONLY);
+	  int fd = open (name, O_RDONLY);
 	  if (fd >= 0)
 	    {
 	      Elf *elf;
diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
index dafe893cbda5..38b5170a1a81 100644
--- a/libdwfl/linux-kernel-modules.c
+++ b/libdwfl/linux-kernel-modules.c
@@ -44,6 +44,13 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+/* Since fts.h is included before config.h, its indirect inclusions may not
+   give us the right LFS aliases of these functions, so map them manually.  */
+#ifdef _FILE_OFFSET_BITS
+#define open open64
+#define fopen fopen64
+#endif
+
 
 #define KERNEL_MODNAME	"kernel"
 
@@ -84,7 +91,7 @@ try_kernel_name (Dwfl *dwfl, char **fname, bool try_debug)
   int fd = ((((dwfl->callbacks->debuginfo_path
 	       ? *dwfl->callbacks->debuginfo_path : NULL)
 	      ?: DEFAULT_DEBUGINFO_PATH)[0] == ':') ? -1
-	    : TEMP_FAILURE_RETRY (open64 (*fname, O_RDONLY)));
+	    : TEMP_FAILURE_RETRY (open (*fname, O_RDONLY)));
 
   if (fd < 0)
     {
@@ -116,7 +123,7 @@ try_kernel_name (Dwfl *dwfl, char **fname, bool try_debug)
 	char *zname;
 	if (asprintf (&zname, "%s%s", *fname, vmlinux_suffixes[i]) > 0)
 	  {
-	    fd = TEMP_FAILURE_RETRY (open64 (zname, O_RDONLY));
+	    fd = TEMP_FAILURE_RETRY (open (zname, O_RDONLY));
 	    if (fd < 0)
 	      free (zname);
 	    else
@@ -514,7 +521,7 @@ static int
 check_notes (Dwfl_Module *mod, const char *notesfile,
 	     Dwarf_Addr vaddr, const char *secname)
 {
-  int fd = open64 (notesfile, O_RDONLY);
+  int fd = open (notesfile, O_RDONLY);
   if (fd < 0)
     return 1;
 
@@ -772,7 +779,7 @@ dwfl_linux_kernel_find_elf (Dwfl_Module *mod,
 	      && (!memcmp (f->fts_name, module_name, namelen)
 		  || !memcmp (f->fts_name, alternate_name, namelen)))
 	    {
-	      int fd = open64 (f->fts_accpath, O_RDONLY);
+	      int fd = open (f->fts_accpath, O_RDONLY);
 	      *file_name = strdup (f->fts_path);
 	      fts_close (fts);
 	      free (modulesdir[0]);
diff --git a/libdwfl/linux-proc-maps.c b/libdwfl/linux-proc-maps.c
index d0858342014e..ceffe94ceb21 100644
--- a/libdwfl/linux-proc-maps.c
+++ b/libdwfl/linux-proc-maps.c
@@ -59,7 +59,7 @@ get_pid_class (pid_t pid)
   if (asprintf (&fname, PROCEXEFMT, pid) < 0)
     return ELFCLASSNONE;
 
-  int fd = open64 (fname, O_RDONLY);
+  int fd = open (fname, O_RDONLY);
   free (fname);
   if (fd < 0)
     return ELFCLASSNONE;
@@ -95,7 +95,7 @@ grovel_auxv (pid_t pid, Dwfl *dwfl, GElf_Addr *sysinfo_ehdr)
   if (asprintf (&fname, PROCAUXVFMT, pid) < 0)
     return ENOMEM;
 
-  int fd = open64 (fname, O_RDONLY);
+  int fd = open (fname, O_RDONLY);
   free (fname);
   if (fd < 0)
     return errno == ENOENT ? 0 : errno;
@@ -315,7 +315,7 @@ read_proc_memory (void *arg, void *data, GElf_Addr address,
 		  size_t minread, size_t maxread)
 {
   const int fd = *(const int *) arg;
-  ssize_t nread = pread64 (fd, data, maxread, (off64_t) address);
+  ssize_t nread = pread (fd, data, maxread, (off_t) address);
   /* Some kernels don't actually let us do this read, ignore those errors.  */
   if (nread < 0 && (errno == EINVAL || errno == EPERM))
     return 0;
@@ -362,7 +362,7 @@ dwfl_linux_proc_find_elf (Dwfl_Module *mod __attribute__ ((unused)),
 
       if (pid == -1)
 	{
-	  int fd = open64 (module_name, O_RDONLY);
+	  int fd = open (module_name, O_RDONLY);
 	  if (fd >= 0)
 	    {
 	      *file_name = strdup (module_name);
@@ -399,7 +399,7 @@ dwfl_linux_proc_find_elf (Dwfl_Module *mod __attribute__ ((unused)),
       if (asprintf (&fname, PROCMEMFMT, pid) < 0)
 	goto detach;
 
-      int fd = open64 (fname, O_RDONLY);
+      int fd = open (fname, O_RDONLY);
       free (fname);
       if (fd < 0)
 	goto detach;
diff --git a/libdwfl/offline.c b/libdwfl/offline.c
index 982ceab0288b..c0a259926a27 100644
--- a/libdwfl/offline.c
+++ b/libdwfl/offline.c
@@ -298,7 +298,7 @@ dwfl_report_offline (Dwfl *dwfl, const char *name,
   if (fd < 0)
     {
       closefd = true;
-      fd = open64 (file_name, O_RDONLY);
+      fd = open (file_name, O_RDONLY);
       if (fd < 0)
 	{
 	  __libdwfl_seterrno (DWFL_E_ERRNO);
diff --git a/libdwfl/open.c b/libdwfl/open.c
index 40aac38801ef..c1d0ed2b8138 100644
--- a/libdwfl/open.c
+++ b/libdwfl/open.c
@@ -53,7 +53,7 @@ decompress (int fd __attribute__ ((unused)), Elf **elf)
   size_t size = 0;
 
 #if USE_ZLIB || USE_BZLIB || USE_LZMA
-  const off64_t offset = (*elf)->start_offset;
+  const off_t offset = (*elf)->start_offset;
   void *const mapped = ((*elf)->map_address == NULL ? NULL
 			: (*elf)->map_address + offset);
   const size_t mapped_size = (*elf)->maximum_size;
@@ -132,7 +132,7 @@ __libdw_open_file (int *fdp, Elf **elfp, bool close_on_fail, bool archive_ok)
       /* It's not an ELF file or a compressed file.
 	 See if it's an image with a header preceding the real file.  */
 
-      off64_t offset = elf->start_offset;
+      off_t offset = elf->start_offset;
       error = __libdw_image_header (*fdp, &offset,
 				    (elf->map_address == NULL ? NULL
 				     : elf->map_address + offset),
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 0b9ddf2b8e23..85347065cf74 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-08  Josh Stone  <jistone@redhat.com>
+
+	* libelfP.h (struct Elf): Replace off64_t with off_t.
+	* elf_getdata_rawchunk.c (elf_getdata_rawchunk): Likewise.
+
 2015-10-05  Chih-Hung Hsieh <chh@google.com>
 
 	* elf_getarsym.c (elf_getarsym): Do not use
diff --git a/libelf/elf_getdata_rawchunk.c b/libelf/elf_getdata_rawchunk.c
index 51b3e3e745eb..31b2fe7d23bf 100644
--- a/libelf/elf_getdata_rawchunk.c
+++ b/libelf/elf_getdata_rawchunk.c
@@ -41,7 +41,7 @@
 #include "common.h"
 
 Elf_Data *
-elf_getdata_rawchunk (Elf *elf, off64_t offset, size_t size, Elf_Type type)
+elf_getdata_rawchunk (Elf *elf, off_t offset, size_t size, Elf_Type type)
 {
   if (unlikely (elf == NULL))
     return NULL;
diff --git a/libelf/libelfP.h b/libelf/libelfP.h
index 3f4d654b7f34..993c6556d7da 100644
--- a/libelf/libelfP.h
+++ b/libelf/libelfP.h
@@ -316,7 +316,7 @@ struct Elf
       int ehdr_flags;		/* Flags (dirty) for ELF header.  */
       int phdr_flags;		/* Flags (dirty|malloc) for program header.  */
       int shdr_malloced;	/* Nonzero if shdr array was allocated.  */
-      off64_t sizestr_offset;	/* Offset of the size string in the parent
+      off_t sizestr_offset;	/* Offset of the size string in the parent
 				   if this is an archive member.  */
     } elf;
 
@@ -335,7 +335,7 @@ struct Elf
       int ehdr_flags;		/* Flags (dirty) for ELF header.  */
       int phdr_flags;		/* Flags (dirty|malloc) for program header.  */
       int shdr_malloced;	/* Nonzero if shdr array was allocated.  */
-      off64_t sizestr_offset;	/* Offset of the size string in the parent
+      off_t sizestr_offset;	/* Offset of the size string in the parent
 				   if this is an archive member.  */
       Elf32_Ehdr ehdr_mem;	/* Memory used for ELF header when not
 				   mmaped.  */
@@ -360,7 +360,7 @@ struct Elf
       int ehdr_flags;		/* Flags (dirty) for ELF header.  */
       int phdr_flags;		/* Flags (dirty|malloc) for program header.  */
       int shdr_malloced;	/* Nonzero if shdr array was allocated.  */
-      off64_t sizestr_offset;	/* Offset of the size string in the parent
+      off_t sizestr_offset;	/* Offset of the size string in the parent
 				   if this is an archive member.  */
       Elf64_Ehdr ehdr_mem;	/* Memory used for ELF header when not
 				   mmaped.  */
diff --git a/src/ChangeLog b/src/ChangeLog
index f577885635b9..f2514b2b43ad 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,20 @@
+2015-10-08  Josh Stone  <jistone@redhat.com>
+
+	* elflint.c (main): Replace stat64 and fstat64 with stat and fstat.
+	* readelf.c (process_file): Likewise.
+	(process_elf_file): Replace off64_t with off_t.
+	* findtextrel.c (process_file): Replace open64 with open.
+	* ld.c (main): Replace sizeof (off64_t) with 8.
+	* strings.c: Replace off64_t with off_t throughout.
+	(main): Replace stat64 and fstat64 with stat and fstat.
+	(map_file): Replace mmap64 with mmap.
+	(read_block): Likewise, and replace lseek64 with lseek.
+	* strip.c (handle_elf): Replace ftruncate64 with ftruncate.
+	(process_file): Replace stat64 and fstat64 with stat and fstat.
+	* unstrip.c (parse_opt): Replace stat64 with stat.
+	(handle_file): Replace open64 with open.
+	(open_file): Likewise.
+
 2015-10-07  Mark Wielaard  <mjw@redhat.com>
 
 	* unstrip.c (MAX): Removed.
diff --git a/src/elflint.c b/src/elflint.c
index c1f0be5eee1b..fac457ea6c4c 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -164,9 +164,9 @@ main (int argc, char *argv[])
       else
 	{
 	  unsigned int prev_error_count = error_count;
-	  struct stat64 st;
+	  struct stat st;
 
-	  if (fstat64 (fd, &st) != 0)
+	  if (fstat (fd, &st) != 0)
 	    {
 	      printf ("cannot stat '%s': %m\n", argv[remaining]);
 	      close (fd);
diff --git a/src/findtextrel.c b/src/findtextrel.c
index 0ac6ede287ea..e78d7b8a17ab 100644
--- a/src/findtextrel.c
+++ b/src/findtextrel.c
@@ -215,7 +215,7 @@ process_file (const char *fname, bool more_than_one)
       real_fname = new_fname;
     }
 
-  int fd = open64 (real_fname, O_RDONLY);
+  int fd = open (real_fname, O_RDONLY);
   if (fd == -1)
     {
       error (0, errno, gettext ("cannot open '%s'"), fname);
@@ -388,7 +388,7 @@ cannot get program header index at offset %zd: %s"),
 			   fname, fname_len),
 		  ".debug");
 
-	  fd2 = open64 (difname, O_RDONLY);
+	  fd2 = open (difname, O_RDONLY);
 	  if (fd2 != -1
 	      && (elf2 = elf_begin (fd2, ELF_C_READ_MMAP, NULL)) != NULL)
 	    dw = dwarf_begin_elf (elf2, DWARF_C_READ, NULL);
diff --git a/src/ld.c b/src/ld.c
index 6e96ae26b4f6..9685e31c0220 100644
--- a/src/ld.c
+++ b/src/ld.c
@@ -277,7 +277,7 @@ main (int argc, char *argv[])
   int err;
 
   /* Sanity check.  We always want to use the LFS functionality.  */
-  if (sizeof (off_t) != sizeof (off64_t))
+  if (sizeof (off_t) != 8)
     abort ();
 
   /* We use no threads here which can interfere with handling a stream.  */
diff --git a/src/readelf.c b/src/readelf.c
index fe7bc392f8b4..5f6e4edd53c2 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -764,8 +764,8 @@ process_file (int fd, const char *fname, bool only_one)
     dwfl->offline_next_address = 0;
   if (dwfl_report_offline (dwfl, fname, fname, dwfl_fd) == NULL)
     {
-      struct stat64 st;
-      if (fstat64 (dwfl_fd, &st) != 0)
+      struct stat st;
+      if (fstat (dwfl_fd, &st) != 0)
 	error (0, errno, gettext ("cannot stat input file"));
       else if (unlikely (st.st_size == 0))
 	error (0, 0, gettext ("input file is empty"));
@@ -848,7 +848,7 @@ process_elf_file (Dwfl_Module *dwflmod, int fd)
   if (ehdr->e_type == ET_REL && print_unrelocated)
     {
       /* Read the file afresh.  */
-      off64_t aroff = elf_getaroff (elf);
+      off_t aroff = elf_getaroff (elf);
       pure_elf = elf_begin (fd, ELF_C_READ_MMAP, NULL);
       if (aroff > 0)
 	{
diff --git a/src/strings.c b/src/strings.c
index 397ce429bb2d..c1d63cd6fa9b 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -49,8 +49,8 @@
 
 
 /* Prototypes of local functions.  */
-static int read_fd (int fd, const char *fname, off64_t fdlen);
-static int read_elf (Elf *elf, int fd, const char *fname, off64_t fdlen);
+static int read_fd (int fd, const char *fname, off_t fdlen);
+static int read_elf (Elf *elf, int fd, const char *fname, off_t fdlen);
 
 
 /* Name and version of program.  */
@@ -138,7 +138,7 @@ static size_t ps;
 static unsigned char *elfmap;
 static unsigned char *elfmap_base;
 static size_t elfmap_size;
-static off64_t elfmap_off;
+static off_t elfmap_off;
 
 
 int
@@ -167,14 +167,14 @@ main (int argc, char *argv[])
   /* Determine the page size.  We will likely need it a couple of times.  */
   ps = sysconf (_SC_PAGESIZE);
 
-  struct stat64 st;
+  struct stat st;
   int result = 0;
   if (remaining == argc)
     /* We read from standard input.  This we cannot do for a
        structured file.  */
     result = read_fd (STDIN_FILENO,
 		      print_file_name ? "{standard input}" : NULL,
-		      (fstat64 (STDIN_FILENO, &st) == 0 && S_ISREG (st.st_mode))
+		      (fstat (STDIN_FILENO, &st) == 0 && S_ISREG (st.st_mode))
 		      ? st.st_size : INT64_C (0x7fffffffffffffff));
   else
     do
@@ -189,10 +189,10 @@ main (int argc, char *argv[])
 	else
 	  {
 	    const char *fname = print_file_name ? argv[remaining] : NULL;
-	    int fstat_fail = fstat64 (fd, &st);
-	    off64_t fdlen = (fstat_fail
+	    int fstat_fail = fstat (fd, &st);
+	    off_t fdlen = (fstat_fail
 			     ? INT64_C (0x7fffffffffffffff) : st.st_size);
-	    if (fdlen > (off64_t) min_len_bytes)
+	    if (fdlen > (off_t) min_len_bytes)
 	      {
 		Elf *elf = NULL;
 		if (entire_file
@@ -326,7 +326,7 @@ parse_opt (int key, char *arg,
 
 
 static void
-process_chunk_mb (const char *fname, const unsigned char *buf, off64_t to,
+process_chunk_mb (const char *fname, const unsigned char *buf, off_t to,
 		  size_t len, char **unprinted)
 {
   size_t curlen = *unprinted == NULL ? 0 : strlen (*unprinted);
@@ -403,7 +403,7 @@ process_chunk_mb (const char *fname, const unsigned char *buf, off64_t to,
 
 
 static void
-process_chunk (const char *fname, const unsigned char *buf, off64_t to,
+process_chunk (const char *fname, const unsigned char *buf, off_t to,
 	       size_t len, char **unprinted)
 {
   /* We are not going to slow the check down for the 2- and 4-byte
@@ -467,7 +467,7 @@ process_chunk (const char *fname, const unsigned char *buf, off64_t to,
 
 /* Map a file in as large chunks as possible.  */
 static void *
-map_file (int fd, off64_t start_off, off64_t fdlen, size_t *map_sizep)
+map_file (int fd, off_t start_off, off_t fdlen, size_t *map_sizep)
 {
   /* Maximum size we mmap.  We use an #ifdef to avoid overflows on
      32-bit machines.  64-bit machines these days do not have usable
@@ -480,7 +480,7 @@ map_file (int fd, off64_t start_off, off64_t fdlen, size_t *map_sizep)
 # endif
 
   /* Try to mmap the file.  */
-  size_t map_size = MIN ((off64_t) mmap_max, fdlen);
+  size_t map_size = MIN ((off_t) mmap_max, fdlen);
   const size_t map_size_min = MAX (MAX (SIZE_MAX / 16, 2 * ps),
 				   roundup (2 * min_len_bytes + 1, ps));
   void *mem;
@@ -489,8 +489,8 @@ map_file (int fd, off64_t start_off, off64_t fdlen, size_t *map_sizep)
       /* We map the memory for reading only here.  Since we will
 	 always look at every byte of the file it makes sense to
 	 use MAP_POPULATE.  */
-      mem = mmap64 (NULL, map_size, PROT_READ, MAP_PRIVATE | MAP_POPULATE,
-		    fd, start_off);
+      mem = mmap (NULL, map_size, PROT_READ, MAP_PRIVATE | MAP_POPULATE,
+		  fd, start_off);
       if (mem != MAP_FAILED)
 	{
 	  /* We will go through the mapping sequentially.  */
@@ -515,7 +515,7 @@ map_file (int fd, off64_t start_off, off64_t fdlen, size_t *map_sizep)
 
 /* Read the file without mapping.  */
 static int
-read_block_no_mmap (int fd, const char *fname, off64_t from, off64_t fdlen)
+read_block_no_mmap (int fd, const char *fname, off_t from, off_t fdlen)
 {
   char *unprinted = NULL;
 #define CHUNKSIZE 65536
@@ -577,7 +577,7 @@ read_block_no_mmap (int fd, const char *fname, off64_t from, off64_t fdlen)
 
 
 static int
-read_block (int fd, const char *fname, off64_t fdlen, off64_t from, off64_t to)
+read_block (int fd, const char *fname, off_t fdlen, off_t from, off_t to)
 {
   if (elfmap == NULL)
     {
@@ -596,23 +596,23 @@ read_block (int fd, const char *fname, off64_t fdlen, off64_t from, off64_t to)
 	 read pointer.  */
       // XXX Eventually add flag which avoids this if the position
       // XXX is known to match.
-      if (from != 0 && lseek64 (fd, from, SEEK_SET) != from)
-	error (EXIT_FAILURE, errno, gettext ("lseek64 failed"));
+      if (from != 0 && lseek (fd, from, SEEK_SET) != from)
+	error (EXIT_FAILURE, errno, gettext ("lseek failed"));
 
       return read_block_no_mmap (fd, fname, from, to - from);
     }
 
-  assert ((off64_t) min_len_bytes < fdlen);
+  assert ((off_t) min_len_bytes < fdlen);
 
-  if (to < (off64_t) elfmap_off || from > (off64_t) (elfmap_off + elfmap_size))
+  if (to < (off_t) elfmap_off || from > (off_t) (elfmap_off + elfmap_size))
     {
       /* The existing mapping cannot fit at all.  Map the new area.
 	 We always map the full range of ELFMAP_SIZE bytes even if
 	 this extend beyond the end of the file.  The Linux kernel
 	 handles this OK if the access pages are not touched.  */
       elfmap_off = from & ~(ps - 1);
-      if (mmap64 (elfmap, elfmap_size, PROT_READ,
-		  MAP_PRIVATE | MAP_POPULATE | MAP_FIXED, fd, from)
+      if (mmap (elfmap, elfmap_size, PROT_READ,
+		MAP_PRIVATE | MAP_POPULATE | MAP_FIXED, fd, from)
 	  == MAP_FAILED)
 	error (EXIT_FAILURE, errno, gettext ("re-mmap failed"));
       elfmap_base = elfmap;
@@ -622,23 +622,23 @@ read_block (int fd, const char *fname, off64_t fdlen, off64_t from, off64_t to)
 
   /* Use the existing mapping as much as possible.  If necessary, map
      new pages.  */
-  if (from >= (off64_t) elfmap_off
-      && from < (off64_t) (elfmap_off + elfmap_size))
+  if (from >= (off_t) elfmap_off
+      && from < (off_t) (elfmap_off + elfmap_size))
     /* There are at least a few bytes in this mapping which we can
        use.  */
     process_chunk (fname, elfmap_base + (from - elfmap_off),
-		   MIN (to, (off64_t) (elfmap_off + elfmap_size)),
-		   MIN (to, (off64_t) (elfmap_off + elfmap_size)) - from,
+		   MIN (to, (off_t) (elfmap_off + elfmap_size)),
+		   MIN (to, (off_t) (elfmap_off + elfmap_size)) - from,
 		   &unprinted);
 
-  if (to > (off64_t) (elfmap_off + elfmap_size))
+  if (to > (off_t) (elfmap_off + elfmap_size))
     {
       unsigned char *remap_base = elfmap_base;
       size_t read_now = elfmap_size - (elfmap_base - elfmap);
 
-      assert (from >= (off64_t) elfmap_off
-	      && from < (off64_t) (elfmap_off + elfmap_size));
-      off64_t handled_to = elfmap_off + elfmap_size;
+      assert (from >= (off_t) elfmap_off
+	      && from < (off_t) (elfmap_off + elfmap_size));
+      off_t handled_to = elfmap_off + elfmap_size;
       assert (elfmap == elfmap_base
 	      || (elfmap_base - elfmap
 		  == (ptrdiff_t) ((min_len_bytes + ps - 1) & ~(ps - 1))));
@@ -675,8 +675,8 @@ read_block (int fd, const char *fname, off64_t fdlen, off64_t from, off64_t to)
 
 	  assert (handled_to % ps == 0);
 	  assert (handled_to % bytes_per_char == 0);
-	  if (mmap64 (remap_base, read_now, PROT_READ,
-		      MAP_PRIVATE | MAP_POPULATE | MAP_FIXED, fd, handled_to)
+	  if (mmap (remap_base, read_now, PROT_READ,
+		    MAP_PRIVATE | MAP_POPULATE | MAP_FIXED, fd, handled_to)
 	      == MAP_FAILED)
 	    error (EXIT_FAILURE, errno, gettext ("re-mmap failed"));
 	  elfmap_off = handled_to;
@@ -700,14 +700,14 @@ read_block (int fd, const char *fname, off64_t fdlen, off64_t from, off64_t to)
 
 
 static int
-read_fd (int fd, const char *fname, off64_t fdlen)
+read_fd (int fd, const char *fname, off_t fdlen)
 {
   return read_block (fd, fname, fdlen, 0, fdlen);
 }
 
 
 static int
-read_elf (Elf *elf, int fd, const char *fname, off64_t fdlen)
+read_elf (Elf *elf, int fd, const char *fname, off_t fdlen)
 {
   assert (fdlen >= 0);
 
diff --git a/src/strip.c b/src/strip.c
index 41169eda898c..6c2a87cc432d 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -310,12 +310,12 @@ process_file (const char *fname)
   /* If we have to preserve the modify and access timestamps get them
      now.  We cannot use fstat() after opening the file since the open
      would change the access time.  */
-  struct stat64 pre_st;
+  struct stat pre_st;
   struct timespec tv[2];
  again:
   if (preserve_dates)
     {
-      if (stat64 (fname, &pre_st) != 0)
+      if (stat (fname, &pre_st) != 0)
 	{
 	  error (0, errno, gettext ("cannot stat input file '%s'"), fname);
 	  return 1;
@@ -338,8 +338,8 @@ process_file (const char *fname)
   /* We always use fstat() even if we called stat() before.  This is
      done to make sure the information returned by stat() is for the
      same file.  */
-  struct stat64 st;
-  if (fstat64 (fd, &st) != 0)
+  struct stat st;
+  if (fstat (fd, &st) != 0)
     {
       error (0, errno, gettext ("cannot stat input file '%s'"), fname);
       return 1;
@@ -2113,7 +2113,7 @@ while computing checksum for debug information"));
 	      || (pwrite_retry (fd, zero, sizeof zero,
 				offsetof (Elf32_Ehdr, e_shentsize))
 		  != sizeof zero)
-	      || ftruncate64 (fd, shdr_info[shdridx].shdr.sh_offset) < 0)
+	      || ftruncate (fd, shdr_info[shdridx].shdr.sh_offset) < 0)
 	    {
 	      error (0, errno, gettext ("while writing '%s'"),
 		     output_fname ?: fname);
@@ -2133,7 +2133,7 @@ while computing checksum for debug information"));
 	      || (pwrite_retry (fd, zero, sizeof zero,
 				offsetof (Elf64_Ehdr, e_shentsize))
 		  != sizeof zero)
-	      || ftruncate64 (fd, shdr_info[shdridx].shdr.sh_offset) < 0)
+	      || ftruncate (fd, shdr_info[shdridx].shdr.sh_offset) < 0)
 	    {
 	      error (0, errno, gettext ("while writing '%s'"),
 		     output_fname ?: fname);
diff --git a/src/unstrip.c b/src/unstrip.c
index b725987c462a..bc8ed5037c00 100644
--- a/src/unstrip.c
+++ b/src/unstrip.c
@@ -176,9 +176,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
 
       if (info->output_dir != NULL)
 	{
-	  struct stat64 st;
+	  struct stat st;
 	  error_t fail = 0;
-	  if (stat64 (info->output_dir, &st) < 0)
+	  if (stat (info->output_dir, &st) < 0)
 	    fail = errno;
 	  else if (!S_ISDIR (st.st_mode))
 	    fail = ENOTDIR;
@@ -1988,7 +1988,7 @@ DWARF data in '%s' not adjusted for prelinking bias; consider prelink -u"),
 	make_directories (output_file);
 
       /* Copy the unstripped file and then modify it.  */
-      int outfd = open64 (output_file, O_RDWR | O_CREAT,
+      int outfd = open (output_file, O_RDWR | O_CREAT,
 			  stripped_ehdr->e_type == ET_REL ? 0666 : 0777);
       if (outfd < 0)
 	error (EXIT_FAILURE, errno, _("cannot open '%s'"), output_file);
@@ -2018,7 +2018,7 @@ DWARF data in '%s' not adjusted for prelinking bias; consider prelink -u"),
 static int
 open_file (const char *file, bool writable)
 {
-  int fd = open64 (file, writable ? O_RDWR : O_RDONLY);
+  int fd = open (file, writable ? O_RDWR : O_RDONLY);
   if (fd < 0)
     error (EXIT_FAILURE, errno, _("cannot open '%s'"), file);
   return fd;
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 66781d0cee74..e87bdf3fa30d 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,21 @@
+2015-10-08  Josh Stone  <jistone@redhat.com>
+
+	* lfs-symbols: New list of LFS-related symbols from lintian.
+	* testfile-nolfs.bz2: New test binary for sanity checking.
+	* run-lfs-symbols.sh: New test.
+	* Makefile.am (TESTS): Add run-lfs-symbols.sh.
+	(EXTRA_DIST): Add lfs-symbols, testfile-nolfs.bz2, and
+	run-lfs-symbols.sh.
+	* alldts.c (main): Replace open64 with open.
+	* dwarf-getstring.c (main): Likewise.
+	* arls.c: Include config.h.
+	* ecp.c: Likewise.
+	* rdwrmmap.c: Likewise.
+	* test-elf_cntl_gelf_getshdr.c: Likewise.
+	* test-flag-nobits.c: Include config.h.
+	(main): Replace open64 with open.
+	* Makefile.am: 
+
 2015-10-05  Josh Stone  <jistone@redhat.com>
 
 	* Makefile.am (backtrace-child-biarch): Add AM_V_CC silencer.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fc9b648d2f02..5612fc7b5f48 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -120,7 +120,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
 	run-readelf-dwz-multi.sh run-allfcts-multi.sh run-deleted.sh \
 	run-linkmap-cut.sh run-aggregate-size.sh vdsosyms run-readelf-A.sh \
 	run-getsrc-die.sh run-strptr.sh newdata elfstrtab dwfl-proc-attach \
-	elfshphehdr
+	elfshphehdr run-lfs-symbols.sh
 
 if !BIARCH
 export ELFUTILS_DISABLE_BIARCH = 1
@@ -303,7 +303,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
 	     run-getsrc-die.sh run-strptr.sh \
 	     testfile-x32-core.bz2 testfile-x32.bz2 \
 	     backtrace.x32.core.bz2 backtrace.x32.exec.bz2 \
-	     testfile-x32-s.bz2 testfile-x32-d.bz2 testfile-x32-debug.bz2
+	     testfile-x32-s.bz2 testfile-x32-d.bz2 testfile-x32-debug.bz2 \
+	     run-lfs-symbols.sh lfs-symbols testfile-nolfs.bz2
 
 if USE_VALGRIND
 valgrind_cmd='valgrind -q --error-exitcode=1 --run-libc-freeres=no'
diff --git a/tests/alldts.c b/tests/alldts.c
index 378aa412a70e..c39b8fb61772 100644
--- a/tests/alldts.c
+++ b/tests/alldts.c
@@ -68,7 +68,7 @@ main (void)
   (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER);
 
   /* Open the file.  */
-  int fd = open64 (fname, O_RDWR | O_CREAT | O_TRUNC, 0666);
+  int fd = open (fname, O_RDWR | O_CREAT | O_TRUNC, 0666);
   if (fd == -1)
     {
       printf ("cannot open `%s': %m\n", fname);
diff --git a/tests/arls.c b/tests/arls.c
index cd8e4b81d3ca..ca0d3e6e6533 100644
--- a/tests/arls.c
+++ b/tests/arls.c
@@ -14,6 +14,10 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include <ar.h>
 #include <fcntl.h>
 #include <libelf.h>
diff --git a/tests/dwarf-getstring.c b/tests/dwarf-getstring.c
index b70c2a70cdd9..824edef87f91 100644
--- a/tests/dwarf-getstring.c
+++ b/tests/dwarf-getstring.c
@@ -37,7 +37,7 @@ main (int argc, char *argv[])
       Dwarf_Off offset = 0;
       size_t len;
 
-      int fd = open64 (argv[cnt], O_RDONLY);
+      int fd = open (argv[cnt], O_RDONLY);
       if (fd == -1)
 	{
 	  printf ("cannot open '%s': %m\n", argv[cnt]);
diff --git a/tests/ecp.c b/tests/ecp.c
index 39a48510ee7d..38a6859e8b2b 100644
--- a/tests/ecp.c
+++ b/tests/ecp.c
@@ -15,6 +15,10 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include <errno.h>
 #include <error.h>
 #include <fcntl.h>
diff --git a/tests/lfs-symbols b/tests/lfs-symbols
new file mode 100644
index 000000000000..282a4ad4b05b
--- /dev/null
+++ b/tests/lfs-symbols
@@ -0,0 +1,73 @@
+# Imported from lintian/data/binaries/lfs-symbols
+#
+# Exceptions:
+#   fts* - linux-kernel-modules.c is careful with FTS_NOSTAT
+
+# Manually maintained list of non-lfs symbols
+#
+# List was found by grepping around in /usr/include on an i386 system
+# with build-essential installed
+#
+# Please keep this sorted by key.
+
+__fxstat
+__fxstatat
+__lxstat
+__xstat
+aio_cancel
+aio_error
+aio_fsync
+aio_read
+aio_return
+aio_suspend
+aio_write
+alphasort
+creat
+fallocate
+fgetpos
+fopen
+freopen
+fseeko
+fsetpos
+fstatfs
+fstatvfs
+ftello
+ftruncate
+#fts_open
+#fts_read
+#fts_children
+#fts_set
+#fts_close
+ftw
+getdirentries
+getrlimit
+glob
+globfree
+lio_listio
+lockf
+lseek
+mkostemp
+mkostemps
+mkstemp
+mkstemps
+mmap
+nftw
+open
+openat
+posix_fadvise
+posix_fallocate
+pread
+preadv
+prlimit
+pwrite
+pwritev
+readdir
+readdir_r
+scandir
+sendfile
+setrlimit
+statfs
+statvfs
+tmpfile
+truncate
+versionsort
diff --git a/tests/rdwrmmap.c b/tests/rdwrmmap.c
index 95a4df3554a4..6f027dfed8a3 100644
--- a/tests/rdwrmmap.c
+++ b/tests/rdwrmmap.c
@@ -14,6 +14,10 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include <errno.h>
 #include <error.h>
 #include <stdio.h>
diff --git a/tests/run-lfs-symbols.sh b/tests/run-lfs-symbols.sh
new file mode 100755
index 000000000000..f0894405dae6
--- /dev/null
+++ b/tests/run-lfs-symbols.sh
@@ -0,0 +1,86 @@
+#! /bin/bash
+# Copyright (C) 2015 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/test-subr.sh
+
+if ! grep -q -F '#define _FILE_OFFSET_BITS' ${abs_top_builddir}/config.h; then
+  echo "LFS testing is irrelevent on this system"
+  exit 77
+fi
+
+# #include <stdio.h>
+# int main () {
+#     FILE *f = fopen ("/dev/null", "r");
+#     return f == NULL;
+# }
+#
+# Built for Linux i686, without setting _FILE_OFFSET_BITS.
+# $ gcc -m32 -O2 nolfs.c -o testfile-nolfs
+testfiles testfile-nolfs
+
+LFS_FORMAT='BEGIN {
+  while ((getline < "%s") > 0)
+    /^\w/ && bad[$0]
+  FS="@"
+}
+/@@GLIBC_/ && $1 in bad { print $1 }'
+
+LFS=$(printf "$LFS_FORMAT" "${abs_srcdir}/lfs-symbols")
+
+makeprint() {
+  make print-$1 -C $2 |& awk -F= "/^$1=/{ print \$2 }"
+}
+
+testrun_lfs() {
+  bad=$(testrun ${abs_top_builddir}/src/nm -u "$1" | awk "$LFS")
+  if [ -n "$bad" ]; then
+    echo "$1 contains non-lfs symbols:" $bad
+    exit_status=1
+  fi
+}
+
+# First sanity-check that LFS detection works.
+exit_status=0
+testrun_lfs ./testfile-nolfs
+if [ $exit_status -eq 0 ]; then
+  echo "Didn't detect any problem with testfile-nolfs!"
+  exit 99
+fi
+
+exit_status=0
+
+# Check all normal build targets.
+for dir in libelf libdw libasm libcpu src; do
+  dir=${abs_top_builddir}/$dir
+  for program in $(makeprint PROGRAMS $dir); do
+    testrun_lfs $dir/$program
+  done
+done
+
+# Check all libebl modules.
+dir=${abs_top_builddir}/backends
+for module in $(makeprint modules $dir); do
+  testrun_lfs $dir/libebl_$module.so
+done
+
+# Check all test programs.
+dir=${abs_builddir}
+for program in $(makeprint check_PROGRAMS $dir); do
+  testrun_lfs $dir/$program
+done
+
+exit $exit_status
diff --git a/tests/test-elf_cntl_gelf_getshdr.c b/tests/test-elf_cntl_gelf_getshdr.c
index b561b53cb4f1..7371110c75e2 100644
--- a/tests/test-elf_cntl_gelf_getshdr.c
+++ b/tests/test-elf_cntl_gelf_getshdr.c
@@ -14,6 +14,10 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <stdio.h>
diff --git a/tests/test-flag-nobits.c b/tests/test-flag-nobits.c
index e58d8c3df540..ff19ce202ea3 100644
--- a/tests/test-flag-nobits.c
+++ b/tests/test-flag-nobits.c
@@ -14,6 +14,10 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include <fcntl.h>
 #include <stdlib.h>
 #include <gelf.h>
@@ -26,7 +30,7 @@ main (int argc, char **argv)
 
   elf_version (EV_CURRENT);
 
-  int fd = open64 (argv[1], O_RDONLY);
+  int fd = open (argv[1], O_RDONLY);
   Elf *stripped = elf_begin (fd, ELF_C_READ, NULL);
 
   Elf_Scn *scn = NULL;
diff --git a/tests/testfile-nolfs.bz2 b/tests/testfile-nolfs.bz2
new file mode 100644
index 0000000000000000000000000000000000000000..ab8351e9e661744fff69e589dad177a82c677920
GIT binary patch
literal 2563
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
ZlOIFb^Haj?c{%^Z+>uTcBsX_wtw0~Mm(a)ohU

literal 0
HcmV?d00001

-- 
2.4.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Trust AC_SYS_LARGEFILE to provide large file support
@ 2015-10-10 11:13 Mark Wielaard
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Wielaard @ 2015-10-10 11:13 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 1853 bytes --]

On Fri, Oct 09, 2015 at 09:40:49AM -0700, Josh Stone wrote:
> On 10/09/2015 04:17 AM, Mark Wielaard wrote:
> > What is the story behind fts.h? Is its usage not off_t 64bit clean?
> 
> See https://sourceware.org/bugzilla/show_bug.cgi?id=11460
> 
> Of course it does support 64-bit off_t, as it must for native 64-bit
> platforms.  I guess the problem is just that it doesn't have the
> duplicated interfaces for 32-bit with/without _FILE_OFFSET_BITS.
> 
> Note that struct _ftsent contains a struct stat.  So it would need
> versions with either stat or stat64, and all of the functions updated to
> swing both ways too.

That is a pity, since we explicitly use FTS_NOSTAT so the stat call
and the struct stat value are completely unused.

> There is the similar ftw.h which has full LFS, but the FTW_SKIP_SUBTREE
> action is a GNU extension.  We now use FTS_SKIP to prune the "source"
> directory from kernel module walks.  We wouldn't be able to do this with
> ftw on FreeBSD, for example, but it's for Linux modules anyway so maybe
> we don't care.
>
> Want to convert to ftw and accept the lack of skipping as a fallback?
> (There may be other fts/ftw differences that I haven't noticed yet.)

The major other difference seems to be that with (n)ftw you always
stat every file explicitly. Which seems precisely what we want to
avoid in this case because we are only interested in the names.

Since it is indeed linux kernel module specific and we now have that
test to make sure we don't accidentially use non-lfs symbols I think
for now we should just leave it. It might be nice to make the glibc
implementation LFS compliant. Then we could just have a configure test
to see whether or not fts.h can be included with/without _FILE_OFFSET_BITS
set. But that seems something for that far future.

Thanks,

Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Trust AC_SYS_LARGEFILE to provide large file support
@ 2015-10-09 16:40 Josh Stone
  0 siblings, 0 replies; 4+ messages in thread
From: Josh Stone @ 2015-10-09 16:40 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 2922 bytes --]

On 10/09/2015 04:17 AM, Mark Wielaard wrote:
> On Thu, 2015-10-08 at 13:05 -0700, Josh Stone wrote:
>> AC_SYS_LARGEFILE defines _FILE_OFFSET_BITS in config.h if needed for
>> LFS, and this automatically maps things like open to open64.  But quite
>> a few places used explicit 64-bit names, which won't work on platforms
>> like FreeBSD where off_t is always 64-bit and there are no foo64 names.
>> It's better to just trust that AC_SYS_LARGEFILE is doing it correctly.
>>
>> But we can verify this too, as some file could easily forget to include
>> config.h.  The new tests/run-lfs-symbols.sh checks all build targets
>> against lfs-symbols (taken from lintian) to make sure everything was
>> implicitly mapped to 64-bit variants when _FILE_OFFSET_BITS is set.
> 
> Very nice cleanup and a clever testscase.
> Please do check it in.

Thanks!  Will do.

> Two questions though (they can be dealt with separately):
> 
>> diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
>> index dafe893cbda5..38b5170a1a81 100644
>> --- a/libdwfl/linux-kernel-modules.c
>> +++ b/libdwfl/linux-kernel-modules.c
>> @@ -44,6 +44,13 @@
>>  #include <fcntl.h>
>>  #include <unistd.h>
>>  
>> +/* Since fts.h is included before config.h, its indirect inclusions may not
>> +   give us the right LFS aliases of these functions, so map them manually.  */
>> +#ifdef _FILE_OFFSET_BITS
>> +#define open open64
>> +#define fopen fopen64
>> +#endif
>> +
> 
> What is the story behind fts.h? Is its usage not off_t 64bit clean?

See https://sourceware.org/bugzilla/show_bug.cgi?id=11460

Of course it does support 64-bit off_t, as it must for native 64-bit
platforms.  I guess the problem is just that it doesn't have the
duplicated interfaces for 32-bit with/without _FILE_OFFSET_BITS.

Note that struct _ftsent contains a struct stat.  So it would need
versions with either stat or stat64, and all of the functions updated to
swing both ways too.

There is the similar ftw.h which has full LFS, but the FTW_SKIP_SUBTREE
action is a GNU extension.  We now use FTS_SKIP to prune the "source"
directory from kernel module walks.  We wouldn't be able to do this with
ftw on FreeBSD, for example, but it's for Linux modules anyway so maybe
we don't care.

Want to convert to ftw and accept the lack of skipping as a fallback?
(There may be other fts/ftw differences that I haven't noticed yet.)

> And what should we do about the usage of loff_t in the public libelf.h
> API? We cannot just change those to off_t since we require 64bit
> offsets. And we don't want a different ABI depending on how libelf.h is
> included (with/without _FILE_OFFSET_BITS).

I have another patch that I'll send which makes an AC_SUBST for this.
Let it remain loff_t whereever that's available, else make it off_t.
This way the installed header still won't depend on configuration.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Trust AC_SYS_LARGEFILE to provide large file support
@ 2015-10-09 11:17 Mark Wielaard
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Wielaard @ 2015-10-09 11:17 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 1732 bytes --]

On Thu, 2015-10-08 at 13:05 -0700, Josh Stone wrote:
> AC_SYS_LARGEFILE defines _FILE_OFFSET_BITS in config.h if needed for
> LFS, and this automatically maps things like open to open64.  But quite
> a few places used explicit 64-bit names, which won't work on platforms
> like FreeBSD where off_t is always 64-bit and there are no foo64 names.
> It's better to just trust that AC_SYS_LARGEFILE is doing it correctly.
> 
> But we can verify this too, as some file could easily forget to include
> config.h.  The new tests/run-lfs-symbols.sh checks all build targets
> against lfs-symbols (taken from lintian) to make sure everything was
> implicitly mapped to 64-bit variants when _FILE_OFFSET_BITS is set.

Very nice cleanup and a clever testscase.
Please do check it in.

Two questions though (they can be dealt with separately):

> diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
> index dafe893cbda5..38b5170a1a81 100644
> --- a/libdwfl/linux-kernel-modules.c
> +++ b/libdwfl/linux-kernel-modules.c
> @@ -44,6 +44,13 @@
>  #include <fcntl.h>
>  #include <unistd.h>
>  
> +/* Since fts.h is included before config.h, its indirect inclusions may not
> +   give us the right LFS aliases of these functions, so map them manually.  */
> +#ifdef _FILE_OFFSET_BITS
> +#define open open64
> +#define fopen fopen64
> +#endif
> +

What is the story behind fts.h? Is its usage not off_t 64bit clean?

And what should we do about the usage of loff_t in the public libelf.h
API? We cannot just change those to off_t since we require 64bit
offsets. And we don't want a different ABI depending on how libelf.h is
included (with/without _FILE_OFFSET_BITS).

Thanks,

Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-10 11:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-08 20:05 [PATCH] Trust AC_SYS_LARGEFILE to provide large file support Josh Stone
2015-10-09 11:17 Mark Wielaard
2015-10-09 16:40 Josh Stone
2015-10-10 11:13 Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).