[llvm] [clang] [AIX][TOC] Add -mtocdata/-mno-tocdata options on AIX (PR #67999)

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 29 13:13:03 PST 2023


hubert-reinterpretcast wrote:

> The manual change says "the TOC data transformation will be applied to [...] block-scope static variables". But later, you mention "internal linkage", which is a bit confusing when you're dealing with C++. Block-scope static variables don't have "linkage" in the sense defined in the C++ standard. Maybe worth trying to be more explicit here.

The later mention of "internal linkage" is with respect to not being able to apply the transformation to variables with internal linkage. This is consistent with block-scope static variables not having "linkage" as defined by the C++ standard. @efriedma-quic

Nevertheless, the other mention of "internal linkage" (which states that the explicit naming forms ignore such variables) may also require the addition of "block-scope static variables". @syzaara

My understanding is that trying to name the `x` below using `-mtocdata=_ZZ3foovE1x` is not effective:
```cpp
inline int foo [[gnu::used]]() {
  static int x = 0;
  return ++x;
}
```

https://github.com/llvm/llvm-project/pull/67999


More information about the cfe-commits mailing list