[PATCH] D36712: Emit section information for extern variables

Simon Dardis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 15 06:56:48 PDT 2017


sdardis requested changes to this revision.
sdardis added a reviewer: kparzysz.
sdardis added a comment.
This revision now requires changes to proceed.

+kparzysz as Hexagon also makes use of the small data section.



================
Comment at: docs/LangRef.rst:629
+corresponding to the LLVM module, section information specified in the 
+declaration is retained in LLVM IR to enable OpenCL processes.
+
----------------
efriedma wrote:
> This doesn't really explain the part that matters. For LangRef, it doesn't matter how the frontend decides to generate declarations (and it might be different for frontends other than clang).  And OpenCL might motivate this, but it has nothing to do with the semantics.
> 
> The key question here is what it actually means.  Is it a promise the that a definition will exist for the given symbol in the given section?  If so, what happens if the symbol is actually in a different section?  ("Undefined behavior" is probably an acceptable answer, but it needs to be stated explicitly.)
> to enable OpenCL processes.

for targets which make use of this section information. 

I would also work in a sentence that says that attaching section information to a external declaration is an assertion or promise that the definition is located in that section. If the definition is actually located in a different section the behaviour is undefined.

I'm favouring "undefined behaviour" in the error case as behaviour is so target and environment specific.


https://reviews.llvm.org/D36712





More information about the cfe-commits mailing list