On 7/11/22 11:55, Richard Biener wrote: > On Mon, Jul 11, 2022 at 11:16 AM Alexander Monakov wrote: >> >> On Mon, 11 Jul 2022, Rui Ueyama wrote: >> >>>> but ignoring min_api_supported is wrong, and assuming max_api_supported > 0 >>>> is also wrong. It really should check how given [min; max] range intersects >>>> with its own range of supported versions. >>> >>> Currently only one version is defined which is LAPI_V1. I don't think >>> LAPI_UNSPECIFIED is a version number; rather, it's an unspecified >>> value. No ordering should be defined between a defined value and an >>> unspecified value. If LAPI_UNSPECIFIED < LAPI_V1, it should be renamed >>> LAPI_V0. >> >> You still cannot rely on API guarantees of LAPI_V1 when the plugin does not >> advertise it (thread safety of claim_file in this particular case). > Hi. All right, I think we should rename LAPI_UNSPECIFIED to LAPI_V0 in order to support minimal_api_supported == LAPI_V0. > So with LAPI_UNSPECIFIED all the plugin gets is the linker name and version. > Clarifying the documentation on LAPI_UNSPECIFIED might be nice, also > what the expectation is on the linker when the plugin returns > LAPI_UNSPECIFIED when it speficied minimal_api_supported == V1. I've clarified that linker should return a value that is in range [minimal_api_supported, maximal_api_supported] and added an abort if it's not the case. Having that, mold should respect if maximal_api_supported == LAPI_V0 is returned by a plug-in (happens now as we miss locking for some targets). Martin > "minimal_api_supported == LAPI_UNSPECIFIED" does not make much > sense if using Ruis reading of this value? > >> And you still should check the intersection of supported API ranges >> and give a sane diagnostic when min_api_supported advertised by the plugin >> exceeds LAPI_V1 (though, granted, the plugin could error out as well in this >> case). >> >> Alexander