clever linker sciprt - but i don't want it

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
mcheung63
Member
Member
Posts: 175
Joined: Thu Jun 22, 2006 8:33 am
Location: Hong Kong
Contact:

clever linker sciprt - but i don't want it

Post 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])
LordMage
Member
Member
Posts: 115
Joined: Sat Sep 22, 2007 7:26 am
Contact:

Post 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?
Getting back in the game.
User avatar
mcheung63
Member
Member
Posts: 175
Joined: Thu Jun 22, 2006 8:33 am
Location: Hong Kong
Contact:

Post 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
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

What do you think 'newlib.a' is? It's an archive of object files(.o).. It's static.. :roll:
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
Post Reply