This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: __register_frame_info & shared library compatibility


In article <15609.923487695@upchuck>, Jeffrey A Law  <law@cygnus.com> wrote:

>   > The problem is indeed that egcs 1.1.2 now puts only a weak
>   > reference to "__register_frame_info" in crtstuff.  This means
>   > that "du moment" one recompiles a shared library that previously
>   > contained "__register_frame_info" it probably does not anymore,
>   > and programs linked with that library stop running.
> Yup.  And I consider this a horrible breakage.  I trusted a couple
> of folks with more experience in this area to guide the decision to
> include that patch.  They made a mistake.  We need to rectify it.

I don't understand why recompiling a shared library with the
weak-referencing version of egcs would cause programs linked with it
to stop working.  The library either uses exceptions, or it doesn't.
If it uses exceptions, it contains calls to __throw and/or other
functions which will cause _eh.o to be pulled in from libgcc.a. _eh.o
contains a strong reference to __frame_state_for. __frame_state_for
is defined in frame.o, so that will also be pulled in from libgcc.a.
Presto, the library has __register_frame_info just the same as always.

If the library doesn't use exceptions, then it won't pull in frame.o
and it won't have __register_frame_info.  That won't matter for the
library itself, because of the weak references in crtbeginS.o.  Now,
the executable and any other shared libraries that use exceptions
(if any) will each contain __register_frame_info, and the weak
references to __register_frame_info from the shared library in
question will presumably be resolved by the dynamic linker to the
first of those copies.  So the library will be calling a copy of
__register_frame_info that resides in the executable or in a different
shared library.  Is that a problem?  I.e., does each shared library
need to have its own copy of __register_frame_info and the associated
static variables?

My usual context is FreeBSD rather than Linux, so maybe I'm missing
something fundamental here.  If so, please enlighten me, as we are
working on switching to egcs-1.1.2 in the FreeBSD project as we speak.

John
-- 
  John Polstra                                               jdp@polstra.com
  John D. Polstra & Co., Inc.                        Seattle, Washington USA
  "Self-interest is the aphrodisiac of belief."           -- James V. DeLong


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