objcopy -x removes static __attribute__((destructor)) function
Emmanuel Dreyfus <[email protected]>
| Newsgroups | gmane.os.netbsd.devel.toolchain |
|---|---|
| Message-ID | <[email protected]> |
Hello When building libgomp in src/external/gpl3/gcc/dist/libgomp we run objcopy -x on all .o files to produce .po and .pico that will be linked into libgomp.so objcopy -x removes static functions. But thank to some useful magic, static functions blessed with __attribute__((constructor)) remain in the .so, missing from the symbol table, but still being called by dynamic linker's _rtld_call_initfini_function() at load time. However, it seems static functions that have __attribute__((destructor)) do not enjoy the same fate. Like the constructor function, I do not it them in the symbol table, but unlike the constructor, the destructor is not called at unload time. Removing the static keyword fixes that and it gets called. Is that a bug in binutils? Anyone has an idea of where should I look for it? -- Emmanuel Dreyfus [email protected]