[PATCH] D36712: Emit section information for extern variables

Krzysztof Parzyszek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 16 08:45:57 PDT 2017


kparzysz added a comment.

In https://reviews.llvm.org/D36712#843387, @eandrews wrote:

> Does this result in unexpected behavior though? Won't this just result in the global being defined in the specified section?


If there is no section given explicitly, there is function SelectSectionForGlobal that will determine the section based on the properties of the global.  If there is code that only sees the declaration, but needs to know the section, it will get it from that function.  If the definition of that global doesn't have section either, that same function will be used, hopefully with the same result.  On the other hand, if the definition of the global has an explicit section, it may differ from the one calculated for the declarations of that global.  This could lead to a problem.


https://reviews.llvm.org/D36712





More information about the cfe-commits mailing list