This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[patch] split VxWorks tls routines out of vxlib.c


Hello,

While working on the support of dwarf2 exceptions on ppc-vxworks for 5.x,
we encountered unresolved references from calls issued by code in vxlib.c.

The referenced routines are expected to be provided by the VxWorks kernel, but
are not there in VxWorks 5.x, so a contrib/ source is offered to fill the gap
(gthr_supp_vxw_5x.c). Users are expected to rebuild a kernel with this
included as an extra module.

Experiments with the GCC 3.4 series showed that the routine were actually only
needed for sjlj exceptions, so the burden of asking users to rebuild a kernel
could be avoided with dwarf2 exceptions.

Attached is a patch suggestion to this effect. It's conceptually simple, and I
think makes sense independently of a particular purpose or version of GCC:

The idea is to split the vxlib routines requiring the extra kernel entry
points out into an independant source file, to produce an independant object
which will only get dragged in (so the kernel depencencies) when really
needed, instead of as soon any (other) vxlib function is referenced.

More precisely, vxlib currently exposes 

  __gthread_once
  __gthread_key_create
  __gthread_key_delete
  __gthread_setspecific
  __gthread_getspecific

and the extra kernel routines are only needed for the tls related services
(the last four).

The patch simply extracts these from vxlib.c into vxlib-tls.c, with an
explanatory comment, and adds the -tls.c to the LIB2FUNC_EXTRA list.

Tested by rebuilding a mainline powerpc-wrs-vxworks cross hosted on x86-linux,
then checking that libgcc.a contains the two objects and the expected symbols
and that the resulting compiler is still basically functional.

I unfortunately couldn't double check the C++ exceptions behavior because
libstdc++-v3 is excluded for the list of supported subdirs for vxworks
targets.

We have been experimenting this without troubles for Ada in our 3.4 based tree
for a while.

Thanks in advance,

Olivier


2006-10-08  Olivier Hainque  <hainque@adacore.com>

	* config/vxlib.c: Extract tls related routines into ...
	* config/vxlib-tls.c: New file. 
	* config/t-vxworks: Add vxlib-tls.c to LIB2FUNCS_EXTRA.










Attachment: vx-tls.dif
Description: Text document


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