elf: fix warning message caused by type mismatch of offset types
Backport from the upstream crash-gcore. commit 8ff3de974aa9fdf8934797122dc55428ef571ab2 Author: Vincent Whitchurch <vincent.whitchurch@axis.com> Date: Tue Jun 21 09:15:34 2022 +0000 elf: fix warning message caused by type mismatch of offset types 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 <vincent.whitchurch@axis.com> Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
This commit is contained in:
parent
a0cea9fcec
commit
44392dfce6
@ -0,0 +1,65 @@
|
|||||||
|
From 8ff3de974aa9fdf8934797122dc55428ef571ab2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vincent Whitchurch <vincent.whitchurch@axis.com>
|
||||||
|
Date: Tue, 21 Jun 2022 09:15:34 +0000
|
||||||
|
Subject: [PATCH 6/8] 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 <vincent.whitchurch@axis.com>
|
||||||
|
---
|
||||||
|
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 3233ea5..409678e 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 2aca984..b31388a 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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user