[PATCH] D46805: If some platforms do not support an attribute, we should exclude the platform

Li Jia He via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 2 01:11:18 PDT 2018


HLJ2009 added a comment.

In https://reviews.llvm.org/D46805#1117091, @sunfish wrote:

> In https://reviews.llvm.org/D46805#1115681, @rsmith wrote:
>
> > In https://reviews.llvm.org/D46805#1113358, @aaron.ballman wrote:
> >
> > > @rsmith -- do the object file formats listed look correct to you?
> >
> >
> > They look at least plausible. We should be able to test whether LLVM can actually emit aliases on each of these targets easily enough...
> >
> > However, I get this error for any WAsm compilation I try:
> >
> >   fatal error: error in backend: section size does not fit in a uint32_t
> >
> > ... so I have no idea if aliases are/will be supported there. Perhaps @sunfish can tell us :)
>
>
> Yes, they are intended to be supported. It sounds like you found a bug, though I've not been able to reproduce it in simple tests.




================
Comment at: include/clang/Basic/Attr.td:322
+def TargetSupportsAlias : TargetSpec {
+  let ObjectFormats = ["COFF", "ELF", "Wasm"];
+}
----------------
aaron.ballman wrote:
> Did you verify that Wasm supports the alias attribute? If it is supported, it might be nice to add a test to `CodeGen/alias.c` to demonstrate it. Similar for COFF.
Yes, I used the following command line to test my test file.
clang -cc1 -triple wasm32-unknown-unknown -fsyntax-only -verify attr-alias-has.c
clang -cc1 -triple wasm64-unknown-unknown -fsyntax-only -verify attr-alias-has.c
The test result is ok. 
ok, I will update it.


================
Comment at: test/Sema/attr-alias-has.c:5
+// RUN: %clang_cc1 -triple wasm32-unknown-unknown -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple wasm64-unknown-unknown -fsyntax-only -verify %s
+
----------------
aaron.ballman wrote:
> I'd like to see a test that the "attribute not supported on target" diagnostic is being generated. I'd recommend something along these lines:
> ```
> void g() {}
> void f() __attribute__((alias("g")));
> #if !__has_attribute(alias)
> // expected-error at -2{{expected diagnostic text}}
> #else
> // expected-no-diagnostics
> #endif
> ```
ok, I will update it.


Repository:
  rC Clang

https://reviews.llvm.org/D46805





More information about the cfe-commits mailing list