From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Edelsohn To: mrs@wrs.com (Mike Stump) Cc: pooh@msu.ru, egcs@cygnus.com Subject: Re: egcs on AIX: native or gnu ld? Date: Mon, 20 Oct 1997 18:12:00 -0000 Message-id: <9710202222.AA34966@rios1.watson.ibm.com> References: <199710202137.OAA26408@kankakee.wrs.com> X-SW-Source: 1997-10/msg00891.html >>>>> Mike Stump writes: >> A symbol needs to be exported if it will be referenced by name >> outside its module. >> >> If C++ applications have the names of __eh_* symbols in other >> modules compiled in, then it would seem that exports are necessary. In >> that case, one needs to expand collect2.c:scan_prog_file() to add __eh_* >> symbols to the export list along with constructors and destructors. Mike> Given the above, I say Add them (by exact name, no .* regexs please), Mike> they need to be exported. I guess I do not understand your no regexs request. Current export are determined using is_ctor_dtor() function which looks for all symbols starting with "GLOBAL_.I." or some variant. Each ctor or dtor is exported individually by name for a particular file, and one can use multiple linking passes to ensure that only those symbols truly present in the final shared library are exported. However, the names are found essentially using a prefix regex. How else can one determine that a symbol is an exception handler other than looking for __eh_*? Also, to further clarify my comment above so that we do not unnecessarily go down this path (although there is not much harm in implementing this and exporting more symbols), only those symbols which have compiled references *by name* in another module need to be exported. If you somehow have access to a root symbol for your own private list, transfer vectors, or otherwise obtain pointers to the functions using your own scheme to grovel for the symbol names, they do not need to be exported. Export simply determines if the symbol is externally visible outside the module for the AIX linker or loader to handle the resolution. If the library is loaded for another reason and already mapped in to the user's address space, the symbols are present and are callable through pointers if the process has its own private way to determin the addresses. David