From 835f16daa77952015d1a97ae6eab48cc2ea14fb8 Mon Sep 17 00:00:00 2001 From: Paul Iannetta Date: Thu, 17 Aug 2023 16:08:29 +0200 Subject: [PATCH] kvx: fix 32-bit build bfd/ * Makefile.am: Move elf32-kvx.lo from BFD32_BACKENDS to BFD64_BACKENDS. Remove elfxx-kvx.lo from BFD32_BACKENDS. Remove elfxx-kvx.c from BFD32_BACKENDS_CFILES. * Makefile.in: Regenerate. * config.bfd: Adjust targ_defvec and targ_selvecs and gate them behind BFD64. * configure.ac: Add target_size=64 to kvx_elf64_*vec. * configure: Regenerate. * elfnn-kvx.c (elfNN_kvx_stub_name): Cast rel->r_addend to uint64_t to match format string. (elfNN_kvx_relocate_section): Similarly for r_offset, and use PRIx64 in format string. * targets.c (_bfd_target_vector ): Move inside #ifdef BFD64. ld/ * Makefile.am: Move eelf32kvx.c from ALL_EMULATION_SOURCES to ALL_64_EMULATION_SOURCES. * Makefile.in: Regenerate. --- bfd/Makefile.am | 4 +--- bfd/Makefile.in | 4 +--- bfd/config.bfd | 9 ++++----- bfd/configure | 4 ++-- bfd/configure.ac | 4 ++-- bfd/elfnn-kvx.c | 10 +++++----- bfd/targets.c | 3 +-- ld/Makefile.am | 2 +- ld/Makefile.in | 2 +- 9 files changed, 18 insertions(+), 24 deletions(-) diff --git a/bfd/Makefile.am b/bfd/Makefile.am index 8b0761db582..378c13198d6 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -318,7 +318,6 @@ BFD32_BACKENDS = \ elf32-i386.lo \ elf32-ip2k.lo \ elf32-iq2000.lo \ - elf32-kvx.lo \ elf32-lm32.lo \ elf32-m32c.lo \ elf32-m32r.lo \ @@ -359,7 +358,6 @@ BFD32_BACKENDS = \ elf32-z80.lo \ elf32.lo \ elflink.lo \ - elfxx-kvx.lo \ elfxx-sparc.lo \ elfxx-tilegx.lo \ elfxx-x86.lo \ @@ -495,7 +493,6 @@ BFD32_BACKENDS_CFILES = \ elf32-z80.c \ elf32.c \ elflink.c \ - elfxx-kvx.c \ elfxx-sparc.c \ elfxx-tilegx.c \ elfxx-x86.c \ @@ -549,6 +546,7 @@ BFD64_BACKENDS = \ coff64-rs6000.lo \ elf32-aarch64.lo \ elf32-ia64.lo \ + elf32-kvx.lo \ elf32-loongarch.lo \ elf32-mips.lo \ elf32-riscv.lo \ diff --git a/bfd/Makefile.in b/bfd/Makefile.in index cca093e1fef..bb530271fca 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -774,7 +774,6 @@ BFD32_BACKENDS = \ elf32-i386.lo \ elf32-ip2k.lo \ elf32-iq2000.lo \ - elf32-kvx.lo \ elf32-lm32.lo \ elf32-m32c.lo \ elf32-m32r.lo \ @@ -815,7 +814,6 @@ BFD32_BACKENDS = \ elf32-z80.lo \ elf32.lo \ elflink.lo \ - elfxx-kvx.lo \ elfxx-sparc.lo \ elfxx-tilegx.lo \ elfxx-x86.lo \ @@ -951,7 +949,6 @@ BFD32_BACKENDS_CFILES = \ elf32-z80.c \ elf32.c \ elflink.c \ - elfxx-kvx.c \ elfxx-sparc.c \ elfxx-tilegx.c \ elfxx-x86.c \ @@ -1006,6 +1003,7 @@ BFD64_BACKENDS = \ coff64-rs6000.lo \ elf32-aarch64.lo \ elf32-ia64.lo \ + elf32-kvx.lo \ elf32-loongarch.lo \ elf32-mips.lo \ elf32-riscv.lo \ diff --git a/bfd/config.bfd b/bfd/config.bfd index 30927bdbe23..2a4622219ba 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -804,14 +804,13 @@ case "${targ}" in targ_selvecs=kvx_elf32_vec want64=true ;; -#endif kvx-*-*) - targ_defvec=kvx_elf32_vec -#ifdef BFD64 - targ64_selvecs=kvx_elf64_vec -#endif + targ_defvec=kvx_elf64_vec + targ_selvecs="kvx_elf64_vec kvx_elf32_vec" + want64=true ;; +#endif lm32-*-elf | lm32-*-rtems*) targ_defvec=lm32_elf32_vec diff --git a/bfd/configure b/bfd/configure index 489531c0a7f..d43754c4787 100755 --- a/bfd/configure +++ b/bfd/configure @@ -13960,8 +13960,8 @@ do ip2k_elf32_vec) tb="$tb elf32-ip2k.lo elf32.lo $elf" ;; iq2000_elf32_vec) tb="$tb elf32-iq2000.lo elf32.lo $elf" ;; kvx_elf32_vec) tb="$tb elf32-kvx.lo elfxx-kvx.lo elf32.lo $elf $ipa" ;; - kvx_elf64_vec) tb="$tb elf64-kvx.lo elfxx-kvx.lo elf64.lo $elf $ipa" ;; - kvx_elf64_linux_vec) tb="$tb elf64-kvx.lo elfxx-kvx.lo elf64.lo $elf $ipa" ;; + kvx_elf64_vec) tb="$tb elf64-kvx.lo elfxx-kvx.lo elf64.lo $elf $ipa"; target_size=64 ;; + kvx_elf64_linux_vec) tb="$tb elf64-kvx.lo elfxx-kvx.lo elf64.lo $elf $ipa"; target_size=64 ;; lm32_elf32_vec) tb="$tb elf32-lm32.lo elf32.lo $elf" ;; lm32_elf32_fdpic_vec) tb="$tb elf32-lm32.lo elf32.lo $elf" ;; loongarch_elf32_vec) tb="$tb elf32-loongarch.lo elfxx-loongarch.lo elf32.lo elf-ifunc.lo $elf" ;; diff --git a/bfd/configure.ac b/bfd/configure.ac index 0d1cd814af6..3fdd12fe22d 100644 --- a/bfd/configure.ac +++ b/bfd/configure.ac @@ -496,8 +496,8 @@ do ip2k_elf32_vec) tb="$tb elf32-ip2k.lo elf32.lo $elf" ;; iq2000_elf32_vec) tb="$tb elf32-iq2000.lo elf32.lo $elf" ;; kvx_elf32_vec) tb="$tb elf32-kvx.lo elfxx-kvx.lo elf32.lo $elf $ipa" ;; - kvx_elf64_vec) tb="$tb elf64-kvx.lo elfxx-kvx.lo elf64.lo $elf $ipa" ;; - kvx_elf64_linux_vec) tb="$tb elf64-kvx.lo elfxx-kvx.lo elf64.lo $elf $ipa" ;; + kvx_elf64_vec) tb="$tb elf64-kvx.lo elfxx-kvx.lo elf64.lo $elf $ipa"; target_size=64 ;; + kvx_elf64_linux_vec) tb="$tb elf64-kvx.lo elfxx-kvx.lo elf64.lo $elf $ipa"; target_size=64 ;; lm32_elf32_vec) tb="$tb elf32-lm32.lo elf32.lo $elf" ;; lm32_elf32_fdpic_vec) tb="$tb elf32-lm32.lo elf32.lo $elf" ;; loongarch_elf32_vec) tb="$tb elf32-loongarch.lo elfxx-loongarch.lo elf32.lo elf-ifunc.lo $elf" ;; diff --git a/bfd/elfnn-kvx.c b/bfd/elfnn-kvx.c index 467d91fea53..95580d19930 100644 --- a/bfd/elfnn-kvx.c +++ b/bfd/elfnn-kvx.c @@ -736,7 +736,7 @@ elfNN_kvx_stub_name (const asection *input_section, snprintf (stub_name, len, "%08x_%s+%" PRIx64 "x", (unsigned int) input_section->id, hash->root.root.root.string, - rel->r_addend); + (uint64_t) rel->r_addend); } else { @@ -747,7 +747,7 @@ elfNN_kvx_stub_name (const asection *input_section, (unsigned int) input_section->id, (unsigned int) sym_sec->id, (unsigned int) ELFNN_R_SYM (rel->r_info), - rel->r_addend); + (uint64_t) rel->r_addend); } return stub_name; @@ -2568,11 +2568,11 @@ elfNN_kvx_relocate_section (bfd *output_bfd, (*_bfd_error_handler) ((sym_type == STT_TLS /* xgettext:c-format */ - ? _("%pB(%pA+%#lx): %s used with TLS symbol %s") + ? _("%pB(%pA+%#" PRIx64 "): %s used with TLS symbol %s") /* xgettext:c-format */ - : _("%pB(%pA+%#lx): %s used with non-TLS symbol %s")), + : _("%pB(%pA+%#" PRIx64 "): %s used with non-TLS symbol %s")), input_bfd, - input_section, (long) rel->r_offset, howto->name, name); + input_section, (uint64_t) rel->r_offset, howto->name, name); } /* Original aarch64 has relaxation handling for TLS here. */ diff --git a/bfd/targets.c b/bfd/targets.c index 210beddaf11..63b3abbd287 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -1130,9 +1130,8 @@ static const bfd_target * const _bfd_target_vector[] = &ip2k_elf32_vec, &iq2000_elf32_vec, - &kvx_elf32_vec, - #ifdef BFD64 + &kvx_elf32_vec, &kvx_elf64_vec, #endif diff --git a/ld/Makefile.am b/ld/Makefile.am index 07fac968bb7..be456275748 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -237,7 +237,6 @@ ALL_EMULATION_SOURCES = \ eelf32ip2k.c \ eelf32iq10.c \ eelf32iq2000.c \ - eelf32kvx.c \ eelf32lm32.c \ eelf32lm32fd.c \ eelf32lppc.c \ @@ -408,6 +407,7 @@ ALL_64_EMULATION_SOURCES = \ eelf32ebmipvxworks.c \ eelf32elmip.c \ eelf32elmipvxworks.c \ + eelf32kvx.c \ eelf32l4300.c \ eelf32lmip.c \ eelf32loongarch.c \ diff --git a/ld/Makefile.in b/ld/Makefile.in index a2aa54b69d8..c6a79774f38 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -738,7 +738,6 @@ ALL_EMULATION_SOURCES = \ eelf32ip2k.c \ eelf32iq10.c \ eelf32iq2000.c \ - eelf32kvx.c \ eelf32lm32.c \ eelf32lm32fd.c \ eelf32lppc.c \ @@ -908,6 +907,7 @@ ALL_64_EMULATION_SOURCES = \ eelf32ebmipvxworks.c \ eelf32elmip.c \ eelf32elmipvxworks.c \ + eelf32kvx.c \ eelf32l4300.c \ eelf32lmip.c \ eelf32loongarch.c \ -- 2.30.2