I am new to the C programming language and gcc.
I am using below command to compile my C program . But sometimes i see the generated riscv assembly code does not seem to exactly match the functionality of C program.
Is there any tool or option in gcc or any technique to write c program which will help me to map the Riscv Assembly code to my C program code. I.e I want a section of C code maps or refer to which line of LST program.
riscv64-unknown-elf-gcc -O3 -mabi=lp64d -flto -mstrict-align -march=rv64ima -mcmodel=medany -ffunction-sections -fdata-sections -D TARGET -D FIXED -I/riscv/env/ -c -o sanity.o sanity.c
riscv64-unknown-elf-gcc crt.S -static -nostartfiles -lm -lgcc -Xlinker -Tlinker_script.ld -O3 -mabi=lp64d -flto -mstrict-align -march=rv64ima -mcmodel=medany -ffunction-sections -fdata-sections -D TARGET -D FIXED common.o sanity.o -Wl,-Map=riscv.elf.map -o riscv.elf
riscv64-unknown-elf-objdump -d riscv.elf > riscv.lst
Thank you for your help.