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]

Re: How can ld linker script keep some objs' section?


Hi xunxun,

In the end, I want to know now, are there some methods to only keep
dllcrt2.o's or some objs' .eh_frame section?

Using linker garbage collection to discard unneeded .eh_frame sections but keep the needed ones - no. But if you know before hand which object files contain .eh_frame sections that you need to keep then - yes. You just need to use a modified version of the KEEP directives, specifing which object files to preserve. Eg:


  KEEP (dllcrt2.o(.eh_frame))
  KEEP (foo.o(.eh_frame))

This will ensure that the .eh_frame sections in dllcrt2.o and foo.o are always retained.


Or some methods to only keep all .eh_frame sections when building DLL,
but not static build?

Use different linker scripts when building DLLs and static executables. In one use the KEEP directive(s) and in the other omit them.


Cheers
  Nick



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