summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2016-01-08 16:45:12 +0100
committerMark Wielaard <mjw@redhat.com>2016-01-08 16:45:15 +0100
commit3a5fc51573ae88a06d2050ef8425336e23013852 (patch)
treedca3c0a35cc31e1251dbfe664c21f2e73c92a3f7
parent7930054cf5628e779ceadac68cf59689ddc37cf7 (diff)
downloadelfutils-3a5fc51573ae88a06d2050ef8425336e23013852.tar.gz
elfutils-3a5fc51573ae88a06d2050ef8425336e23013852.tar.xz
Fix build on 32bit systems.
size_t has a different size on 32 and 64 bit systems. Signed-off-by: Mark Wielaard <mjw@redhat.com>
-rw-r--r--src/ChangeLog5
-rw-r--r--src/elfcompress.c2
-rw-r--r--src/readelf.c2
-rw-r--r--tests/ChangeLog4
-rw-r--r--tests/elfputzdata.c2
5 files changed, 12 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ae2129d..af98c4d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2016-01-08 Mark Wielaard <mjw@redhat.com>
+
+ * elfcompress.c (compress_section): Use %zu to print size_t.
+ * readelf.c (print_shdr): Use %zx to print size_t.
+
2015-12-16 Mark Wielaard <mjw@redhat.com>
* elfcompress.c: New file.
diff --git a/src/elfcompress.c b/src/elfcompress.c
index 5be2375..23939db 100644
--- a/src/elfcompress.c
+++ b/src/elfcompress.c
@@ -237,7 +237,7 @@ compress_section (Elf_Scn *scn, size_t orig_size, const char *name,
}
float new = shdr->sh_size;
float orig = orig_size ?: 1;
- printf (" (%" PRIu64 " => %" PRIu64 " %.2f%%)\n",
+ printf (" (%zu => %" PRIu64 " %.2f%%)\n",
orig_size, shdr->sh_size, (new / orig) * 100);
}
}
diff --git a/src/readelf.c b/src/readelf.c
index 85fa92b..0db192e 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -1217,7 +1217,7 @@ There are %d section headers, starting at offset %#" PRIx64 ":\n\
{
ssize_t size;
if ((size = dwelf_scn_gnu_compressed_size (scn)) >= 0)
- printf (" [GNU ZLIB %0*" PRIx64 " ]\n",
+ printf (" [GNU ZLIB %0*zx ]\n",
ehdr->e_ident[EI_CLASS] == ELFCLASS32 ? 6 : 8, size);
else
error (0, 0,
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 453c418..3d9353c 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,9 @@
2016-01-08 Mark Wielaard <mjw@redhat.com>
+ * elfputzdata.c (main): Use PRId64 to print 64 bit value.
+
+2016-01-08 Mark Wielaard <mjw@redhat.com>
+
* Makefile.am (TESTS): Always unconditionally add
run-readelf-zdebug.sh and run-readelf-zdebug-rel.sh.
diff --git a/tests/elfputzdata.c b/tests/elfputzdata.c
index 7e6f011..67c6090 100644
--- a/tests/elfputzdata.c
+++ b/tests/elfputzdata.c
@@ -90,7 +90,7 @@ main (int argc, char *argv[])
else
{
size_t orig_size = shdr->sh_size;
- printf ("Lets compress %zd %s, size: %zd\n",
+ printf ("Lets compress %zd %s, size: %" PRId64 "\n",
idx, name, shdr->sh_size);
Elf_Data *d = elf_getdata (scn, NULL);
if (d == NULL)