s390x needs minimum alignment for global variables #44411
Labels
A-codegen
Area: Code generation
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Clang has
TargetInfo::MinGlobalAlign
which sets a minimum alignment for global variables (unless explicitly aligned less). This is needed for s390x to have 2-byte alignment even for 1-byte-aligned types, as explained in clang r181210:For Rust, I ran into trouble here when running
bootstrap
from 1.21-beta. It now usesserde_json
, and the staticserde_json::read::ESCAPE: [bool; 256]
was misaligned. In the binary and in memory it was at an odd address, but the generated code/relocation tried to read it from an even address, so it was off by one. This led toserde_json
throwing anInvalidUnicodeCodePoint
error on a space (0x20), because it was effectively indexing the entry for 0x1F (which needs to be escaped in JSON).The text was updated successfully, but these errors were encountered: