[PATCH] D81688: [WebAssembly] WebAssembly doesn't support "protected" visibility
Dan Gohman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 11 13:47:58 PDT 2020
sunfish created this revision.
Herald added subscribers: llvm-commits, aheejin, jgravelle-google, sbc100, dschuff.
Herald added projects: clang, LLVM.
mplement 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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D81688
Files:
clang/lib/Basic/Targets/WebAssembly.h
llvm/docs/ReleaseNotes.rst
Index: llvm/docs/ReleaseNotes.rst
===================================================================
--- llvm/docs/ReleaseNotes.rst
+++ llvm/docs/ReleaseNotes.rst
@@ -144,8 +144,14 @@
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
-----------------------------
Index: clang/lib/Basic/Targets/WebAssembly.h
===================================================================
--- clang/lib/Basic/Targets/WebAssembly.h
+++ clang/lib/Basic/Targets/WebAssembly.h
@@ -132,7 +132,14 @@
}
bool hasExtIntType() const override { return true; }
+
+ bool hasProtectedVisibility() const override {
+ // For compatibility, continue to advertise "protected" support for
+ // Emscripten targets.
+ return getTriple().isOSEmscripten();
+ }
};
+
class LLVM_LIBRARY_VISIBILITY WebAssembly32TargetInfo
: public WebAssemblyTargetInfo {
public:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81688.270223.patch
Type: text/x-patch
Size: 1377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200611/200d08c7/attachment-0001.bin>
More information about the cfe-commits
mailing list