From d40943f1a463be64380e0cd248731d4b4930366e Mon Sep 17 00:00:00 2001 From: obrien Date: Fri, 17 Aug 2001 22:54:26 +0000 Subject: Re-initialize gp after a jsr. When rtld runs the .fini section in a shared lib (C++), the code in question from .../contrib/gdb/config/alpha/crtbegin.asm first calls __do_globals_dtors_aux and then __do_frame_takedown. Unfortunately, the value of gp after a jsr is undefined and in this case had changed from before the call, probably as a result of calling code in some other shared library. The normal calling convention for alpha is to re-initialize gp using 'ldgp gp,0(ra)' after a jsr instruction but in this case no such re-initialization is done. This leads to a bogus value being read for the address of __do_frame_takedown and a quick segfault. Submitted by: dfr Obtained from: GCC 3.0 --- contrib/gcc/config/alpha/crtbegin.asm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'contrib/gcc/config') diff --git a/contrib/gcc/config/alpha/crtbegin.asm b/contrib/gcc/config/alpha/crtbegin.asm index f954f1a..7b11b88 100644 --- a/contrib/gcc/config/alpha/crtbegin.asm +++ b/contrib/gcc/config/alpha/crtbegin.asm @@ -68,6 +68,7 @@ __EH_FRAME_BEGIN__: br $29,1f 1: ldgp $29,0($29) jsr $26,__do_global_dtors_aux + ldgp $29,0($26) # Ideally this call would go in crtend.o, except that we can't # get hold of __EH_FRAME_BEGIN__ there. @@ -190,3 +191,6 @@ __do_frame_takedown: .weak __register_frame_info .weak __deregister_frame_info + +.section .rodata + .ascii "$FreeBSD$\0" -- cgit v1.1