This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v2] libelf: Use int64_t for offsets in libelf.h


Some systems don't have loff_t, like FreeBSD where off_t always supports
large files.  We need a standardized 64-bit signed type for the public
header, without depending on configuration... OK, just use int64_t.

Signed-off-by: Josh Stone <jistone@redhat.com>
---
 libelf/ChangeLog |  4 ++++
 libelf/libelf.h  | 13 +++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index b1d1ecdf11e5..4517da16c904 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,5 +1,9 @@
 2015-10-09  Josh Stone  <jistone@redhat.com>
 
+	* libelf.h: Replace loff_t with int64_t throughout.
+
+2015-10-09  Josh Stone  <jistone@redhat.com>
+
 	* libelfP.h (struct Elf): Replace off64_t with off_t.
 	* elf_getdata_rawchunk.c (elf_getdata_rawchunk): Likewise.
 
diff --git a/libelf/libelf.h b/libelf/libelf.h
index 5a2b3af856e0..54f7c29b2488 100644
--- a/libelf/libelf.h
+++ b/libelf/libelf.h
@@ -29,6 +29,7 @@
 #ifndef _LIBELF_H
 #define _LIBELF_H 1
 
+#include <stdint.h>
 #include <sys/types.h>
 
 /* Get the ELF types.  */
@@ -74,7 +75,7 @@ typedef struct
   Elf_Type d_type;		/* Type of this piece of data.  */
   unsigned int d_version;	/* ELF version.  */
   size_t d_size;		/* Size in bytes.  */
-  loff_t d_off;			/* Offset into section.  */
+  int64_t d_off;		/* Offset into section.  */
   size_t d_align;		/* Alignment in section.  */
 } Elf_Data;
 
@@ -136,7 +137,7 @@ typedef struct
   uid_t ar_uid;			/* User ID.  */
   gid_t ar_gid;			/* Group ID.  */
   mode_t ar_mode;		/* File mode.  */
-  loff_t ar_size;		/* File size.  */
+  int64_t ar_size;		/* File size.  */
   char *ar_rawname;		/* Original name of archive member.  */
 } Elf_Arhdr;
 
@@ -177,13 +178,13 @@ extern Elf_Cmd elf_next (Elf *__elf);
 extern int elf_end (Elf *__elf);
 
 /* Update ELF descriptor and write file to disk.  */
-extern loff_t elf_update (Elf *__elf, Elf_Cmd __cmd);
+extern int64_t elf_update (Elf *__elf, Elf_Cmd __cmd);
 
 /* Determine what kind of file is associated with ELF.  */
 extern Elf_Kind elf_kind (Elf *__elf) __attribute__ ((__pure__));
 
 /* Get the base offset for an object file.  */
-extern loff_t elf_getbase (Elf *__elf);
+extern int64_t elf_getbase (Elf *__elf);
 
 
 /* Retrieve file identification data.  */
@@ -301,7 +302,7 @@ extern Elf_Data *elf_newdata (Elf_Scn *__scn);
    would be for TYPE.  The resulting Elf_Data pointer is valid until
    elf_end (ELF) is called.  */
 extern Elf_Data *elf_getdata_rawchunk (Elf *__elf,
-				       loff_t __offset, size_t __size,
+				       int64_t __offset, size_t __size,
 				       Elf_Type __type);
 
 
@@ -313,7 +314,7 @@ extern char *elf_strptr (Elf *__elf, size_t __index, size_t __offset);
 extern Elf_Arhdr *elf_getarhdr (Elf *__elf);
 
 /* Return offset in archive for current file ELF.  */
-extern loff_t elf_getaroff (Elf *__elf);
+extern int64_t elf_getaroff (Elf *__elf);
 
 /* Select archive element at OFFSET.  */
 extern size_t elf_rand (Elf *__elf, size_t __offset);
-- 
2.4.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]