LDC 1.2.0-beta1 has been released!

Radu via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Fri Mar 24 00:30:58 PDT 2017


On Friday, 24 March 2017 at 06:19:34 UTC, Joakim wrote:
> On Thursday, 23 March 2017 at 16:05:55 UTC, Radu wrote:
>> On Saturday, 18 March 2017 at 08:39:31 UTC, Kai Nacke wrote:
>>> [...]
>>
>> I tested a bit 1.2.0-beta1 as a cross compiler for ARM. Good 
>> news is that basic stuff like "hello world" works. Really good 
>> news, at least for me, is that all this was done on Windows 
>> Linux Subsystem [1].
>>
>> Unfortunately all good news ends as soon I try something more 
>> involved, like:
>> =======================================
>> import std.stdio;
>>
>> void main()
>> {
>>     try
>>     {
>>       throw new Exception("darn!");
>>     }
>>     catch(Exception e)
>>     {
>>       writeln(e.msg);
>>     }
>>     writeln("Hello world!");
>> }
>> =======================================
>> I get:
>>
>> Fatal error in EH code: _Unwind_RaiseException failed with 
>> reason code: 9
>> Aborted
>>
>> The machine I'm running this on is an ARM926EJ-S rev 5, and 
>> the ABI used is ARM, EABI5 version 1 soft float.
>>
>> Any idea what might be wrong here?
>>
>> [1] https://msdn.microsoft.com/en-us/commandline/wsl/about
>
> I have no problem when either cross-compiling or natively 
> compiling that code for Android/ARM, by using the llvm triple 
> armv7-none-linux-android with ldc 1.2.  What llvm triple are 
> you using?
>
> It could be that the ARM exception-handling code isn't right 
> for your ARM platform/ABI, as we had similar issues on other 
> ARM platforms till Dan fixed them:
>
> https://github.com/ldc-developers/ldc/issues/1283

I tried a couple of things

ldc2 -mtriple=arm-none-linux-gnueabi -gcc=arm-linux-gnueabi-gcc


Then something closer to my config

ldc2 -mtriple=armv4t-none-linux-gnueabi -mcpu=arm9tdmi 
-gcc=arm-linux-gnueabi-gcc

The problem I think is that the system I'm targeting uses ARM, 
EABI4 version 1 (SYSV), as bellow:

readelf -A libc-2.9.so
Attribute Section: aeabi
File Attributes
   Tag_CPU_name: "ARM9TDMI"
   Tag_CPU_arch: v4T
   Tag_ARM_ISA_use: Yes
   Tag_ABI_PCS_wchar_t: 4
   Tag_ABI_FP_denormal: Needed
   Tag_ABI_FP_exceptions: Needed
   Tag_ABI_FP_number_model: IEEE 754
   Tag_ABI_align_needed: 8-byte
   Tag_ABI_align_preserved: 8-byte, except leaf SP
   Tag_ABI_enum_size: int

But the app I build uses ARM, EABI5 version 1 (SYSV)

Attribute Section: aeabi
File Attributes
   Tag_CPU_name: "5T"
   Tag_CPU_arch: v5T
   Tag_ARM_ISA_use: Yes
   Tag_THUMB_ISA_use: Thumb-1
   Tag_ABI_PCS_GOT_use: GOT-indirect
   Tag_ABI_PCS_wchar_t: 4
   Tag_ABI_FP_rounding: Needed
   Tag_ABI_FP_denormal: Needed
   Tag_ABI_FP_exceptions: Needed
   Tag_ABI_FP_number_model: IEEE 754
   Tag_ABI_align_needed: 8-byte
   Tag_ABI_enum_size: int
   Tag_CPU_unaligned_access: v6
   Tag_ABI_FP_16bit_format: IEEE 754


More information about the digitalmars-d-ldc mailing list