PATCH: Re: Partial symbol export vs --export-dynamic

Jean-Francois Panisset panisset@discreet.com
Sun Jun 17 21:08:00 GMT 2001


 < 20010617180729.A24660@lucon.org >"H . J . Lu" writes
>On Sun, Jun 17, 2001 at 03:48:02AM -0400, Jean-Francois Panisset wrote:
>> >
>> >If you know something about bfd, it shouldn't be too hard to implement.
>> >Personally, I think it is a useful feature. I may do it myself if we all
>> >agree it is a good feature to have and how it should work.
>> >
>> >
>> >H.J.
>> 
>
>It turned out it was quite easy to do. Here is a patch. I just expanded
>the symbol versioning to executables. You can use
>
># gcc -Wl,-export-dynamic,--version-script,version.map ...
>
>You can use the version-script to control what you want to export. It
>supports regular expression, C++ symbol, Java, ... among other things.
>
>
>H.J.
>----
>2001-06-17  H.J. Lu  <hjl@gnu.org>
>
>	* elflink.h (elf_info_failed): Add a new field, verdefs.
>	(NAME(bfd_elf,size_dynamic_sections): Pass verdefs to
>	elf_export_symbol.
>	(elf_export_symbol): Check eif->verdefs to decide if a symbol
>	should be exported.

Well, it seems the patch works fine. I have created the following
version script:

VERS_1.0 {
global:
api_func_1;
api_func_2;
...
local:
*;
};

and that seems to do the trick: only the API symbols are visible
to plugins, my binary size doesn't grow by 5MB, and my symbol conflict
seems to be gone.

Thanks you very much!
JF



More information about the Binutils mailing list