# Generating executable for Rocket Chip

**URL:** <https://forums.sifive.com/t/generating-executable-for-rocket-chip/2148>\
**Category:** RISC-V\
**Created:** [March 12, 2019, 3:57pm UTC](https://forums.sifive.com/t/generating-executable-for-rocket-chip/2148 "2019-03-12T15:57:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vincenzo.ciotoli](https://avatars.discourse-cdn.com/v4/letter/v/f475e1/32.png) [@vincenzo.ciotoli](https://forums.sifive.com/u/vincenzo.ciotoli)\
**Post date:** [March 12, 2019, 3:57pm UTC](https://forums.sifive.com/t/generating-executable-for-rocket-chip/2148/1 "2019-03-12T15:57:38Z")

</div>

Hello everyone,

I’m trying to generate an executable helloworld.run to do the emulation with Rocket Chip.  
According to page (in section 2 of Debugging with GDB)

> **[freechipsproject/rocket-chip](https://github.com/freechipsproject/rocket-chip)**
>
> Rocket Chip Generator. Contribute to freechipsproject/rocket-chip development by creating an account on GitHub.

I have to generate the .run file with these 3 commands:

% riscv-gcc -c common/crt.S -o crt.o  
% riscv-gcc -c hello.c -o hello.o  
% riscv-gcc -T common/test.ld common/syscalls.c -lc hello.o -o hello.run

The last command doesn’t work and I receive these errors:

/tmp/ccJNVZKj.o: In function `_init': syscalls.c:(.text+0x63c): multiple definition of`\_init’

/riscv-tools/lib/gcc/riscv64-unknown-elf/7.2.0/…/…/…/…/riscv64-unknown-elf/lib/crt0.o:(.text+0x52): first defined here

/riscv-tools/lib/gcc/riscv64-unknown-elf/7.2.0/…/…/…/…/riscv64-unknown-elf/lib/crt0.o: In function `.L0 ': (.text+0x8): undefined reference to`\_edata’

/riscv-tools/lib/gcc/riscv64-unknown-elf/7.2.0/crtbegin.o: In function `deregister_tm_clones': crtstuff.c:(.text+0x0): relocation truncated to fit: R_RISCV_HI20 against` **TMC\_LIST** ’

/riscv-tools/lib/gcc/riscv64-unknown-elf/7.2.0/…/…/…/…/riscv64-unknown-elf/bin/ld: final link failed: Symbol needs debug section which does not exist  
collect2: error: ld returned 1 exit status

In addition I have tried to add the “-mcmodel=medany” option but is the same.

Where is the problem??

Thank you all!
