[all-commits] [llvm/llvm-project] 898dc2: [clang] Inconsistent attributes for `dllexport __c...

Akash Manna via All-commits all-commits at lists.llvm.org
Wed Sep 23 19:36:14 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 898dc21a7e97a7a5e055428219fd23f59f6563b4
      https://github.com/llvm/llvm-project/commit/898dc21a7e97a7a5e055428219fd23f59f6563b4
  Author: Akash Manna <akash.manna.mymail at gmail.com>
  Date:   2026-09-24 (Thu, 24 Sep 2026)

  Changed paths:
    M clang/docs/ReleaseNotes.md
    M clang/lib/CodeGen/ItaniumCXXABI.cpp
    A clang/test/CodeGenCXX/dllexport-rtti-visibility.cpp

  Log Message:
  -----------
  [clang] Inconsistent attributes for `dllexport __cxxabiv1:: __fundamental_type_info` with `-fvisibility=hidden` (#215859)

Fixes #207963

The issue is `__declspec(dllexport)` and `hidden` visibility cannot be
used together. LLVM rejects `globals` that have both attributes.

For normal globals, `CodeGenModule::setGlobalVisibility` already handles
this by giving `dllexport` priority over the visibility implied by
`-fvisibility=hidden`. RTTI follows a different code path, though.
`ItaniumRTTIBuilder::BuildTypeInfo` applies the visibility and DLL
storage class separately to the generated `_ZTI*` and `_ZTS*` globals,
so the conflict was not resolved.

As a result, marking `__cxxabiv1::__fundamental_type_info` as
`dllexport` while compiling with `-fvisibility=hidden` could generate
RTTI globals with both hidden visibility and `dllexport`, causing LLVM
to fail verification with Broken module found. The same problem can
occur for `dllexport`-ed polymorphic classes when targeting Windows with
the Itanium ABI.

Resolve the conflict directly in `BuildTypeInfo`, where both attributes
are applied. When `dllexport` is present, only hidden visibility is
changed to default; protected visibility is left unchanged because
protected with `dllexport` is valid LLVM IR. Explicit
`visibility("hidden")` on a `dllexport`-ed class continues to produce
the existing diagnostic.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list