public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: Paul Iannetta <piannetta@kalrayinc.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH] kvx: fix 32-bit build and validation
Date: Wed, 23 Aug 2023 12:46:01 +0930	[thread overview]
Message-ID: <ZOV58c0bp7vu1Wyn@squeak.grove.modra.org> (raw)
In-Reply-To: <20230822160142.ocnjgkuboicpncii@ws2202.lin.mbt.kalray.eu>

I've committed this part of your patch, with a small fix to targets.c
needed to get a successful 32-bit host --enable-targets=all 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 <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.

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 \

-- 
Alan Modra
Australia Development Lab, IBM

  parent reply	other threads:[~2023-08-23  3:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-22 16:01 Paul Iannetta
2023-08-23  0:27 ` Alan Modra
2023-08-23  7:44   ` Paul Iannetta
2023-08-23 12:14     ` Alan Modra
2023-08-23 14:39       ` [PATCH 0/4] kvx: various fixes Paul Iannetta
2023-08-23 14:39         ` [PATCH 1/4] kvx: remove kvx_elf64_linux_vec Paul Iannetta
2023-08-23 14:39         ` [PATCH 2/4] kvx: fix handling of STB_GNU_UNIQUE symbols Paul Iannetta
2023-08-23 14:39         ` [PATCH 3/4] kvx: use {u,}int32_t and {u,}int64_t Paul Iannetta
2023-08-23 14:39         ` [PATCH 4/4] kvx: bfd/config.bfd & ld/configure.tgt Paul Iannetta
2023-08-24  3:12         ` [PATCH 0/4] kvx: various fixes Alan Modra
2023-08-24  6:26           ` Paul Iannetta
2023-08-24  8:49           ` [PATCH] kvx: fix kvx_reassemble_bundle index 8 out of bounds Paul Iannetta
2023-08-24  9:08             ` Alan Modra
2023-08-24  9:26               ` Paul Iannetta
2023-09-07 12:46                 ` Alan Modra
2023-09-07 15:27                   ` Paul Iannetta
2023-08-23 14:40       ` [PATCH] kvx: fix 32-bit build and validation Paul Iannetta
2023-08-23  3:16 ` Alan Modra [this message]
2023-08-23 13:39   ` Luis Machado

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZOV58c0bp7vu1Wyn@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=piannetta@kalrayinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).