summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/config
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2001-08-17 22:54:26 +0000
committerobrien <obrien@FreeBSD.org>2001-08-17 22:54:26 +0000
commitd40943f1a463be64380e0cd248731d4b4930366e (patch)
tree3d32ec298ff10961525f1e74850ecf83c865a3f0 /contrib/gcc/config
parentf1dd0e9302326c7f7b4f08da7eeeb6c0355e3a76 (diff)
downloadFreeBSD-src-d40943f1a463be64380e0cd248731d4b4930366e.zip
FreeBSD-src-d40943f1a463be64380e0cd248731d4b4930366e.tar.gz
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
Diffstat (limited to 'contrib/gcc/config')
-rw-r--r--contrib/gcc/config/alpha/crtbegin.asm4
1 files changed, 4 insertions, 0 deletions
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"
OpenPOWER on IntegriCloud