Thread overview
[D-runtime] core.demangle: What to do if real.sizeof == double.sizeof
Mar 20, 2012
Johannes Pfau
Mar 20, 2012
Iain Buclaw
Mar 20, 2012
Don Clugston
Mar 20, 2012
Johannes Pfau
Mar 20, 2012
Iain Buclaw
Mar 20, 2012
Johannes Pfau
Mar 20, 2012
Sean Kelly
March 20, 2012
For ARM, real and double are the same types (long double == double in c). Because of that bionic (android's C library) doesn't provide a strtold function.

strtold is used in core.demangle in the parseReal function. Is it safe to just replace strtold with strtod for Android?

-- 
Johannes Pfau

_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime

March 20, 2012
On 20 March 2012 12:48, Johannes Pfau <johannespfau@googlemail.com> wrote:
> For ARM, real and double are the same types (long double == double in c).
> Because of that bionic (android's C library) doesn't provide a strtold
> function.
>
> strtold is used in core.demangle in the parseReal function. Is it safe to just replace strtold with strtod for Android?
>
> --
> Johannes Pfau
>

I would have thought that it would be a weak alias to strtod in the C library, so you need to do nothing.


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime

March 20, 2012
On 20 March 2012 13:56, Iain Buclaw <ibuclaw@ubuntu.com> wrote:
> On 20 March 2012 12:48, Johannes Pfau <johannespfau@googlemail.com> wrote:
>> For ARM, real and double are the same types (long double == double in c).
>> Because of that bionic (android's C library) doesn't provide a strtold
>> function.
>>
>> strtold is used in core.demangle in the parseReal function. Is it safe to just replace strtold with strtod for Android?
>>
>> --
>> Johannes Pfau
>>
>
> I would have thought that it would be a weak alias to strtod in the C library, so you need to do nothing.

Technically, the string may be an 80 bit number, even on ARM, because
it's a compile time value.
But from memory you only need the %A format anyway, which is the easy one.
_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime

March 20, 2012
Am 20.03.2012 13:56, schrieb Iain Buclaw:
> On 20 March 2012 12:48, Johannes Pfau<johannespfau@googlemail.com>  wrote:
>> For ARM, real and double are the same types (long double == double in c).
>> Because of that bionic (android's C library) doesn't provide a strtold
>> function.
>>
>> strtold is used in core.demangle in the parseReal function. Is it safe to
>> just replace strtold with strtod for Android?
>>
>> --
>> Johannes Pfau
>>
> I would have thought that it would be a weak alias to strtod in the C
> library, so you need to do nothing.
>
No, it's not included in bionic in any way:

/tmp/ccPtyQhH.o: In function `_Dmain':
main.d:(.text+0x1d4): undefined reference to `strtold'

-- 
Johannes Pfau

_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime

March 20, 2012
On 20 March 2012 15:42, Johannes Pfau <johannespfau@googlemail.com> wrote:
> Am 20.03.2012 13:56, schrieb Iain Buclaw:
>
>> On 20 March 2012 12:48, Johannes Pfau<johannespfau@googlemail.com>  wrote:
>>>
>>> For ARM, real and double are the same types (long double == double in c).
>>> Because of that bionic (android's C library) doesn't provide a strtold
>>> function.
>>>
>>> strtold is used in core.demangle in the parseReal function. Is it safe to just replace strtold with strtod for Android?
>>>
>>> --
>>> Johannes Pfau
>>>
>> I would have thought that it would be a weak alias to strtod in the C library, so you need to do nothing.
>>
> No, it's not included in bionic in any way:
>
> /tmp/ccPtyQhH.o: In function `_Dmain':
> main.d:(.text+0x1d4): undefined reference to `strtold'

Then make the alias in the D code specifically for Bionic using version identifiers - see core.stdc.math as an example of what is done for missing math functions from FreeBSD.



-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime

March 20, 2012
Am 20.03.2012 16:48, schrieb Iain Buclaw:
> On 20 March 2012 15:42, Johannes Pfau<johannespfau@googlemail.com>  wrote:
>> Am 20.03.2012 13:56, schrieb Iain Buclaw:
>>
>>> On 20 March 2012 12:48, Johannes Pfau<johannespfau@googlemail.com>    wrote:
>>>> For ARM, real and double are the same types (long double == double in c).
>>>> Because of that bionic (android's C library) doesn't provide a strtold
>>>> function.
>>>>
>>>> strtold is used in core.demangle in the parseReal function. Is it safe to
>>>> just replace strtold with strtod for Android?
>>>>
>>>> --
>>>> Johannes Pfau
>>>>
>>> I would have thought that it would be a weak alias to strtod in the C
>>> library, so you need to do nothing.
>>>
>> No, it's not included in bionic in any way:
>>
>> /tmp/ccPtyQhH.o: In function `_Dmain':
>> main.d:(.text+0x1d4): undefined reference to `strtold'
> Then make the alias in the D code specifically for Bionic using
> version identifiers - see core.stdc.math as an example of what is done
> for missing math functions from FreeBSD.
>
OK. I just wasn't sure if this could cause issues if the mangled name really contains a 80bit floating point number.

-- 
Johannes Pfau

_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime

March 20, 2012
On Mar 20, 2012, at 5:48 AM, Johannes Pfau wrote:

> For ARM, real and double are the same types (long double == double in c). Because of that bionic (android's C library) doesn't provide a strtold function.
> 
> strtold is used in core.demangle in the parseReal function. Is it safe to just replace strtold with strtod for Android?

I'm not sure where the best place is to fix this.  Maybe in core.stdc itself, either aliasing strtod to strtold?  Or an extern (D) function named strtold that calls strtod?  Alternately, we could have a static if in the demangle code to switch.
_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime