Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-02-04 11:45:02 +0300
committerCampbell Barton <campbell@blender.org>2022-02-04 11:48:00 +0300
commit2d429bfdf8a4fd25891ba682618d6ba25435410b (patch)
tree279d4747a48e0ea8016c6334c91ba9a33d375ee5 /source/blender/makesdna
parente9fc25835f2091cf6533d92379a31c0656b4aafb (diff)
Fix T93425: makesdna crashes during build with LTO on s390x Linux
DNAstr was assumed to be 4-byte aligned which is not necessarily the case for byte-arrays. Use a compiler attribute to ensure this is the case. Thanks to @mtasaka for investigating and providing a patch.
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/intern/makesdna.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 114c0b40407..d94b95fc6f4 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -1555,8 +1555,18 @@ int main(int argc, char **argv)
base_directory = BASE_HEADER;
}
+ /* NOTE: #init_structDNA() in dna_genfile.c expects `sdna->data` is 4-bytes aligned.
+ * `DNAstr[]` buffer written by `makesdna` is used for this data, so make `DNAstr` forcefully
+ * 4-bytes aligned. */
+#ifdef __GNUC__
+# define FORCE_ALIGN_4 " __attribute__((aligned(4))) "
+#else
+# define FORCE_ALIGN_4 " "
+#endif
fprintf(file_dna, "extern const unsigned char DNAstr[];\n");
- fprintf(file_dna, "const unsigned char DNAstr[] = {\n");
+ fprintf(file_dna, "const unsigned char" FORCE_ALIGN_4 "DNAstr[] = {\n");
+#undef FORCE_ALIGN_4
+
if (make_structDNA(base_directory, file_dna, file_dna_offsets, file_dna_verify)) {
/* error */
fclose(file_dna);