[llvm] 6604295 - [WebAssembly] WebAssembly doesn't support "protected" visibility

Dan Gohman via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 12 19:53:15 PDT 2020


Author: Dan Gohman
Date: 2020-06-12T19:52:35-07:00
New Revision: 66042959590d6db9d2a12803a16476d4e3508f3f

URL: https://github.com/llvm/llvm-project/commit/66042959590d6db9d2a12803a16476d4e3508f3f
DIFF: https://github.com/llvm/llvm-project/commit/66042959590d6db9d2a12803a16476d4e3508f3f.diff

LOG: [WebAssembly] WebAssembly doesn't support "protected" visibility

Implement the `hasProtectedVisibility()` hook to indicate that, like
Darwin, WebAssembly doesn't support "protected" visibility.

On ELF, "protected" visibility is intended to be an optimization, however
in practice it often [isn't], and ELF documentation generally ranges from
[not mentioning it at all] to [strongly discouraging its use].

[isn't]: https://www.airs.com/blog/archives/307
[not mentioning it at all]: https://gcc.gnu.org/wiki/Visibility
[strongly discouraging its use]: https://www.akkadia.org/drepper/dsohowto.pdf

While here, also mention the new Reactor support in the release notes.

Added: 
    

Modified: 
    clang/lib/Basic/Targets/WebAssembly.h
    llvm/docs/ReleaseNotes.rst

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/Targets/WebAssembly.h b/clang/lib/Basic/Targets/WebAssembly.h
index 030d79ea2ecc..e09e21d90802 100644
--- a/clang/lib/Basic/Targets/WebAssembly.h
+++ b/clang/lib/Basic/Targets/WebAssembly.h
@@ -132,7 +132,14 @@ class LLVM_LIBRARY_VISIBILITY WebAssemblyTargetInfo : public TargetInfo {
   }
 
   bool hasExtIntType() const override { return true; }
+
+  bool hasProtectedVisibility() const override {
+    // TODO: For now, continue to advertise "protected" support for
+    // Emscripten targets.
+    return getTriple().isOSEmscripten();
+  }
 };
+
 class LLVM_LIBRARY_VISIBILITY WebAssembly32TargetInfo
     : public WebAssemblyTargetInfo {
 public:

diff  --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index ea1fad1f6390..7d71d0c58a4c 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -144,8 +144,14 @@ Changes to the AVR Target
 Changes to the WebAssembly Target
 ---------------------------------
 
-During this release ...
-
+* Programs which don't have a "main" function, called "reactors" are now
+  properly supported, with a new `-mexec-model=reactor` flag. Programs which
+  previously used `-Wl,--no-entry` to avoid having a main function should
+  switch to this new flag, so that static initialization is properly
+  performed.
+
+* `__attribute__((visibility("protected")))` now evokes a warning, as
+  WebAssembly does not support "protected" visibility.
 
 Changes to the OCaml bindings
 -----------------------------


        


More information about the llvm-commits mailing list