[RFC 1/5] elf: Add SFrame support to _dl_find_object function

Florian Weimer fweimer@redhat.com
Thu Mar 20 08:03:33 GMT 2025


* claudiu zissulescu-ianculescu:

> diff --git a/bits/dl_find_object.h b/bits/dl_find_object.h
> index b9f796dc2b..162ef00615 100644
> --- a/bits/dl_find_object.h
> +++ b/bits/dl_find_object.h
> @@ -30,3 +30,9 @@
>  
>  /* The ELF segment which contains the exception handling data.  */
>  #define DLFO_EH_SEGMENT_TYPE PT_GNU_EH_FRAME
> +
> +/* The ELF segment which contains the SFrame data.  */
> +#define DLFO_SFRAME_SEGMENT_TYPE PT_GNU_SFRAME
> +
> +/* This implementation does not have SFrame data.  */
> +#define DLFO_STRUCT_HAS_SFRAME 0

Is there any technical reason why an architecture would not add SFrame
data?

I think we shoul define this unconditionally …

> diff --git a/dlfcn/dlfcn.h b/dlfcn/dlfcn.h
> index 5747962611..dd4113a757 100644
> --- a/dlfcn/dlfcn.h
> +++ b/dlfcn/dlfcn.h
> @@ -216,6 +216,9 @@ struct dl_find_object
>  # if DLFO_STRUCT_HAS_EH_COUNT
>    int dlfo_eh_count;		/* Number of exception handling entries.  */
>    unsigned int __dlfo_eh_count_pad;
> +# endif
> +# if DLFO_STRUCT_HAS_SFRAME
> +  void *dlfo_sframe;		/* SFrame stack trace data of the object.  */
>  # endif
>    __extension__ unsigned long long int __dflo_reserved[7];
>  };

… and always define this field.

> diff --git a/elf/dl-find_object.h b/elf/dl-find_object.h
> index 0915065be0..e43c3212c2 100644
> --- a/elf/dl-find_object.h
> +++ b/elf/dl-find_object.h
> @@ -43,6 +43,9 @@ struct dl_find_object_internal
>  #if DLFO_STRUCT_HAS_EH_COUNT
>    int eh_count;
>  #endif
> +#if DLFO_STRUCT_HAS_SFRAME
> +  void *sframe;
> +#endif
>  };

And here.

You need to add a flag to dlfo_flags that indicates that the dlfo_sframe
field is valid.

Thanks,
Florian



More information about the Libc-alpha mailing list