This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Gold linker] Incremental linking in C++


On Mon, Nov 21, 2016 at 12:10 PM, Cary Coutant <ccoutant@gmail.com> wrote:

>> ...that incremental linking disables eh_frame_hdr generation.
>> Naturally, the inability to catch any thrown exception makes using
>> this functionality for C++ development virtually impossible.
>
> The .eh_frame_hdr section is (supposed to be) an optional section that
> helps the EH mechanism search more efficiently. Without it, EH should
> still work, but the lookup in the EH table is slower.

Sorry, it wasn't clear to me that this was understood to be a
performance optimization only.  It actually does not seem to work at
all, at least for me and the other poster.

For example, this program:

int main()
{
  try
  {
    throw 0;
  }
  catch (...)
  {
  }

  return 0;
}

...crashes when compiled thusly:

g++ -fuse-ld=gold -z norelro -Wl,--incremental -o exc1 exc1.cpp
./exc1
terminate called after throwing an instance of 'int'
Aborted (core dumped)

This is the real problem I am trying to report, in that it seems if
you use incremental linking, you cannot catch a thrown exception at
all.  It's not that exception handling is slower.

Thanks for any help or insight you can provide.

-Jim


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]