LDC with ARM backend
Claude via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jul 19 07:22:12 PDT 2016
On Friday, 15 July 2016 at 15:24:36 UTC, Kai Nacke wrote:
> There is a reason why we do not distribute a binary version of
> LDC with all LLVM targets enabled. LDC still uses the real
> format of the host. This is different on ARM (80bit on
> Linux/x86 vs. 64bit on Linux/ARM). Do not expect that
> applications using real type work correctly.
> (The Windows version of LDC uses 64bit reals. The binary build
> has the ARM target enabled.)
>
> Regards,
> Kai
Hello Kai,
Thanks for your answer.
From the link https://wiki.dlang.org/Build_LDC_for_Android , I
did exactly the same steps described in section "Compile LLVM"
(patch applied).
At section "Build ldc for Android/ARM", I did it quite the same.
I applied the patch ldc_1.0.0_android_arm, but changed
runtime/CMakeList.txt, instead of using Android specific stuff, I
did:
Line 15:
set(D_FLAGS -w;-mtriple=arm-none-linux-gnueabi
CACHE STRING "Runtime build flags, separated by ;")
Line 505:
#
# Set up build targets.
#
set(RT_CFLAGS "-g")
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER
/opt/arm-2009q1/bin/arm-none-linux-gnueabi-gcc)
set(CMAKE_CXX_COMPILER
/opt/arm-2009q1/bin/arm-none-linux-gnueabi-c++)
On the command line, I aliased DMD to /usr/bin/dmd and runt cmake
as described...
Afterwards, I ran make for ldc2, phobos2-ldc an druntime-ldc, but
I did not apply the patches on phobos and runtime. It looked like
the path introduced some static compilation towards Android, so I
thought it would not apply to my needs.
So here' what I get if I do a "ldc2 -version":
LDC - the LLVM D compiler (1.0.0):
based on DMD v2.070.2 and LLVM 3.8.1
built with DMD64 D Compiler v2.071.1
Default target: x86_64-unknown-linux-gnu
Host CPU: westmere
http://dlang.org - http://wiki.dlang.org/LDC
Registered Targets:
arm - ARM
armeb - ARM (big endian)
thumb - Thumb
thumbeb - Thumb (big endian)
I can strictly compile a "hello world" program:
./bin/ldc2 -mtriple=arm-none-linux-gnueabi test.d
I get the expected "test.o"
But I don't know how to link it. I don't have "clang". I tried to
link it with the gcc from the gnu ARM toolchain with
libdruntime-ldc.a, libldc.a and libphobos2-ldc.a, but it fails
miserably: many undefined symbols (pthread, and some other os
related stuff).
More information about the Digitalmars-d-learn
mailing list