Page 1 of 1

clever linker sciprt - but i don't want it

Posted: Sat Oct 13, 2007 10:46 am
by mcheung63
Hi All
Here is my linker script:
ENTRY (int0_isr)
OUTPUT_FORMAT(binary
SECTIONS
{
. = 0x500000;
.interrupt0.o : { interrupt0.o(*) }

. = 0x1200000;
.newlib : { newlib.a (*) }
}

The ld linker is very clever, it will detect which function have been used in interrupt.o of newlib.a, and then the ld will put those functions into the output file. For the functions of newlib.a which have been used in interrupt0.o, it will not be included in the output file. How can i stop this behavior? I want to include the whole newlib.a into the output file whatever the function is used or not.

You can see the output format is flat binary, if i want to delete every bytes in the output file, which is from newlib.a, how to? I want to do this because i only want to reference the function from newlib.a but not including them into the output format

thanks
from Peter ([email protected])

Posted: Sat Oct 13, 2007 5:37 pm
by LordMage
Okay, I can't help you with the linker script, but I am confused about one thing. why in the world would you want to include functions that you aren't using?????????????????? That really doesn't seem to make sense to me. you are wasteing space and memory so why do it?

Posted: Sat Oct 13, 2007 9:50 pm
by mcheung63
Hi
Because the functions are already loaded by kernel image (other than interrupt0.o) , that means the newlib.a is already exist in the memory , so i don't want to keep a copy everytime i link something

thanks
from Peter

Posted: Sat Oct 13, 2007 9:53 pm
by Brynet-Inc
What do you think 'newlib.a' is? It's an archive of object files(.o).. It's static.. :roll: