Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6386633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:03:02+00:00 2026-05-25T03:03:02+00:00

For a few days we are dealing with very strange problem. I can’t understand

  • 0

For a few days we are dealing with very strange problem.

I can’t understand how it even happens – when a third-party (MATLAB) program uses our shared library, it somehow overrides some of our symbols (boost, to be precise) with it’s own. Those symbols are statically linked and (!!) local.

Here is the deal – we use boost 1.47, MATLAB has boost 1.40. Currently, library call segfaults on a call from OUR library to their boost (regex).

So, here is the magic:

  • We have no library dependencies, ldd:
    linux-vdso.so.1 =>  (0x00007fff4abff000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00007f1a3fd65000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f1a3fa51000)
    libm.so.6 => /lib/libm.so.6 (0x00007f1a3f7cd000)
    libgomp.so.1 => /usr/lib/libgomp.so.1 (0x00007f1a3f5bf000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f1a3f3a8000)
    libc.so.6 => /lib/libc.so.6 (0x00007f1a3f024000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f1a414f9000)
    librt.so.1 => /lib/librt.so.1 (0x00007f1a3ee1c000)
  • No Cxx symbols (our public symbols are POC C for binary compatibility) are exported from our library, nm:
nm -g --defined-only libmysharedlib.so

addr1 T OurCSymbol1
addr2 T OurCSymbol2
addr3 T OurCSymbol3
...
  • Still, it uses their boost. HOW? Stacktrace (paths cut):
[  0] 0x00007f21fddbb0a9 bin/libmwfl.so+00454825 fl::sysdep::linux::unwind_stack(void const**, unsigned long, unsigned long, fl::diag::thread_context const&)+000009
[  1] 0x00007f21fdd74111 bin/glnxa64/libmwfl.so+00164113 fl::diag::stacktrace_base::capture(fl::diag::thread_context const&, unsigned long)+000161
[  2] 0x00007f21fdd7d42d bin/glnxa64/libmwfl.so+00201773
[  3] 0x00007f21fdd7d6b4 bin/glnxa64/libmwfl.so+00202420 fl::diag::terminate_log(char const*, fl::diag::thread_context const&, bool)+000100
[  4] 0x00007f21fce525a7 bin/glnxa64/libmwmcr.so+00365991
[  5] 0x00007f21fb9eb8f0 lib/libpthread.so.0+00063728
[  6] 0x00007f21f3e939a9 libboost_regex.so.1.40.0+00342441 boost::re_detail::perl_matcher, std::allocator > >, boost::regex_traits > >::match_all_states()+000073
[  7] 0x00007f21f3eb6546 bin/glnxa64/libboost_regex.so.1.40.0+00484678 boost::re_detail::perl_matcher, std::allocator > >, boost::regex_traits > >::match_imp()+000758
[  8] 0x00007f21c04ad595 lib/libmysharedlib.so+04855189 bool boost::regex_match, std::allocator > >, char, boost::regex_traits > >(__gnu_cxx::__normal_iterator, __gnu_cxx::__normal_iterator, boost::match_results, std::allocator > > >&, boost::basic_regex > > const&, boost::regex_constants::_match_flags)+000245
[  9] 0x00007f21c04a71c7 lib/libmysharedlib.so+04829639 myfunc2()+000183
[ 10] 0x00007f21c01b41e3 lib/libmysharedlib.so+01737187 myfunc1()+000307

It’s known, that MATLAB does dlopen with RTLD_NOW flag only.

People, think with me please.
Now i’m desperate not to even fix this, but to simply understand ld&elf behavior.

edit:
Small additional question: how i understood, without special linker options, symbols in linux .so libraries are never linked by address? So even statically linked local symbols are resolved in runtime?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:03:03+00:00Added an answer on May 25, 2026 at 3:03 am

    Check out the -Bsymbolic option for ld.

    If -Bsymbolic is specified, then at the time of creating a shared
    object ld will attempt to bind references to global symbols to definitions
    within the shared library. The default is to defer binding to runtime.

    This may be clearer with an example.

    Say example.o contains a reference to a global function defined in
    global.o,

    $ nm example.o | grep ' U'
         U _GLOBAL_OFFSET_TABLE_
         U globalfn
    $ nm global.o | grep ' T'
    00000000 T globalfn
    

    and two shared objects, normal.so and symbolic.so, are built as
    follows:

    $ cc -fPIC -c example.c
    $ cc -c global.c
    $ rm -f archive.a; ar cr archive.a global.o
    $ ld -shared -o normal.so example.o archive.a
    $ ld -Bsymbolic -shared -o symbolic.so example.o archive.a
    

    Disassembling the code for normal.so shows that the call to
    globalfn is actually going through the procedure linkage table, and
    thus the final destination of the call is determined at runtime.

    $ objdump --disassemble normal.so
    ...snip...
    00000194 <example>:
    ...snip...
     1a6:   e8 d9 ff ff ff          call   184 <globalfn@plt>
    ...snip...
    $ readelf -r normal.so
    
    Relocation section '.rel.plt' at offset 0x16c contains 1 entries:
    Offset     Info    Type            Sym.Value  Sym. Name
    00001244  00000207 R_386_JUMP_SLOT   000001b8   globalfn
    

    Whereas in symbolic.so, the call always invokes the definition of
    globalfn within the shared object.

    $ objdump --disassemble symbolic.so
    ...snip...
    0000016c <shared>:
    ...snip...
     17e:   e8 0d 00 00 00          call   190 <globalfn>
    ...snip...
    $ readelf -r symbolic.so
    
    There are no relocations in this file.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Past few days while observing few websites with heavy content I found very interesting
Last few days I searched all over the internet to solve this problem but
a few days we had a strange error with sqlite. We use a sqlite
Last few days I'm trying to start with farseer library, however i just can't
For few days now I'm trying to solve this problem. I have table group_user,
Few days ago, I came to a problem where I have to sum the
A few days ago I've discovered that singleton can become anti-pattern in Android. My
few days ago i asked about how to get all running processes in the
Every few days VS2008 decides to get mad at me and fails to generate
A few days ago, I asked why its not possible to store binary data,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.