Hello,
this series fixes a few type mismatches that have become errors when building with gcc-14.
Max Filippov (3): iconv: fix type mismatches ldso: FDPIC: fix type mismatches ldso: arm: fix build with gcc-14
ldso/ldso/arm/elfinterp.c | 6 +++--- ldso/ldso/fdpic/dl-inlines.h | 4 ++-- ldso/ldso/fdpic/dl-sysdep.h | 2 +- libiconv/iconv.c | 8 ++++++-- 4 files changed, 12 insertions(+), 8 deletions(-)
With gcc-14 warnings caused by type mismatches turn to errors: - iconv_t is not a pointer type, convert the result directly to iconv_t in combine_to_from() - unsigned int is not the same as wchar_t, use temporary wchar_t wc as an argument for utf8dec_wchar()
Signed-off-by: Max Filippov jcmvbkbc@gmail.com --- libiconv/iconv.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libiconv/iconv.c b/libiconv/iconv.c index ec01f381dbf4..0462f6e1080d 100644 --- a/libiconv/iconv.c +++ b/libiconv/iconv.c @@ -142,7 +142,7 @@ struct stateful_cd {
static iconv_t combine_to_from(size_t t, size_t f) { - return (void *)(f<<16 | t<<1 | 1); + return (iconv_t)(f<<16 | t<<1 | 1); }
static size_t extract_from(iconv_t cd) @@ -382,7 +382,11 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri switch (type) { case UTF_8: if (c < 128) break; - l = utf8dec_wchar(&c, *in, *inb); + else { + wchar_t wc; + l = utf8dec_wchar(&wc, *in, *inb); + c = wc; + } if (!l) l++; else if (l == (size_t)-1) goto ilseq; else if (l == (size_t)-2) goto starved;
With gcc-14 warnings caused by type mismatches turn to errors: - (void **) needs explicit conversion operator to become struct funcdesc_value **entry - both subexpressions of the ternary operator must be pointers - %p should be used instead of %x to print a pointer
Signed-off-by: Max Filippov jcmvbkbc@gmail.com --- ldso/ldso/fdpic/dl-inlines.h | 4 ++-- ldso/ldso/fdpic/dl-sysdep.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/ldso/ldso/fdpic/dl-inlines.h b/ldso/ldso/fdpic/dl-inlines.h index 89e7a9a68582..6a31ef3e6409 100644 --- a/ldso/ldso/fdpic/dl-inlines.h +++ b/ldso/ldso/fdpic/dl-inlines.h @@ -102,7 +102,7 @@ __dl_update_loadaddr_hdr(struct elf32_fdpic_loadaddr loadaddr, void *addr,
#if defined (__SUPPORT_LD_DEBUG__) if (_dl_debug) - _dl_dprintf(_dl_debug_file, "%i: changed mapping %x at %x (old %x), size %x\n", + _dl_dprintf(_dl_debug_file, "%i: changed mapping %x at %x (old %p), size %x\n", loadaddr.map->nsegs - 1, segdata->p_vaddr, segdata->addr, oldaddr, segdata->p_memsz); #endif @@ -177,7 +177,7 @@ _dl_funcdesc_for (void *entry_point, void *got_value) tpnt->funcdesc_ht = ht; }
- entry = htab_find_slot(ht, entry_point, 1, hash_pointer, eq_pointer); + entry = (struct funcdesc_value **)htab_find_slot(ht, entry_point, 1, hash_pointer, eq_pointer);
if (entry == NULL) _dl_exit(1); diff --git a/ldso/ldso/fdpic/dl-sysdep.h b/ldso/ldso/fdpic/dl-sysdep.h index 6ab303b37728..81694dc768dc 100644 --- a/ldso/ldso/fdpic/dl-sysdep.h +++ b/ldso/ldso/fdpic/dl-sysdep.h @@ -108,7 +108,7 @@ struct funcdesc_ht; && ELF32_ST_TYPE((SYM)->st_info) == STT_FUNC \ ? _dl_funcdesc_for ((void *)DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value), \ (TPNT)->loadaddr.got_value) \ - : DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value)) + : (void*)DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value))
#define DL_GET_READY_TO_RUN_EXTRA_PARMS \ , struct elf32_fdpic_loadmap *dl_boot_progmap, Elf32_Addr dl_boot_got_pointer
With gcc-14 warnings caused by type mismatches turn to errors: - got_entry is a pointer in the _dl_linux_resolver(), but the function _dl_linux_resolver() returns unsigned long. Convert got_entry to unsigned long when returning - first argument of _dl_funcdesc_for() is a pointer, but (symbol_addr + reloc_value) is unsigned long in the _dl_do_reloc(). Convert function argument to (void *) - struct funcdesc_value::entry_point is a pointer, but DL_RELOC_ADDR returns ElfW(Addr). Convert DL_RELOC_ADDR result to (void *) before assigning to funcdesc_value::entry_point
Signed-off-by: Max Filippov jcmvbkbc@gmail.com --- ldso/ldso/arm/elfinterp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ldso/ldso/arm/elfinterp.c b/ldso/ldso/arm/elfinterp.c index 4c268356fb37..9c9a3e8ca7f7 100644 --- a/ldso/ldso/arm/elfinterp.c +++ b/ldso/ldso/arm/elfinterp.c @@ -92,7 +92,7 @@ unsigned long _dl_linux_resolver (struct elf_resolve *tpnt, int reloc_offet) *got_entry = funcval; #endif
- return got_entry; + return (unsigned long)got_entry; } #else unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry) @@ -362,7 +362,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct r_scope_elem *scope, unsigned long reloc_value = *reloc_addr;
if (symbol_addr) - reloc_value = (unsigned long) _dl_funcdesc_for(symbol_addr + reloc_value, sym_ref.tpnt->loadaddr.got_value); + reloc_value = (unsigned long) _dl_funcdesc_for((void *)(symbol_addr + reloc_value), sym_ref.tpnt->loadaddr.got_value); else /* Relocation against an undefined weak symbol: @@ -429,7 +429,7 @@ _dl_do_lazy_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope, { struct funcdesc_value *dst = (struct funcdesc_value *) reloc_addr;
- dst->entry_point = DL_RELOC_ADDR(tpnt->loadaddr, dst->entry_point); + dst->entry_point = (void *)DL_RELOC_ADDR(tpnt->loadaddr, dst->entry_point); dst->got_value = tpnt->loadaddr.got_value; } break;
Hi Max, Max Filippov wrote,
Hello,
this series fixes a few type mismatches that have become errors when building with gcc-14.
Max Filippov (3): iconv: fix type mismatches ldso: FDPIC: fix type mismatches ldso: arm: fix build with gcc-14
Thanks. Patch series applied and pushed. best regards Waldemar