Andes Workshop

It is currently Fri Apr 19, 2024 2:01 am

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: ld的export symbol的使用方式
PostPosted: Wed Aug 17, 2011 11:47 am 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
ld的export symbol的功能,使用方式如下

Export symbol:
在 LD_FLAGS 加上 -Wl,--mgen-symbol-ld-script=<Filename>
Ld 會產生 <Filename> 這個檔案, 這個檔案是一個linker script
裡面包含了一個SECTION block以及許多的assignment, 如下所示

Attachment:
export1.gif
export1.gif [ 10.71 KiB | Viewed 11555 times ]


Assignment 左側的symbol 就是export symbol
請把您需要的symbol留下來,不要的刪去。
如果你想要加入額外的symbol
可以加額外的assignment在export symbol之後


Import symbol:
在要import symbol 的linker script (Ex. patch.ld)裡加上
INCLUDE <Filename>
( Ex. INCLUDE my_symbols /* my_symbols contains export symbols */ )
即可


如果是AndeSight裡的project,export的選項可以如下面的設定。

Attachment:
export.gif
export.gif [ 20.99 KiB | Viewed 11555 times ]


Last edited by cindy on Mon Nov 21, 2011 11:27 am, edited 1 time in total.

Top
 Profile Send private message E-mail  
 
 Post subject: Re: ld的export symbol的使用方式
PostPosted: Mon Oct 03, 2011 5:42 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
*.ld檔中的寫法如下,如紅色字體的部份
/* Default linker script, for normal executables */
OUTPUT_FORMAT("elf32-nds32", "elf32-nds32",
"elf32-nds32")
OUTPUT_ARCH(nds32)
ENTRY(_start)
/* Do we need any of these for elf?
__DYNAMIC = 0; */
INCLUDE "..\export.txt"
SECTIONS
{
/* Read-only sections, merged into text segment: */
PROVIDE (__executable_start = 0x500000); . = 0x500000;
.nds32_init : { KEEP(*(.nds32_init)) }
.interp : { *(.interp) }

目前只有一個使用上的限制,include symbol之後,無法使用-mrelax的option。

記得不要加這個option。


Top
 Profile Send private message E-mail  
 
 Post subject: Re: ld的export symbol的使用方式
PostPosted: Wed Nov 30, 2011 11:38 am 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
附件是一個完整的範例,裡面有簡易說明,
這樣子看比較容易了解。

Attachment:
ROM_patch_20111123.7z [201.74 KiB]
Downloaded 919 times


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

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 9 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