Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

Nios2 g++ compile error: unexpected reloc type R_NIOS2_UJMP

Hi everyone.

I'm trying to compile an open source project and run it on a Nios2 soft-core processor running uClinux.

The project contains round 50 files so there is a lot of compiling. So I compile all the files individually using Alteras Nios2 gcc/g++ compiler together with the -c option that produces object files.

So far so good, but when I try to link the all the files together into a single file I get this strange error message:

--- Quote Start ---

Err: unexpected reloc type R_NIOS2_CJMP(19)

Err: unexpected reloc type R_NIOS2_UJMP(18)

Err: unexpected reloc type R_NIOS2_CJMP(19)

Err: unexpected reloc type R_NIOS2_UJMP(18)

Err: unexpected reloc type R_NIOS2_UJMP(18)

Err: unexpected reloc type R_NIOS2_UJMP(18)

Err: unexpected reloc type R_NIOS2_UJMP(18)

Err: unexpected reloc type R_NIOS2_UJMP(18)

Err: unexpected reloc type R_NIOS2_CJMP(19)

Err: unexpected reloc type R_NIOS2_UJMP(18)

Err: unexpected reloc type R_NIOS2_UJMP(18)

Err: unexpected reloc type R_NIOS2_UJMP(18)

Err: unexpected reloc type R_NIOS2_UJMP(18)

Err: unexpected reloc type R_NIOS2_UJMP(18)

Err: unexpected reloc type R_NIOS2_UJMP(18)

Err: unexpected reloc type R_NIOS2_UJMP(18)

Err: unexpected reloc type R_NIOS2_CJMP(19)

Err: unexpected reloc type R_NIOS2_CJMP(19)

18 bad relocs

collect2: ld returned 1 exit status

--- Quote End ---

As far as I understand it, uClinux can't handle ELF files. So after I have compiled all the sources files individually, I need to use the argument -Wl,-elf2flt[/B][/B] in the link procedure in order to convert my final file from ELF to FLT format. I can link the program without errors if I neglect the -Wl,-elf2flt [/B][/B]option but with it I get the error messages above.

There isn't really much to find on google about this matter unfortunately. The only relevant page I found is from Alteras forum but that thread went cold four years ago. Here is the link nevertheless: http://www.alteraforum.com/forum/showthread.php?t=20134&highlight=r_nios2_ujmp

Is there anyone that knows what can be wrong? If you need any files or information don't hesitate to ask.

Thank you in advance,

Erik
No RepliesBe the first to reply