[hellogcc] Re: ld脚本能否排除某个目录下的文件或者某个文件的section?

  • From: 陳韋任 <chenwj@xxxxxxxxxxxxxx>
  • To: hellogcc@xxxxxxxxxxxxx
  • Date: Tue, 1 Nov 2011 16:48:24 +0800

>      现在我想问,能否keep时排除一些文件的.eh_frame,或者能否判断当前生成 
> dll时才keep,静态库可以去除,不知道在linker脚本中该 如何表达?

  不確定是不是你要的結果,ld 在處理 .ctors section 的時候是用底下腳本。

---
  .ctors          :
  {
    KEEP (*crtbegin.o(.ctors))
    KEEP (*crtbegin?.o(.ctors))
    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
    KEEP (*(SORT(.ctors.*)))
    KEEP (*(.ctors))
  }
---

  EXCLUDE_FILE 可以達到你想要的目的嗎?

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667

Other related posts: