[LLVMdev] design for an accurate ODR-checker with clang

John Bytheway jbytheway+llvm at gmail.com
Mon Jul 15 19:50:38 PDT 2013


On 2013-07-15 18:20, Richard Smith wrote:
> On Mon, Jul 15, 2013 at 3:12 PM, John McCall
> <rjmccall at apple.com
> <mailto:rjmccall at apple.com>> wrote:
> 
>     On Jul 11, 2013, at 6:13 PM, Nick Lewycky
>     <nlewycky at google.com
>     <mailto:nlewycky at google.com>> wrote:
>>         This is the right basic design, but I'm curious why you're
>>         suggesting that the payload should just be a hash instead of
>>         an arbitrary string.
>>
>>
>>     What are you suggesting goes into this string?
> 
>     The same sorts of things that you were planning on hashing, but
>     maybe not hashed.  It's up to you; having a full string would let
>     you actually show a useful error message, but it definitely inflates
>     binary sizes.  If you really think you can make this performant
>     enough to do on every load, I can see how the latter would be important.
>
> (Perhaps this also clarifies why we want a hash: an unhashed string
> would contain as much entropy as the entirety of the source code...)

Maybe you can't afford to store the unhashed data for everything, but
what about an option to store it for particular function(s)/class(es).
That way, once an ODR violation has been detected through the hash
infrastructure the compilation/linking can be repeated with more data
stored, and yield a decent error message about what exactly changed
between the two definitions.

John Bytheway





More information about the llvm-dev mailing list