ebrevnov added a comment.

In D102090#3169726 <https://reviews.llvm.org/D102090#3169726>, @rnk wrote:
> In D102090#3169439 <https://reviews.llvm.org/D102090#3169439>, @ebrevnov 
> wrote:
>
>> While -Bsymbolic-funtions brings nice performance improvements it also 
>> changes symbol resolution order. That means we effectively disabled  
>> preemption for functions and all references from inside libLLVM*.so will be 
>> resolved locally.  But references to global data can still be interposed by 
>> external definitions. Do I understand correctly that main argument against 
>> using -Bsymbolic is potential issue with equality comparison of address of 
>> global? Or anything else?
>
> I think it has less to do with the uniqueness of the addresses and more to do 
> with the deduplication of the global storage. If you have an inline C++ 
> global variable present in LLVM's headers (think a static data member of a 
> class template instantiation), things go wrong quickly if there are two 
> copies of this global, one in LLVM, and the other in the user's binary. 
> Updates from one DSO will not be visible in the other.

I don't see what's wrong here (maybe you have specific example). IMHO, quite 
opposite, LLVM will consistently use it's own instance while user's binary it's 
own as if  there were two globals with different names in the first place. I 
have exactly that real life case where LLVM's function (coming from libLLVM*.so 
since functions are not interposed) refers to a global from the user's binary 
with the same name by completely different semantics.

> If you arrange the same situation with functions, they are usually 
> functionally equivalent even if there are minor code differences.

I don't think it is safe to assume that. Maybe in most cases, but not always.

> Generally, users are not trying to preempt LLVM's own function definitions. 
> The typical use cases are to override C library functionality such as malloc. 
> The performance benefit of -Bsymbolic-functions is worth making LLVM's own 
> functions non-interposable.

I don't think this is really relevant to the subject since performance is 
outside of the scope of my question. The question is if -Bsymbolic can protect 
us from unintentional preemption by user defined globals.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102090/new/

https://reviews.llvm.org/D102090

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to