This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


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

Re: PATCH: Add __frame_state_for for gcc 3.0.1


On Wed, Jul 04, 2001 at 11:32:17PM -0700, H . J . Lu wrote:
> Here is a new patch. glibc has to export __register_frame_info_bases,
> __deregister_frame_info_bases and __register_frame_info_table_bases with
> version GCC_3.0 since that is what is in libgcc_s.so.1.
> 
> Now it passed "make check" in glibc built with gcc 3.0.1 and gcc 2.96.

If you export __.*register_frame_info.*_bases from GLIBC (IMHO that's a good
thing, others might disagree, see below), then you should export
_Unwind_Find_FDE too (and IA-64 needs to be worked out, it has no exported
_Unwind_Find_FDE like interface). That is so that if main binary is linked
just with libc.so.6 and it dlopens some library linked using the G++ 3.0
unwinding stuff, then __.*register_frame_info.*_bases routines from glibc
would be used, but _Unwind_Find_FDE would come from libgcc_s.so.1, so it
would see no registrations at all. The (de)register routines together with
_Unwind_Find_FDE form a selfcontained blackbox.

Now to whether GLIBC should export the (de)register and _Unwind_Find_FDE
routines at all, I'll repeat myself here; the options are IMHO:
- it should not (neither old __register_frame_info and older interfaces,
  just __frame_state_for on arches which need it) - then glibc needs
  libgcc_s.so.1 as either DT_NEEDED or DT_FILTER (the latter only in the
  current GLIBC DT_FILTER handling, would not work in Solaris DT_FILTER
  semantics)
- it should (then again, all the registration routines and _Unwind_Find_FDE
  need to be exported from the same place, where the same place can be both
  libc.so.6 and libgcc_s.so.1). libgcc_s.so.1 is either not needed by
  libc.so.6 at all, or is DT_AUXILIARY with GLIBC semantics.
I strongly favour the latter. It means small non-C++ non-Java programs will
not be slowed down by yet another shared library (thus increasing memory
footprint a lot, plus adding overhead at startup time).
It would mean the system compiler (where system compiler is the compiler
which usually vendor provided and which was used to compile GLIBC) can
default to -static-libgcc for non-C++ non-Java shared libraries, so
libgcc_s.so.1 overhead would come up only for shared libraries which really
need it (where need it is not just that they are linked with crtbeginS.o
which needs __register_frame_info_bases, since that one is provided by
glibc). How would this work for Joe random user installing a later GCC
version on his own? Well, easily. The non-system GCC would default to
-shared-libgcc as it does currently, so the possibly updated (versioned)
interfaces to (de)register routines and _Unwind_Find_FDE would come from
libgcc_s.so.1 which comes from that later version of GCC, so all should be
fine (well, __frame_state_for would not work, but who cares - mixing
pre-G++ 3.0 and G++ 3.0+ libraries in one binary does not work anyway).

As far as IA-64 is concerned, IMHO _Unwind_FindTableEntry should be exported
both from libgcc_s.so.1 and GLIBC. libgcc_s.so.1 implementation will
definitely need some kind of for_each_fde interface, GLIBC can either just
pick it up from libgcc.a and export, or come with its own, somewhat optimized
as it knows the internals, version.

I think the important part of the patch now is really the missing DW_EH_PE_*
handling stuff.
As far as gcc-2.96-RH (well, gcc <= 2.96-84 particularly) binary
compatibility is concerned, once you have final version of the patch I can
split it into standard GLIBC patch and Red Hat local GLIBC patch (well, I
think Mandrake and some others are interested in that too).

> 2001-07-04  H.J. Lu  <hjl@gnu.org>
> 
> 	* Versions.def (libc): Add GCC_3.0.
> 
> 	* sysdeps/unix/sysv/linux/Versions (libc): Add
> 	__register_frame_info_bases, __deregister_frame_info_bases and
> 	__register_frame_info_table_bases to version GCC_3.0.
> 
> 	* config.make.in (need-frame-dwarf2): New. Substitute by
> 	@libc_cv_frame_dwarf2@.
> 
> 	* configure.in (libc_cv_frame_dwarf2): Set to yes if
> 	_Unwind_Find_FDE exists in libgcc.
> 	* configure: Rebuild.
> 
> 	* sysdeps/generic/dwarf2.h: New file.
> 	* sysdeps/generic/frame-dwarf2.c: Likewise.
> 	* sysdeps/alpha/gccframe.h: Likewise.
> 	* sysdeps/arm/gccframe.h: Likewise.
> 	* sysdeps/i386/gccframe.h: Likewise.
> 	* sysdeps/m68k/gccframe.h: Likewise.
> 	* sysdeps/mips/gccframe.h: Likewise.
> 	* sysdeps/powerpc/gccframe.h: Likewise.
> 	* sysdeps/s390/s390-32/gccframe.h: Likewise.
> 	* sysdeps/sparc/gccframe.h: Likewise.
> 
> 	* sysdeps/generic/gccframe.h: Updated.
> 
> 	* sysdeps/unix/sysv/linux/alpha/Makefile (sysdep_routines): Add
> 	frame-dwarf2 for elf if $(build-shared) and $(need-frame-dwarf2)
> 	are both yes.
> 	(shared-only-routines): Likewise.
> 	* sysdeps/unix/sysv/linux/arm/Makefile: Likewise.
> 	* sysdeps/unix/sysv/linux/i386/Makefile: Likewise.
> 	* sysdeps/unix/sysv/linux/m68k/Makefile: Likewise.
> 	* sysdeps/unix/sysv/linux/mips/Makefile: Likewise.
> 	* sysdeps/unix/sysv/linux/powerpc/Makefile: Likewise.
> 	* sysdeps/unix/sysv/linux/s390/s390-32/Makefile: Likewise.
> 	* sysdeps/unix/sysv/linux/sparc/Makefile: Likewise.
> 

	Jakub


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