This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How can ld linker script keep some objs' section?


Hi, all

I want to use ld's --gc-sections option on MinGW.

Depend on the bug: http://sourceware.org/bugzilla/show_bug.cgi?id=11539
We can use static build with --gc-sections successfully, but failed use it when building and using DLL build.


I compared the linker map between before and after using --gc-sections, and found that --gc-sections will remove the obj's section:

.eh_frame 0x6da05000 0xcc e:/mysoft/programmingtools/compiler/mingw/bin/../lib/gcc/i686-w64-mingw32/4.6.2/../../../../i686-w64-mingw32/lib/../lib/dllcrt2.o


So I try to keep all .eh_frame sections in pe.sc linker script, you can modify *(.eh_frame*) to KEEP (*(.eh_frame))
then the built dll can be used successfully, but because of all .eh_frame sections being kept, the dll size reduced by --gc-sections becomes more smaller, and it will influence static build's size to be larger.


In the end, I want to know now, are there some methods to only keep dllcrt2.o's or some objs' .eh_frame section?
Or some methods to only keep all .eh_frame sections when building DLL, but not static build?


Many thanks.

--
Best Regards,
xunxun


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]