<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/140052>140052</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            type_info name alignment on s390x
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          iii-i
      </td>
    </tr>
</table>

<pre>
    On the s390x platform clang generates type_info names with alignment 1:

```
$ cat test.cpp && bin/clang -S test.cpp -mllvm -print-after-all 2>&1|grep "^@_ZTS1A ="
#include <typeinfo>
struct A {};
const std::type_info &q() { return typeid(A); }
@_ZTS1A = linkonce_odr dso_local constant [3 x i8] c"1A\00", comdat, align 1
```

Normally external symbols are aligned on a 2-byte boundary on s390x, and this is what GCC does for type_info names. Looking at the code that generates it:

```
  auto Align = CGM.getContext().getTypeAlignInChars(CGM.getContext().CharTy);

 llvm::GlobalVariable *GV = CGM.CreateOrReplaceCXXRuntimeVariable(
 Name, Init->getType(), Linkage, Align.getAsAlign());
```

The alignment used here is more or less `alignof(char)`. I wonder if we should apply a more restrictive alignment? I have not looked into details, but clang uses alignment 2 for char arrays on s390x, so there must be some common code infrastructure for this purpose.

@uweigand @dominik-steenken 
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxsVF1v5CgQ_DXMS8sjDPZ8PPjBcTJRpL1daTdare4lwqbH5oLBB-0k8-9P2MklWa1kaRAUXUV19agYTe8QK1ZesfJ6o2YafKiMMZnZtF5fqm8OaECI8shfYLKKzj6M0FnleujRYVCEEegy4YNxZw9OjRjh2dAAyprejegIciZrxpdvx18_XjNRQKcICCNtu2kCJnZM7KA1jonTSpH9eD_ORmufRsimYBxl6kwYMmUtCCZvmNjlbN_0AVMZwcobVvCHv-9_5DUweZ22EqE0rrOzRmCySZqT5HSb15HC3BHUwPZXbH_N5BXjdeddJIikk35Zv7-Sid2_TByYO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