kassane commented on code in PR #12854:
URL: https://github.com/apache/nuttx/pull/12854#discussion_r1705521971


##########
tools/D.defs:
##########
@@ -46,28 +46,18 @@ ifeq ($(CONFIG_ARCH_SIM),y)
     DFLAGS += -mtriple=$(LLVM_ARCHTYPE)-apple-$(LLVM_ABITYPE)
   endif
 else ifeq ($(CONFIG_ARCH_RISCV),y)
-  # Traget triple is riscv[32|64][isa]-unknown-none-elf
+  # Target triple is riscv[32|64]-unknown-none-elf
+  DFLAGS += -mtriple=$(LLVM_ARCHTYPE)-unknown-none-elf
+  DFLAGS += -mattr=+m,+a,+f,+d,+c
 
-  D_ARCHTYPE = $(LLVM_ARCHTYPE)i
-  ifeq ($(CONFIG_ARCH_RV_ISA_M),y)
-    D_ARCHTYPE := $(D_ARCHTYPE)m
+  # Handle ABI and CPU
+  ifeq ($(CONFIG_ARCH_RV32),y)
+    DFLAGS += -mcpu=generic-rv32
+    DFLAGS += -mabi=ilp32d

Review Comment:
   The default is `riscv[32|64]-` no need `[isa]`.
   ```bash
   $ ldc2 -mtriple=riscv32i -mcpu=help
   Error: unable to get target for 'riscv32i', see -version and -mtriple.
   $ ldc2 -mtriple=riscv32gc -mcpu=help
   Error: unable to get target for 'riscv32gc', see -version and -mtriple.
   ```
   It's strange because `ldmd2` (ldc2-wrapper, `dmd` flags compat) supports 
false positives on flags and doesn't report an error.
   
   ## Reference
   - https://github.com/ldc-developers/ldc/pull/4322



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to