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
This commit is contained in:
parent
db695db7f0
commit
a6d80351b7
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user