bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vitaly Chikunov <vt@altlinux.org>
To: Arnaldo Carvalho de Melo <acme@redhat.com>,
	bpf@vger.kernel.org, dwarves@vger.kernel.org
Cc: Vitaly Chikunov <vt@altlinux.org>
Subject: [PATCH] dwarves: Fix compilation on 32-bit architectures
Date: Sun,  6 Dec 2020 20:26:17 +0300	[thread overview]
Message-ID: <20201206172617.9751-1-vt@altlinux.org> (raw)

Replace `%lx' for addr (uint64_t) with PRIx64. `%ld' for seek_bytes
(off_t) is replaced with PRIx64 too, likewise in other places it's
printed.

Fixes these error messages on i586 and arm-32:

  btf_encoder.c:445:52: error: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'uint64_t'
  btf_encoder.c:687:54: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t'
  btf_encoder.c:695:71: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t'
  btf_encoder.c:708:88: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t'
  pahole.c:1872:20: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'off_t'

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
Cc: bpf@vger.kernel.org
Cc: dwarves@vger.kernel.org
---
 btf_encoder.c | 8 ++++----
 pahole.c      | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/btf_encoder.c b/btf_encoder.c
index c40f059..feb1023 100644
--- a/btf_encoder.c
+++ b/btf_encoder.c
@@ -442,7 +442,7 @@ static int collect_percpu_var(struct btf_elf *btfe, GElf_Sym *sym)
 	}
 
 	if (btf_elf__verbose)
-		printf("Found per-CPU symbol '%s' at address 0x%lx\n", sym_name, addr);
+		printf("Found per-CPU symbol '%s' at address 0x%" PRIx64 "\n", sym_name, addr);
 
 	if (percpu_var_cnt == MAX_PERCPU_VAR_CNT) {
 		fprintf(stderr, "Reached the limit of per-CPU variables: %d\n",
@@ -684,7 +684,7 @@ int cu__encode_btf(struct cu *cu, int verbose, bool force,
 		linkage = var->external ? BTF_VAR_GLOBAL_ALLOCATED : BTF_VAR_STATIC;
 
 		if (btf_elf__verbose) {
-			printf("Variable '%s' from CU '%s' at address 0x%lx encoded\n",
+			printf("Variable '%s' from CU '%s' at address 0x%" PRIx64 " encoded\n",
 			       name, cu->name, addr);
 		}
 
@@ -692,7 +692,7 @@ int cu__encode_btf(struct cu *cu, int verbose, bool force,
 		id = btf_elf__add_var_type(btfe, type, name, linkage);
 		if (id < 0) {
 			err = -1;
-			fprintf(stderr, "error: failed to encode variable '%s' at addr 0x%lx\n",
+			fprintf(stderr, "error: failed to encode variable '%s' at addr 0x%" PRIx64 "\n",
 			        name, addr);
 			break;
 		}
@@ -705,7 +705,7 @@ int cu__encode_btf(struct cu *cu, int verbose, bool force,
 		id = btf_elf__add_var_secinfo(&btfe->percpu_secinfo, id, offset, size);
 		if (id < 0) {
 			err = -1;
-			fprintf(stderr, "error: failed to encode section info for variable '%s' at addr 0x%lx\n",
+			fprintf(stderr, "error: failed to encode section info for variable '%s' at addr 0x%" PRIx64 "\n",
 			        name, addr);
 			break;
 		}
diff --git a/pahole.c b/pahole.c
index fe8d2cd..4a34ba5 100644
--- a/pahole.c
+++ b/pahole.c
@@ -1869,7 +1869,7 @@ static int prototype__stdio_fprintf_value(struct prototype *prototype, struct ty
 
 		// Since we're reading stdin, we need to account for what we already read
 		if (seek_bytes < total_read_bytes) {
-			fprintf(stderr, "pahole: can't go back in stdin, already read %" PRIu64 " bytes, can't go to position %ld\n",
+			fprintf(stderr, "pahole: can't go back in stdin, already read %" PRIu64 " bytes, can't go to position %#" PRIx64 "\n",
 					total_read_bytes, seek_bytes);
 			return -ENOMEM;
 		}
-- 
2.25.4


             reply	other threads:[~2020-12-06 17:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-06 17:26 Vitaly Chikunov [this message]
2020-12-07 15:55 ` [PATCH] dwarves: Fix compilation on 32-bit architectures Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201206172617.9751-1-vt@altlinux.org \
    --to=vt@altlinux.org \
    --cc=acme@redhat.com \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).