[PROPOSED PATCH] Transition AltiVec support for setjmp/longjmp

Daniel Jacobowitz dmj+@andrew.cmu.edu
Fri Mar 2 21:04:00 GMT 2001


Well, I got this to work.  There's some bits of it I'm not terribly happy
with, and I'm open to suggestions or corrections.

Some comments on the patch:

linuxthreads/ChangeLog:

2001-03-02  Daniel Jacobowitz  <djacobowitz@mvista.com>
	* ptlongjmp.c: Move from here ...
	* sysdeps/pthread/ptlongjmp.c: ... to here.

Necessary to override it with a copy in a sysdep directory.


	* sysdeps/unix/sysv/linux/powerpc/altivec/Makefile: New file.
	* sysdeps/unix/sysv/linux/powerpc/altivec/Versions: New file.
	* sysdeps/unix/sysv/linux/powerpc/altivec/old-ptlongjmp.c: New file.
	* sysdeps/unix/sysv/linux/powerpc/altivec/ptlongjmp.c: New file.

sysdeps/powerpc/altivec would actually be more correct, but if I put it
there then there's not really anywhere I can put the original ptlongjmp.c so
that it will get overridden, is there?

The patch doesn't really handle a potential Hurd/PowerPC port anyway; I
would have to have two copies of _longjmp_unwind.  I didn't bother because
it is presently a stub.

ChangeLog:
2001-03-02  Daniel Jacobowitz  <djacobowitz@mvista.com>
	* Versions.def: Add GLIBC_ALTIVEC_2.2 to libc and libpthread.

This is the magic version.  It will be used as default for all functions
which expose a jmp_buf if --with-altivec=default is given; otherwise it will
be provided for compatibility if --with-altivec.

	* config.h.in: Add ALTIVEC_SUPPORT and ALTIVEC_SUPPORT_DEFAULT.
	* config.make.in: Add $(with-altivec).
	* configure.in: Add --with-altivec.  Include altivec sysdep dirs.

Perhaps a little over-zealous trying to tack /altivec onto things, but
uninteresting otherwise.

	* scripts/version.awk: Add support for "local:" and "global:" in
	Versions fragments.

This is a hack, I think.  The problem is that __sigsetjmp() becomes
versioned; the dynamic linker references this function.  Then the clever
linker tries to export it and discovers that ld.so does not have a
GLIBC_ALTIVEC_2.2 version in its map, and chokes.  Thus I use this in
sysdeps/powerpc/Versions:

+ld {
+  GLIBC_ALTIVEC_2.2 {
+   local:
+    __sigsetjmp;
+  }
+}

Is this the right approach?

	* sysdeps/powerpc/Makefile: Do not force -mppc if $(with-altivec).

Necessary, because -mppc conflicts with -m7400 and prevents altivec from
being recognized.  You'd need a binutils/gcc which defaulted to -m7400 or
else you'd need to manually specify -m7400 -Wa,-m7400 to compile this as it
stands; I could add -m7400 conditionally here, I suppose, but I'm not sure
that will always be the right processor option.  Especially not if we're
building a libc intended to run on more than just the 74xx.

	* sysdeps/powerpc/sysdep.h: Define vector registers and VRSAVE.

Nothing startling about this.

 	* sysdeps/powerpc/altivec/Makefile: New file.
	* sysdeps/powerpc/altivec/Versions: New file.
	* sysdeps/powerpc/altivec/__longjmp.S: New file.
	* sysdeps/powerpc/altivec/_vec__longjmp.S: New file.
	* sysdeps/powerpc/altivec/bits/novec_setjmp.h: New file.
	* sysdeps/powerpc/altivec/bits/vec_setjmp.h: New file.
	* sysdeps/powerpc/altivec/bsd-_setjmp.S: New file.
	* sysdeps/powerpc/altivec/bsd-setjmp.S: New file.
	* sysdeps/powerpc/altivec/longjmp.c: New file.
	* sysdeps/powerpc/altivec/novec_setjmp.h: New file.
	* sysdeps/powerpc/altivec/old-bsd-_setjmp.S: New file.
	* sysdeps/powerpc/altivec/old-bsd-setjmp.S: New file.
	* sysdeps/powerpc/altivec/old-longjmp.c: New file.
	* sysdeps/powerpc/altivec/old-setjmp.S: New file.
	* sysdeps/powerpc/altivec/old-sigjmp.c: New file.
	* sysdeps/powerpc/altivec/setjmp.S: New file.
	* sysdeps/powerpc/altivec/sigjmp.c: New file.
	* sysdeps/powerpc/altivec/vec_setjmp.h: New file.

A little more code duplication than I really like, but it works.

	* sysdeps/powerpc/altivec-default/bits/setjmp.h: New file.

This was the easiest way to make sure the correct <bits/setjmp.h> got
installed.

-- 
Daniel Jacobowitz                           Debian GNU/Linux Developer
Monta Vista Software                              Debian Security Team


More information about the Libc-alpha mailing list