Bug #13342
closedctfconvert could encode _Float128 for 32-bit objects
0%
Description
When working on implementing CTF everywhere in OmniOS userland, some 32-bit objects that use the _Float128 type fail to convert:
An example is the 32-bit libmpfr.so
% /opt/onbld/bin/i386/ctfconvert -m -o /dev/null ~/ctf/usr_lib_libmpfr.so.6.1.0 ctfconvert: CTF conversion failed: Invalid argument
Using ctfconvert
with the patch for 13280 applied gives a bit more information:
% ctfconvert -mo /dev/null ~/ctf/usr_lib_libmpfr.so.6.1.0 ctfconvert: failed to find valid fp mapping for encoding 4, size 0 bits ctfconvert: CTF conversion failed: Invalid argument
Note that the message stating 0 bits
is because of an incorrect format string in libctf, the type is actually a 128-bit double.
It seems that several third party packages use the ISO/IEC TS 18661-3:2015 _Float128 type. For a 64-bit object, this is the same as long double
but in a 32-bit object a long double
is only 96 bits.
Changing ctfconvert
to encode these as 128-bit long doubles seems sensible rather than failing the entire conversion, although tools like mdb will not be able to print them directly.
I tested the attached patch with:
#include <stdio.h> long double ldouble = 123.1; _Float128 f128 = 245.5; int main() { printf("Long double: %lf\n", ldouble); printf("Float128: %lf\n", f128); }
The type is now encoded:
% ctfdump -t float128.32 - Types ------------------------------------------------------------------------- <1> long double encoding=LDOUBLE offset=0 bits=96 <2> _Float128 encoding=LDOUBLE offset=0 bits=128 <3> int encoding=SIGNED offset=0 bits=32
but mdb cannot print it, as expected
% mdb float128.32 > ldouble::print +1.2309999999999999e+02 > f128::print ??? (unsupported FP format 6 / 128 bits
Related issues
Updated by Andy Fiddaman over 2 years ago
- Precedes Feature #13366: Add CTF tests for new features added
Updated by Electric Monk over 2 years ago
git commit 3dd4cd56e7843e01a8ab147a0d102cd4f6d732c1
commit 3dd4cd56e7843e01a8ab147a0d102cd4f6d732c1 Author: Andy Fiddaman <omnios@citrus-it.co.uk> Date: 2020-12-17T21:18:42.000Z 13342 ctfconvert could encode _Float128 for 32-bit objects Reviewed by: Robert Mustacchi <rm@fingolfin.org> Approved by: Rich Lowe <richlowe@richlowe.net>
Updated by Andy Fiddaman over 2 years ago
- Status changed from In Progress to Pending RTI
Updated by Andy Fiddaman over 2 years ago
- Status changed from Pending RTI to In Progress
Updated by Joshua M. Clulow over 2 years ago
- Related to Feature #13364: mdb could handle _Float128 types in 32-bit objects added
Updated by Joshua M. Clulow over 2 years ago
- Status changed from In Progress to Closed