> On 5 Oct 2025, at 05:15, Jeff Law <[email protected]> wrote:
> 
> 
> On 10/3/25 12:27 PM, Yangyu Chen wrote:
>> This patch adds support for target_clones table option. The
>> target_clones table option allows users to specify multiple versions
>> of a function and select the version at runtime based on the specified
>> table.
>> The target clone table is a JSON object where function names serve as
>> keys, and their values are nested objects. Each nested object maps
>> architecture names to lists of target clone attributes. This structure
>> allows specifying function clones for different architectures. Below is
>> an example:
> So how is this expected to interact with languages that mangle names? Is the 
> mangled named used in the json file?  How are you going to handle lookups in 
> that scenario?

They are frontend mangled asm name here. For example, in C++,
`void foo()` will be "_Z3foov". Thus there is no need for additional
lookups.

> 
> I think the documentation needs a bit more work -- unlike an option that just 
> toggles a code generation feature on/off, this feature needs to actually 
> document the format of the json file, preferably with an embedded example.  
> It'll need to touch on limitations (is it specific to a subset of languages, 
> how is mangling handled, etc).
> 

Exactly. I have done this in patch v6:
https://inbox.sourceware.org/gcc-patches/[email protected]/


> So at this point it looks like an interesting idea with a proof of concept.  
> Assuming you have a reasonable answer for how to deal with other languages, 
> then the question I think we need to answer (as a project) is whether or not 
> we want the feature.
> 
> Jeff
> 

Reply via email to