Open jacob-carlborg opened 1 year ago
LDC generic target support requires a triple (IIRC, checks that at least one -
is in the string), these one-word --arch
values are restricted to what DMD supports.
It works fine passing just -mtriple arm64
to LDC:
$ ldc2 --version
LDC - the LLVM D compiler (1.32.0):
based on DMD v2.102.2 and LLVM 15.0.7
built with LDC - the LLVM D compiler (1.32.0)
Default target: arm64-apple-darwin23.0.0
Host CPU: apple-m1
$ cat main.d
extern (C) void main()
{
}
$ ldc2 -mtriple arm64 main.d -c
$ file main.o
main.o: ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
Honestly I don't remember why I reported this. Perhaps I tried to cross-compile and was lazy and only typed arm64
(since that works with both LDC and Clang) instead of the whole triple. Using dub --arch
with the full triple works.
This could be resolved with a better error message, something that explains triple and how to find it.
On Fri, Jul 21, 2023, 18:24 Jacob Carlborg @.***> wrote:
Honestly I don't remember why I reported this. Perhaps I tried to cross-compile and was lazy and only typed arm64 (since that works with both LDC and Clang) instead of the whole triple. Using dub --arch with the full triple works.
— Reply to this email directly, view it on GitHub https://github.com/dlang/dub/issues/2665#issuecomment-1645045740, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHSL44AEWSVHQLHBMA2IOTXRIODDANCNFSM6AAAAAAZM4KJXY . You are receiving this because you are subscribed to this thread.Message ID: @.***>
It works fine passing just -mtriple arm64 to LDC:
I meant dub's LDC support: https://github.com/dlang/dub/blob/3cc17fc618db6a69f02de26981218a30e00a5083/source/dub/compilers/ldc.d#L82-L95
Seems like Dub should just pass the value of the --arch
flag as is to LDC using the -mtriple
flag. Basically the above code can be replaced just with:
System information
Bug Description
arm64
is not recognized as a supported architecture. This is another name foraarch64
. It's used by at least macOS and OpenBSD (output ofuname
). Clang recognizes this architecture regardless of platform.How to reproduce?
Expected Behavior
Same as when the architecture is specified as
aarch64
: