Forum Discussion

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

How is exception section linked in final elf?

Dear all,

As we known, system library project will create a library file *.a(which including the *.o containing alt_exception function) for your application project.

But I'm confusing that, in application project, you never use alt_exception symbol, why it's linked into final elf file and how??

I think it should be a linker issue, hope someone help me.http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/happy.gif

Thanks in advance,

David

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    NiosII IDE will create linker script(generated.x) automatically, but I think it&#39;s only for system library project.

    Where can I find the linker script for application project?

    What&#39;s the meaning of KEEP in generated.x?

    Help me,

    David
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    ???

    The generated.x file is used when linking your application. The IDE compiles the source files of your application project to object files and finally links them all together with the syslib.a to create the executable elf file.

    You can enable the "Show command lines when running &#39;make&#39;" option in the Nios II preferences of the IDE. This will give you more details about the entire build process.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi David_Cai,

    you only need one linker script, because the application is only linked once.

    The system library is a, well a library. A library contains the (unlinked) object files of the library sources. (alt_avalon_uart.c becomes alt_avalon_uart.o. This .o is stuffed into the library.) In short a (static) library is only a archive of object files.

    The linking takes place after all your application files are compiled. Together with the system library these files are linked into the final executable.

    I think KEEP tells the linker to keep the section in question even if it is empty.

    For the linker script language look at the manual for the gnu linker ld. See using ld (http://www.gnu.org/software/binutils/manual/ld-2.9.1/html_mono/ld.html).

    Bye,

    Wolfgang