From daf75146de07303ea0c5ad700ec5ef703ec114a1 Mon Sep 17 00:00:00 2001 From: Guy Martin Date: Thu, 21 Nov 2013 13:23:16 -0500 Subject: Don't use broken DL_AUTO_FUNCTION_ADDRESS() On hppa and ia64, the macro DL_AUTO_FUNCTION_ADDRESS() uses the variable fptr[2] in it's own scope. The content of fptr[] is thus undefined right after the macro exits. Newer gcc's (>= 4.7) reuse the stack space of this variable triggering a segmentation fault in dl-init.c:69. To fix this we rewrite the macros to make the call directly to init and fini without needing to pass back a constructed function pointer. --- sysdeps/generic/ldsodefs.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sysdeps/generic') diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index e7b0516aaf..146aca4dfb 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -76,8 +76,9 @@ typedef struct link_map *lookup_t; # define DL_SYMBOL_ADDRESS(map, ref) \ (void *) (LOOKUP_VALUE_ADDRESS (map) + ref->st_value) # define DL_LOOKUP_ADDRESS(addr) ((ElfW(Addr)) (addr)) -# define DL_DT_INIT_ADDRESS(map, start) (start) -# define DL_DT_FINI_ADDRESS(map, start) (start) +# define DL_CALL_DT_INIT(map, start, argc, argv, env) \ + ((init_t) (start)) (argc, argv, env) +# define DL_CALL_DT_FINI(map, start) ((fini_t) (start)) () #endif /* On some architectures dladdr can't use st_size of all symbols this way. */ -- cgit 1.4.1