[RFC 1/5] elf: Add SFrame support to _dl_find_object function
Claudiu Zissulescu-Ianculescu
claudiu.zissulescu-ianculescu@oracle.com
Tue Mar 25 10:53:35 GMT 2025
Hi Florian,
On 3/20/25 10:03 AM, Florian Weimer wrote:
> * 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?
Not really, unless the maintainers of an architecture don't want to deal
with SFrame.
>
> 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.
>
Thank you for the input. I'll address all of them in my second round,
Claudiu
More information about the Libc-alpha
mailing list