kvx: fix 32-bit build
authorPaul Iannetta <piannetta@kalrayinc.com>
Thu, 17 Aug 2023 14:08:29 +0000 (16:08 +0200)
committerAlan Modra <amodra@gmail.com>
Wed, 23 Aug 2023 03:08:58 +0000 (12:38 +0930)
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 <kvx_elf32_vec>): 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
bfd/Makefile.in
bfd/config.bfd
bfd/configure
bfd/configure.ac
bfd/elfnn-kvx.c
bfd/targets.c
ld/Makefile.am
ld/Makefile.in

index 8b0761db582e6958831f6538d8a22b5a80464dd3..378c13198d67f74d6cfb944f939f872e4702af08 100644 (file)
@@ -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 \
index cca093e1feff51447f83f3c638c3eec16f623078..bb530271fca14c2fad92a293f3f29d6420624c35 100644 (file)
@@ -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 \
index 30927bdbe23a55f08b7625a1d1d792ded5adfeec..2a4622219ba3b6aa58490e958060647a97c1a4c4 100644 (file)
@@ -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
index 489531c0a7fe0a611f0daed9c477d26fc3ae70ad..d43754c4787f33b22ef503458d5b6ca3d1e7250f 100755 (executable)
@@ -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" ;;
index 0d1cd814af687bbe07374f45ea20d1cd9ec98536..3fdd12fe22d4a3ba130de33b9e48097e9c1a0929 100644 (file)
@@ -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" ;;
index 467d91fea5331b83cda8a9b222bd5a517deb758d..95580d19930e2991e08bf8165727ac1ab0fda041 100644 (file)
@@ -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. */
index 210beddaf1185ced688b40b19a6b9f5c5fa85e08..63b3abbd287b2dfd52ac0433dc7bf6d6cc9596fc 100644 (file)
@@ -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
 
index 07fac968bb7e7e469b0e8226e1a378c5d0c7e0eb..be4562757484d033fccd2206a9183bb88bb7b93f 100644 (file)
@@ -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 \
index a2aa54b69d8c03cf3b9b325502f0e864f12f7f68..c6a79774f38bdac65029de6589e58f95c47f99c1 100644 (file)
@@ -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 \