On 7/12/22 08:28, Richard Biener wrote: > On Mon, Jul 11, 2022 at 6:35 PM Alexander Monakov wrote: >> >> On Mon, 11 Jul 2022, Martin Liška wrote: >> >>> 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. >> >> I noticed that we are placing a trap for C++ consumers such as mold >> by passing min/max_api_supported as enum values. Unlike C, C++ disallows >> out-of-range enum values, so when mold does >> >> enum PluginLinkerAPIVersion { >> LAPI_V0 = 0, >> LAPI_V1, >> }; >> >> get_api_version(const char *plugin_identifier, >> unsigned plugin_version, >> PluginLinkerAPIVersion minimal_api_supported, >> PluginLinkerAPIVersion maximal_api_supported, >> const char **linker_identifier, >> const char **linker_version) { >> >> checks such as 'min_api_supported > LAPI_V1' can be optimized out. Also, >> if a future tool passes LAPI_V2, it will trigger Clang's UBSan (GCC >> -fsanitize-undefined=enum instruments loads but not retrieval of function >> arguments). >> >> I'd suggest to fix this on both sides by changing the arguments to plain >> integer types. > > That's a good point - the enum itself is then also somewhat redundant > if it just specifies symbolic names for 0, 1, ... but we can keep it for > documentation purposes. All right, here we go with the integer types. May I install the version now? Thanks, Martin > >> >> Alexander