public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Oleg Smolsky <osmolsky@netskope.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: [EXTERNAL] Re: Linking issue when mixing GCC10/GCC11 artifacts
Date: Tue, 29 Jun 2021 17:50:24 +0100	[thread overview]
Message-ID: <CAH6eHdR2r9nJbJo=EinaBiZ1KyYzEUZm5R=a9Efr=sjK7qVz8w@mail.gmail.com> (raw)
In-Reply-To: <CAH6eHdRZ3Kj-fyPnGEjWhALSqNz44wCAxnm4AHeuhGpjycuEQg@mail.gmail.com>

On Tue, 29 Jun 2021 at 17:40, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
>
>
> On Tue, 29 Jun 2021, 17:24 Oleg Smolsky, <osmolsky@netskope.com> wrote:
>>
>>
>>
>> On Tue, Jun 29, 2021 at 8:42 AM Oleg Smolsky <osmolsky@netskope.com> wrote:
>>>
>>>
>>>
>>> On Tue, Jun 29, 2021 at 8:39 AM Oleg Smolsky <osmolsky@netskope.com> wrote:
>>>>
>>>> I am using `g++` to link in both working and failing cases.
>>>
>>>
>>> The peculiar thing is that the linking issue goes away when I change the reproducer slightly: avoid linking the gcc10-built lib or avoid using std::unordered_map. Either thing is OK by itself...
>>
>>
>> I've just tried to create a stand-alone test case (with the .so compiled separately with a different compiler) but cannot reproduce the issue.
>>
>> However, I have the following clues from the shared libs:
>>
>> The GCC10-built lib:
>>
>> $ objdump -T /opt/3p/lib/libzmq.so | c++filt | grep __throw_
>> 0000000000000000      DF *UND*  0000000000000000  GLIBCXX_3.4 std::__throw_bad_alloc()
>> 0000000000000000      DF *UND*  0000000000000000  GLIBCXX_3.4 std::__throw_length_error(char const*)
>> 0000000000000000      DF *UND*  0000000000000000  GLIBCXX_3.4 std::__throw_logic_error(char const*)
>> 0000000000000000      DF *UND*  0000000000000000  GLIBCXX_3.4.20 std::__throw_out_of_range_fmt(char const*, ...)
>>
>> The GCC11-built lib:
>>
>> $ objdump -T /opt/3p/lib/libzmq.so-gcc11 | c++filt | grep __throw_
>> 0000000000000000      DF *UND*  0000000000000000  GLIBCXX_3.4 std::__throw_bad_alloc()
>> 0000000000000000      DF *UND*  0000000000000000  GLIBCXX_3.4 std::__throw_length_error(char const*)
>> 0000000000000000      DF *UND*  0000000000000000  GLIBCXX_3.4 std::__throw_logic_error(char const*)
>> 0000000000000000      DF *UND*  0000000000000000  GLIBCXX_3.4.29 std::__throw_bad_array_new_length()
>> 0000000000000000      DF *UND*  0000000000000000  GLIBCXX_3.4.20 std::__throw_out_of_range_fmt(char const*, ...)
>>
>> Here we can see that  `std::__throw_bad_array_new_length()` is only present in the new build.
>
>
> And that symbol is defined in libstdc++.so.6.0.29 so if you link with the g++ from GCC 11 then it should work. Which tells me that either you're not linking with g++ (which you already confirmed), or you're using the g++ from GCC 10, or you have a -L option that causes an older libstdc++.so to be found before the correct one.
>
> You should be able to easily verify that for yourself. Run objdump on the libstdc++.so from GCC 11 and confirm it contains the "missing" symbol.
>
> Add -v to your link command, to check which GCC executables are being run, and what linker paths they use.
>
> Add -Wl,--trace to your linker command to see the names of files as the linker processes them, to see which libstdc++.so or libstdc++.a is being found.
>
> Add -Wl,--trace-symbol=_ZSt28__throw_bad_array_new_lengthv to see all the input files that contain the missing symbol.

And if all that shows that you really are using the g++ from GCC 11
and it's finding the libstdc++.so from GCC 11, but still doesn't find
that symbol, then something weird is happening (because that symbol
should be present, and is for everybody else, because otherwise they'd
get testsuite failures complaining about it).

  reply	other threads:[~2021-06-29 16:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29  4:55 Oleg Smolsky
2021-06-29  5:32 ` Jonathan Wakely
2021-06-29 15:39   ` [EXTERNAL] " Oleg Smolsky
2021-06-29 15:42     ` Oleg Smolsky
2021-06-29 16:24       ` Oleg Smolsky
2021-06-29 16:40         ` Jonathan Wakely
2021-06-29 16:50           ` Jonathan Wakely [this message]
2021-06-29 16:57           ` Oleg Smolsky
2021-06-29 17:22             ` Jonathan Wakely
2021-06-29 23:04               ` Oleg Smolsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH6eHdR2r9nJbJo=EinaBiZ1KyYzEUZm5R=a9Efr=sjK7qVz8w@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=osmolsky@netskope.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).