[PATCH] D129369: [SystemZ][z/OS] Force alignment to fix build failure on z/OS

Wolfgang Pieb via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 8 11:28:17 PDT 2022


wolfgangp added inline comments.


================
Comment at: llvm/include/llvm/IR/Metadata.h:957
+    // have an alignment of 1.
+    bool IsResizable [[gnu::aligned(alignof(size_t))]] : 1;
     bool IsLarge : 1;
----------------
This fails for me on Windows builds using Visual Studio (at least VS19), since it does not support this attribute. I would suggest using alignas() in the struct declaration instead, like 

```
struct alignas(alignof(size_t)) Header {
```

and see if this works for you.


================
Comment at: llvm/include/llvm/IR/Metadata.h:1037
 
+  static_assert(__builtin_offsetof(Header, NumUnresolved) == sizeof(size_t),
+                "NumUnresolved offset is incorrect");
----------------
This is not guaranteed on all platforms, because some compilers don't necessarily pack the bitfields tightly. In fact, I'll need to reexamine this for Visual Studio builds and perhaps adjust the bitfield types. I would ask you to not put this assert in for now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129369



More information about the llvm-commits mailing list