https://sourceware.org/bugzilla/show_bug.cgi?id=17449
Bug ID: 17449 Summary: Exporting dynamic symbols from the main program is too difficult Product: binutils Version: 2.24 Status: NEW Severity: normal Priority: P2 Component: gold Assignee: ccoutant at google dot com Reporter: martinrb at google dot com CC: ian at airs dot com (This bug also affects gcc the compiler itself; is there a better category?) If I have some symbols defined by the main executable that I wish to be accessed by dlopen'ed libraries (via dlopen(NULL) and dlsym), it seems too difficult to discover and maintain the required steps. In the past we have done all of these: - Annotate the symbols via __attribute__((visibility("default"))) - Ensure the symbols are referenced by main() to prevent -ffunction-sections together with -Wl,--gc-sections from removing them - List the symbols in the global section of a version script with an anonymous version - Add -Wl,--export-dynamic to the link. What I really want is a single annotation I can place in the source file that will ensure all of the above. The microsoftish __dclspec(dllexport) seems to have a name with the right connotations, but I haven't tried using it. We can make incremental progress, e.g. by having the presence of a version script imply --export-dynamic, or having the presence of default visibility prevent gc-sections from collecting the symbols. If compatibility is too hard to overcome, at least document these steps somewhere in the ld or gcc docs. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils