Project

General

Profile

Actions

Bug #13342

closed

ctfconvert could encode _Float128 for 32-bit objects

Added by Andy Fiddaman 5 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
tools - gate/build tools
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

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

Related to illumos gate - Feature #13364: mdb could handle _Float128 types in 32-bit objectsNew

Actions
Precedes illumos gate - Feature #13366: Add CTF tests for new featuresIn ProgressAndy Fiddaman

Actions
Actions #1

Updated by Electric Monk 5 months ago

  • Gerrit CR set to 1085
Actions #2

Updated by Andy Fiddaman 5 months ago

Actions #3

Updated by Electric Monk 5 months 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>

Actions #4

Updated by Andy Fiddaman 4 months ago

  • Status changed from In Progress to Pending RTI
Actions #5

Updated by Andy Fiddaman 4 months ago

  • Status changed from Pending RTI to In Progress
Actions #6

Updated by Joshua M. Clulow 4 months ago

  • Related to Feature #13364: mdb could handle _Float128 types in 32-bit objects added
Actions #7

Updated by Joshua M. Clulow 4 months ago

  • Status changed from In Progress to Closed
Actions

Also available in: Atom PDF