Forum Discussion

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

Removing unused code fror NIOS target

Hi All,

I am using nios-elf tools to compile and build a binary for NIOS target. There are many

unused functions in the code which I want to remove during linking.

I have used -ffunction-sections as a compile option and -gc-sections as linker option. Though I am able to put the functions in their own sections , I am not able to run the resulting binary.

I have often read that not all targets support this. Does any one know if NIOS target supports this?

Cheers,

Ajay

1 Reply

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

    --- Quote Start ---

    originally posted by ajay@Jan 19 2006, 08:11 AM

    i am using nios-elf tools to compile and build a binary for nios target. there are many

    unused functions in the code which i want to remove during linking.

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=12280)

    --- quote end ---

    --- Quote End ---

    Did you try putting each function in a separate file, creating a library out of them, and linking the library to the main file? the linker should be able to do the job automatically for you!

    bye

    Paolo