Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12586 Discussions

How is exception section linked in final elf?

Altera_Forum
Honored Contributor II
961 Views

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
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
258 Views

maybe the linkerscript?

0 Kudos
Altera_Forum
Honored Contributor II
258 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
258 Views

??? 

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.
0 Kudos
Altera_Forum
Honored Contributor II
258 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
258 Views

Thanks very much for all your help:) 

David
0 Kudos
Reply