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


##########
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:
   Sorry I'm not clear about rv32gc/rv64gc support in D. I was trying to 
restore the original intent for compiling D, which supports rv32gc only: 
https://github.com/apache/nuttx/commit/c6eea4ad8b80dcbc5c517ae2d3f6d59ba7db99d0#diff-052b9ec2c7c236a9a88a7cc78a9b4fc765e1741a3456a283174566665f74c995
   
   ```text
     # Traget triple is riscv[32|64][isa]-unknown-none-elf
     DFLAGS += 
-mtriple=$(LLVM_ARCHTYPE)$(ARCHRVISAM)$(ARCHRVISAA)$(ARCHRVISAF)$(ARCHRVISAD)$(ARCHRVISAC)-unknown-none-elf
     DFLAGS += -mattr=+m,+a,+f,+d,+c -mabi=ilp32d
     DFLAGS += -mcpu=generic-rv32
   ```
   
   Hi @kassane: Wonder if you would like to expand the logic to handle other 
types of D Targets, like rv32imac? Or should we leave this for now? Thanks!



-- 
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