From 8ff3de974aa9fdf8934797122dc55428ef571ab2 Mon Sep 17 00:00:00 2001 From: Vincent Whitchurch Date: Tue, 21 Jun 2022 09:15:34 +0000 Subject: [PATCH 3/5] elf: fix warning message caused by type mismatch of offset types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use loff_t consistently to fix these warnings on -m32 builds on 64-bit: libgcore/gcore_coredump.c: In function ‘writenote’: libgcore/gcore_coredump.c:701:58: warning: passing argument 3 of ‘gcore->elf->ops->write_note_header’ from incompatible pointer type [-Wincompatible-pointer-types] if (!gcore->elf->ops->write_note_header(gcore->elf, fp, foffset)) ^~~~~~~ libgcore/gcore_coredump.c:701:58: note: expected ‘off_t *’ {aka ‘long int *’} but argument is of type ‘loff_t *’ {aka ‘long long int *’} Signed-off-by: Vincent Whitchurch Signed-off-by: Lianbo Jiang --- src/libgcore/gcore_defs.h | 2 +- src/libgcore/gcore_elf_struct.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libgcore/gcore_defs.h b/src/libgcore/gcore_defs.h index 3233ea533ca0..409678e1ad68 100644 --- a/src/libgcore/gcore_defs.h +++ b/src/libgcore/gcore_defs.h @@ -1232,7 +1232,7 @@ struct gcore_elf_operations int (*write_section_header)(struct gcore_elf_struct *this, FILE *fp); int (*write_program_header)(struct gcore_elf_struct *this, FILE *fp); int (*write_note_header)(struct gcore_elf_struct *this, FILE *fp, - off_t *offset); + loff_t *offset); uint64_t (*get_e_phoff)(struct gcore_elf_struct *this); uint64_t (*get_e_shoff)(struct gcore_elf_struct *this); diff --git a/src/libgcore/gcore_elf_struct.c b/src/libgcore/gcore_elf_struct.c index 2aca984cf90f..b31388aa7e28 100644 --- a/src/libgcore/gcore_elf_struct.c +++ b/src/libgcore/gcore_elf_struct.c @@ -141,7 +141,7 @@ static int elf64_write_program_header(struct gcore_elf_struct *this, FILE *fp) } static int elf64_write_note_header(struct gcore_elf_struct *this, FILE *fp, - off_t *offset) + loff_t *offset) { Elf64_Nhdr *n = &((struct gcore_elf64_struct *)this)->nhdr; @@ -314,7 +314,7 @@ static int elf32_write_program_header(struct gcore_elf_struct *this, FILE *fp) } static int elf32_write_note_header(struct gcore_elf_struct *this, FILE *fp, - off_t *offset) + loff_t *offset) { Elf32_Nhdr *n = &((struct gcore_elf32_struct *)this)->nhdr; -- 2.37.1