[PATCH v2] elf: Add _dl_find_object function

Florian Weimer fweimer@redhat.com
Fri Nov 26 16:17:19 GMT 2021


* Jakub Jelinek:

> On Thu, Nov 25, 2021 at 09:35:14PM +0100, Florian Weimer wrote:
>> +struct dl_find_object
>> +{
>> +  unsigned long long int dlfo_flags;	/* Currently 0. */
>> +  void *dlfo_map_start;		/* Beginning of mapping containing address.  */
>> +  void *dlfo_map_end;		/* End of mapping.  */
>> +  struct link_map *dlfo_link_map;
>> +  void *dlfo_eh_frame;		/* Exception handling data of the object.  */
>> +# if DLFO_STRUCT_HAS_EH_DBASE
>> +  void *dlfo_eh_dbase;		/* Base address for DW_EH_PE_datarel.  */
>> +# endif
>> +# if DLFO_STRUCT_HAS_EH_COUNT
>> +  int dlfo_eh_count;		/* Number of exception handling entries.  */
>> +# endif
>> +};
>
> I must say I still don't really like these conditionally included
> fields, if in the future one needs some of them on some other architecture,
> we'd need to add another API or symbol version it etc.

That suggests to me that I should add a few __dwlfo_unused members.  And
if the fields are actually used, a future version would set a flag (in
case a zero value for the field has meaning).  We don't even have to
initialize these members today.

(Although I do not see much need for members like dbase: we are copying
a value that the link editor has computed.  It could have easily written
that to the EH segment, too.)

Thanks,
Florian



More information about the Gcc-patches mailing list