[PATCH] D133107: [COFF] Don't generate -exclude-symbols for dllexported symbols

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 19:52:02 PDT 2022


MaskRay added a comment.

In D133107#3764769 <https://reviews.llvm.org/D133107#3764769>, @mstorsjo wrote:

> In D133107#3764655 <https://reviews.llvm.org/D133107#3764655>, @MaskRay wrote:
>
>> This looks somewhat weird. How does a symbol end up with `hidden dllexport`? In other object file formats (ELF, Mach-O) this can't happen, since a hidden symbol cannot be exported.
>
> It can happen if you build with e.g. `-fvisibility=hidden`, coupled with source that have `__declspec(dllexport)` for the symbols that should be exported.
>
> Consider a project that has been built with `-fvisibility=hidden` traditionally (which has had no effect at all on windows targets, up until a month ago). Such a project would have e.g. an `EXPORT` define for symbols that should be exported. For windows, it expands to `__declspec(dllexport)` while it expands to `__attribute__((visibility(“default”)))` on other OSes.
>
> So in one sense, I guess one could say that `dllexport` should imply default visibility on the clang level too.

Yes. I think that is better. `__attribute__((visibility("hidden"))) __declspec(dllexport)` should probably lead to an error.

Sent D133180 <https://reviews.llvm.org/D133180> to suppress hidden for dllexport as we do for dllimport.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133107



More information about the llvm-commits mailing list