On 09/12/14 11:51, Hans-Peter Nilsson wrote:
Ping! <http://gcc.gnu.org/ml/gcc-patches/2014-09/msg00403.html>

From: Hans-Peter Nilsson <h...@axis.com>
Date: Thu, 4 Sep 2014 23:42:28 +0200

This adds an option to allow programs and libraries built
*without* inhibit_libc to stay compatible with system libraries
(really: libgcc_s.so.1) built *with* inhibit_libc, at the cost
of the registration.  As mentioned, that's a one-way
compatibility barrier.

While it's nice to avoid the overhead of a function call at
DSO/program initialization time, using eh-registry isn't that
much of overhead until an exception is thrown: most of the
execution-time overhead will come from the additional
symbol-table-entries due to the registry calls (typically 2 in
all libraries and programs, as weak references) and calls to
thread-locking as the (main) part of its work-load.  Besides the
symbol-table-entries the footprint size is typically the code for
   if (__register_frame_info)
     __register_frame_info (__EH_FRAME_BEGIN__, &object);
and the corresponding deregistration and the static object
struct (6 or 7 pointers).  (As mentioned, the library-part of
the eh-registry support is present either way.)  So, a low-cost
compatibility path is to always call __register_frame_info,
despite favorable conditions for phdr usage.  Here's a patch to
optionally do that, controlled by a configure-time option
tentatively called --enable-explicit-exception-frame-registration
(subject to bikeshedding if only for the length).  Note
that there is a cost when an exception *is* thrown, the dreaded
sorting of FDE:s.  There seems to be some obvious room for
improvement though, as the same information is available
*without* sorting through the PT_GNU_EH_FRAME header entry for
the same file.

Tested with no regressions after fixing g++.old-deja/g++.eh/badalloc1.C
(see <http://gcc.gnu.org/ml/gcc-patches/2014-09/msg00115.html>) for
native x86_64-linux before compared to with patch/with patch and
--enable-explicit-exception-frame-registration/.

Ok to commit?

libgcc:
        * crtstuff.c [EH_FRAME_SECTION_NAME && !USE_PT_GNU_EH_FRAME]:
        Sanity-check USE_EH_FRAME_REGISTRY_ALWAYS against
        EH_FRAME_SECTION_NAME, emit error if unsane.
        (USE_EH_FRAME_REGISTRY): Let USE_EH_FRAME_REGISTRY_ALWAYS
        override USE_PT_GNU_EH_FRAME.
        * Makefile.in (FORCE_EXPLICIT_EH_REGISTRY): New
        variable for substituted force_explicit_eh_registry.
        (CRTSTUFF_CFLAGS): Add FORCE_EXPLICIT_EH_REGISTRY.
        * configure.ac (explicit-exception-frame-registration):
        New AC_ARG_ENABLE.
        * configure: Regenerate.
OK.
jeff

Reply via email to