Hi,I've been investigating a problem with exceptions thrown from boost libraries. When exception is thrown OSv aborts with the message as in the title.It turns out that these symbols are defined in libgcc_eh.a which we link into loader.elf. The problem is that the family of _Unwind_* symbols is declared with hidden visibility (binding global, visibility hidden). This causes that upon linking an executable object (loader.elf) they change binding to local and cannot be looked up dynamically anymore by current elf.cc code.
More on the visibility feature: http://gcc.gnu.org/wiki/VisibilityI created a quick dirty solution and modified libgcc_eh.a so that hidden symbols have default visibility. I needed to use manually tweaked objcopy as it did not have support for visibility manipulation out of the box. The problem goes away then, though I am not sure this is the path we want to follow.I wanted to discuss the approach we should take to solve this.--Tomek
--
You received this message because you are subscribed to the Google Groups "OSv Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
On Tue, Oct 22, 2013 at 10:31 PM, Tomasz Grabiec <tgra...@cloudius-systems.com> wrote:
Hi,I've been investigating a problem with exceptions thrown from boost libraries. When exception is thrown OSv aborts with the message as in the title.It turns out that these symbols are defined in libgcc_eh.a which we link into loader.elf. The problem is that the family of _Unwind_* symbols is declared with hidden visibility (binding global, visibility hidden). This causes that upon linking an executable object (loader.elf) they change binding to local and cannot be looked up dynamically anymore by current elf.cc code.If that is the case, how come the exception in tst-excecpt.so does work? This is also a shared library that throws an exception, so what is different there? Can you expand tst-except.so to demonstrate a case of exception-throwing that doesn't work correctly today (without boost)?
There's another ugly point to consider - we also link loader.elf with libunwind.a, and it appears it also has its own version of _Unwind_Resume and other functions. I don't remember why we actually do this... But I'm assuming the linker doesn't actually pick up this function from libunwind.a, as it is already available from libgcc_eh.a.
On Tue, Oct 22, 2013 at 10:31 PM, Tomasz Grabiec <tgra...@cloudius-systems.com> wrote:
Hi,
I've been investigating a problem with exceptions thrown from boost libraries. When exception is thrown OSv aborts with the message as in the title.
It turns out that these symbols are defined in libgcc_eh.a which we link into loader.elf. The problem is that the family of _Unwind_* symbols is declared with hidden visibility (binding global, visibility hidden). This causes that upon linking an executable object (loader.elf) they change binding to local and cannot be looked up dynamically anymore by current elf.cc code.
If that is the case, how come the exception in tst-excecpt.so does work? This is also a shared library that throws an exception, so what is different there? Can you expand tst-except.so to demonstrate a case of exception-throwing that doesn't work correctly today (without boost)?
There's another ugly point to consider - we also link loader.elf with libunwind.a, and it appears it also has its own version of _Unwind_Resume and other functions. I don't remember why we actually do this... But I'm assuming the linker doesn't actually pick up this function from libunwind.a, as it is already available from libgcc_eh.a.
I managed to create a test case for this:
libunwind.a was added at a very early point, it's possible that subsequent changes made it unnecessary.
Ordinary binaries don't link with it, I don't see why we should.