<div dir="ltr">I am using llvm-project compiling risc-v programs.<div><br></div><div>llvm-project version:dd8a2013dc1804be1b7d9cffacad2e984300bd22</div><div><br></div><div>Instructons to build LLVM+clang:</div><div><br></div><div>```</div><div>cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/home/llvm/workspace/llvm/llvm-project/llvm_install -DCMAKE_BUILD_TYPE="Release" -DDEFAULT_SYSROOT="/home/llvm/workspace/riscv/riscv-tc-20200220/bin/riscv32-unknown-elf" -DGCC_INSTALL_PREFIX="/home/llvm/workspace/riscv/riscv-tc-20200220" -DLLVM_DEFAULT_TARGET_TRIPLE="riscv32-unknown-elf" -DLLVM_ENABLE_PROJECTS="clang;lld;libc" -DLLVM_TARGETS_TO_BUILD="RISCV" ../llvm<br></div><div>```</div><div><br></div><div>Instructions to compile and dump:</div><div><br></div><div>```</div><div>RISCV_GCC_OPTS ?= -mcmodel=medany -static -O3 -std=gnu99 -fno-common -fno-builtin -march=rv32im -mabi=ilp32 -DMB_ADDR=0x80FFFFC --target=riscv64-unknown-elf --sysroot=/home/llvm/workspace/riscv/riscv-tc-20200220/bin/riscv64-unknown-elf --gcc-toolchain=/home/llvm/workspace/riscv/riscv-tc-20200220<br>RISCV_LINK_OPTS ?= -static -nostdlib -nostartfiles -lm -lgcc -T /home/llvm/workspace/HRV_IDE/common/test.ld<br>newlib_dir := /home/llvm/workspace/llvm/llvm-project/llvm_install/riscv64-unknown-elf/include<br>src_dir := $(WORK_DIR)/src/$(PROJ)<br>incs  += -I$(WORK_DIR)/env -I$(WORK_DIR)/common -I$(src_dir) -I$(newlib_dir)<br>src := $(wildcard $(src_dir)/*.c) $(wildcard $(WORK_DIR)/common/*.c) $(wildcard $(WORK_DIR)/common/*.S)<br><br>$(RISCV_clang) $(incs) $(RISCV_GCC_OPTS) -o $(WORK_DIR)/build/$@/$@ $(src) $(RISCV_LINK_OPTS) --verbose<br>$(RISCV_OBJDUMP) -d $(WORK_DIR)/build/$@/$@ > $(WORK_DIR)/build/$@/$@.S<br></div><div>$(RISCV_LLVM_OBJDUMP) --arch=rv32imac -D $(WORK_DIR)/build/$@/$@ > $(WORK_DIR)/build/$@/$@.ASM<br></div><div>```</div><div>gcc objdump result:</div><div>```</div><div>4001168:   00052383           lw      t2,0(a0)<br> 400116c:    979a                    add     a5,a5,t1<br> 400116e:    439c                    lw      a5,0(a5)<br> 4001170:    0308a533           mulhsu  a0,a7,a6<br></div><div>```</div><div><br></div><div>llvm-objdump result:</div><div><br></div><div>```</div><div> 4001168: 83 23 05 00                       lw      t2, 0(a0)<br> 400116c: 9a 97                         add     a5, a5, t1<br> 400116e: 9c 43                                lw      a5, 0(a5)<br> 4001170: 33 a5 08 03                      <unknown><br></div><div>```</div><div><br></div><div>Does anyone knows what is the problem and how to fix it? </div></div>