This is the mail archive of the
mailing list for the binutils project.
Re: How can ld linker script keep some objs' section?
- From: Nick Clifton <nickc at redhat dot com>
- To: xunxun <xunxun1982 at gmail dot com>
- Cc: binutils <binutils at sourceware dot org>
- Date: Wed, 02 Nov 2011 16:33:47 +0000
- Subject: Re: How can ld linker script keep some objs' section?
- References: <4EAFB16E.firstname.lastname@example.org>
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:
This will ensure that the .eh_frame sections in dllcrt2.o and foo.o are
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.