www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Compiler error when compiling druntime for ARM float=soft

reply IGotD- <nise nise.com> writes:
I'm trying get druntime to compile for ARMv7 but with software 
floating point. When the first druntime module try to compile I 
get this error.

LVM ERROR: Cannot select: 0x8818a78: f64 = bitcast 0x88186d0
   0x88186d0: i64 = build_pair 0x8819090, 0x88191c8
     0x8819090: i32,ch = CopyFromReg 0x8575238, Register:i32 %15
       0x865fae0: i32 = Register %15
     0x88191c8: i32,ch = CopyFromReg 0x8819090:1, Register:i32 %16
       0x8818db8: i32 = Register %16
In function: _memset80

Among other things I'm using the following architecture flags 
when compiling, this for a custom target.

--dFlags=-mtriple=arm-none-eabi --dFlags=-mcpu=cortex-a9 
--dFlags=--mattr=+thumb2 --dFlags=--mattr=+soft-float 
--dFlags=--relocation-model=pic

If I remove "--dFlags=--mattr=+soft-float", the build succeeds 
(only the first module, however that's the only one I'm 
interested in for now, ldc-build-runtime inserts double 
--dFlags=--relocation-model=pic which the build doesn't like when 
compiling the shared library version which is strange because I 
have added BUILD_SHARED_LIBS=OFF).
Apr 15 2020
parent reply kinke <noone nowhere.com> writes:
On Wednesday, 15 April 2020 at 18:31:55 UTC, IGotD- wrote:
 I'm trying get druntime to compile for ARMv7 but with software 
 floating point. When the first druntime module try to compile I 
 get this error.
It's easier if you just post a failing cmdline, which in this case is something like ldc2 -c .../druntime/src/rt/memset.d -mtriple=armv7-none-eabi -mcpu=cortex-a9 -float-abi=soft -O It's compiling fine without -O; with optimizations, LLVM (10) hits an assertion (if built with those enabled, otherwise errors out later as you've seen). So might be worth filing an LLVM issue about it. [It's also optimized fine with `-float-abi=softfp`.] Luckily, this rt.memset module seems utterly useless for LDC, so you shouldn't need it and can simply delete the source file. PS: I hope you are using COMPILE_ALL_D_FILES_AT_ONCE=OFF when working on the libraries.
Apr 15 2020
parent IGotD- <nise nise.com> writes:
On Wednesday, 15 April 2020 at 19:51:37 UTC, kinke wrote:
 It's easier if you just post a failing cmdline, which in this 
 case is something like

 ldc2 -c .../druntime/src/rt/memset.d -mtriple=armv7-none-eabi 
 -mcpu=cortex-a9 -float-abi=soft -O

 It's compiling fine without -O; with optimizations, LLVM (10) 
 hits an assertion (if built with those enabled, otherwise 
 errors out later as you've seen). So might be worth filing an 
 LLVM issue about it. [It's also optimized fine with 
 `-float-abi=softfp`.]

 Luckily, this rt.memset module seems utterly useless for LDC, 
 so you shouldn't need it and can simply delete the source file.

 PS: I hope you are using COMPILE_ALL_D_FILES_AT_ONCE=OFF when 
 working on the libraries.
I did what you suggested, I added COMPILE_ALL_D_FILES_AT_ONCE=OFF and removed memset.d from the build and now the first build goes through. I thought memset.d was kind of strange as this was something that could obviously be mitigated to LLVM. Shouldn't this be removed from the build in the cmake file? Thank you.
Apr 15 2020