Andes Workshop

It is currently Tue Sep 17, 2019 5:49 am

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: link的順序
PostPosted: Wed Mar 06, 2013 11:46 am 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
在編譯code時,.o的位置不同,
編譯出來的elf執行檔也不同。
例如下面這個:
gcc -o mytest main.o 2.o 3.o
和這個
gcc -o mytest 2.o 3.o main.o

產生的執行檔內容有些不同。
如果linker script裡沒有特別指定.o的位置,
linker會照下command的順序來放各個.o。

不同的.o順序,linker在放function時的順序也不同。
所以link完的執行檔有一些不同。
size也有可能不同,因為function遠近會影響jump的距離。


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group