[PATCH] D78952: [LangRef] Describe linkage types, allocation size of declarations for global variables

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 14:34:12 PDT 2020


efriedma added subscribers: hfinkel, spatel.
efriedma added a comment.

I don't want to take this too far off track, but there are some additional caveats which might not be obvious to someone reading this rule:

1. Global variables are not allowed to overlap.  (This follows from the pointer aliasing rules.)
2. The alignment does have to match the declared alignment.  And the "declared" alignment is implicitly computed based on the type if it isn't explicitly specified.

Not sure if it makes sense to modify the language here.



================
Comment at: llvm/docs/LangRef.rst:691
 
+For global variables *declarations*, as well as definitions that may be
+replaced at link time (``linkonce``, ``weak``, ``extern_weak`` and ``common``
----------------
Not sure the italics are necessary.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78952





More information about the llvm-commits mailing list