changeset 20198:c71c09ee0966

13342 ctfconvert could encode _Float128 for 32-bit objects Reviewed by: Robert Mustacchi <rm@fingolfin.org> Approved by: Rich Lowe <richlowe@richlowe.net>
author Andy Fiddaman <omnios@citrus-it.co.uk>
date Sat, 28 Nov 2020 15:13:41 +0000
parents 1c416c6c616f
children 790618c19823
files usr/src/lib/libctf/common/ctf_dwarf.c
diffstat 1 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/libctf/common/ctf_dwarf.c	Wed Nov 25 15:40:47 2020 +0000
+++ b/usr/src/lib/libctf/common/ctf_dwarf.c	Sat Nov 28 15:13:41 2020 +0000
@@ -681,7 +681,7 @@
 			if (sign < 0) {
 				(void) snprintf(cup->cu_errbuf, cup->cu_errlen,
 				    "encountered negative member data "
-				    "location: %d\n", sign);
+				    "location: %lld\n", sign);
 			}
 			*valp = (Dwarf_Unsigned)sign;
 			return (0);
@@ -879,7 +879,7 @@
 
 typedef struct ctf_dwarf_fpmap {
 	uint_t			cdf_mach;
-	ctf_dwarf_fpent_t	cdf_ents[4];
+	ctf_dwarf_fpent_t	cdf_ents[5];
 } ctf_dwarf_fpmap_t;
 
 static const ctf_dwarf_fpmap_t ctf_dwarf_fpmaps[] = {
@@ -905,6 +905,17 @@
 		{ 4, { CTF_FP_SINGLE, CTF_FP_CPLX, CTF_FP_IMAGRY } },
 		{ 8, { CTF_FP_DOUBLE, CTF_FP_DCPLX, CTF_FP_DIMAGRY } },
 		{ 12, { CTF_FP_LDOUBLE, CTF_FP_LDCPLX, CTF_FP_LDIMAGRY } },
+		/*
+		 * ISO/IEC TS-18661-3:2015 defines several types with analogues
+		 * to existing C types. However, in the i386 ABI there is no
+		 * corresponding type for a _Float128. While, ideally we would
+		 * add this as a discrete type, when C2x formally standardizes
+		 * this and a number of additional extensions, we'll want to
+		 * change that around. In the interim, we'll encode it as a
+		 * weirdly sized long-double, even though not all the tools
+		 * will expect an off-abi encoding.
+		 */
+		{ 16, { CTF_FP_LDOUBLE, CTF_FP_LDCPLX, CTF_FP_LDIMAGRY } },
 		{ 0, { 0 } }
 	} },
 	{ EM_X86_64, {
@@ -985,7 +996,7 @@
 	}
 
 	(void) snprintf(cup->cu_errbuf, cup->cu_errlen,
-	    "failed to find valid fp mapping for encoding %d, size %d bits\n",
+	    "failed to find valid fp mapping for encoding %lld, size %d bits\n",
 	    type, enc->cte_bits);
 	return (EINVAL);
 }
@@ -1033,7 +1044,7 @@
 		break;
 	default:
 		(void) snprintf(cup->cu_errbuf, cup->cu_errlen,
-		    "encountered unknown DWARF encoding: %d\n", type);
+		    "encountered unknown DWARF encoding: %lld\n", type);
 		return (ECTF_CONVBKERR);
 	}