[PATCH] HPPA/IA64 : Don't use broken DL_AUTO_FUNCTION_ADDRESS()

Andreas Schwab schwab@suse.de
Thu Nov 7 08:27:00 GMT 2013


Guy Martin <gmsoft@tuxicoman.be> writes:

> diff --git a/elf/dl-close.c b/elf/dl-close.c
> index fe3014c..78c6dcc 100644
> --- a/elf/dl-close.c
> +++ b/elf/dl-close.c
> @@ -274,9 +274,8 @@ _dl_close_worker (struct link_map *map)
>  
>  	      /* Next try the old-style destructor.  */
>  	      if (imap->l_info[DT_FINI] != NULL)
> -		(*(void (*) (void)) DL_DT_FINI_ADDRESS
> -		 (imap, ((void *) imap->l_addr
> -			 + imap->l_info[DT_FINI]->d_un.d_ptr))) ();
> +		DL_DT_CALL_FINI (imap, ((void *) imap->l_addr
> +			 + imap->l_info[DT_FINI]->d_un.d_ptr));

DL_CALL_DT_FINI whould be a more logical name.

> diff --git a/ports/sysdeps/ia64/dl-lookupcfg.h b/ports/sysdeps/ia64/dl-lookupcfg.h
> index 4da1263..323623d 100644
> --- a/ports/sysdeps/ia64/dl-lookupcfg.h
> +++ b/ports/sysdeps/ia64/dl-lookupcfg.h
> @@ -39,24 +39,29 @@ extern void _dl_unmap (struct link_map *map);
>  
>  #define DL_UNMAP(map) _dl_unmap (map)
>  
> -#define DL_AUTO_FUNCTION_ADDRESS(map, addr)		\
> -({							\
> -  unsigned long int fptr[2];				\
> -  fptr[0] = (unsigned long int) (addr);			\
> -  fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;	\
> -  (Elf64_Addr) fptr;					\
> -})
> -
> -#define DL_STATIC_FUNCTION_ADDRESS(map, addr)		\
> -({							\
> -  static unsigned long int fptr[2];			\
> -  fptr[0] = (unsigned long int) (addr);			\
> -  fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;	\
> -  (Elf64_Addr) fptr;					\
> -})
> -
> -#define DL_DT_INIT_ADDRESS(map, addr) DL_AUTO_FUNCTION_ADDRESS (map, addr)
> -#define DL_DT_FINI_ADDRESS(map, addr) DL_AUTO_FUNCTION_ADDRESS (map, addr)
> +#define DL_DT_FUNCTION_ADDRESS(map, start, attr, addr)			\
> +  attr volatile unsigned int fptr[2];					\
> +  fptr[0] = (unsigned int) (start);					\
> +  fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;			\
> +  /* Set bit 30 to indicate to $$dyncall that this is a PLABEL. */	\
> +  addr = (ElfW(Addr))((unsigned int)fptr | 2);				\

That can't be correct.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



More information about the Libc-alpha mailing list