<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - LTO + LLD fails with "SHF_MERGE section size must be a multiple of sh_entsize""
href="https://bugs.llvm.org/show_bug.cgi?id=43627">43627</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LTO + LLD fails with "SHF_MERGE section size must be a multiple of sh_entsize"
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>samitolvanen@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, jgalenson@google.com, llvm-bugs@lists.llvm.org, ndesaulniers@google.com, ruiu@google.com
</td>
</tr></table>
<p>
<div>
<pre>When compiling the Linux kernel with ThinLTO+LLD, we ran into an issue that can
be reproduced as follows:
$ cat test.c
#include <stdio.h>
#define SIZE_AB 2
#define SIZE_C 3
#define __initconst __attribute__((__section__(".init.rodata")))
static const unsigned int __initconst a[][SIZE_AB] = {
{ 0, 0 },
{ 0, 0 },
};
static const unsigned int __initconst b[][SIZE_AB] = {
{ 0, 0 },
{ 0, 0 },
};
static const unsigned int __initconst c[][SIZE_C] = {
{ 0, 0, 0 },
{ 0, 0, 0 },
};
int main() {
for (int i = 0; i < 2; i++) {
printf("%u\n", a[i][0]);
printf("%u\n", b[i][0]);
printf("%u\n", c[i][0]);
}
return 0;
}
$ clang -flto=thin -fvisibility=default -c -o test.o test.c
$ ld.lld -r -o all.o test.o
ld.lld: error: lto.tmp: SHF_MERGE section size must be a multiple of sh_entsize
Here, the section size is 56 bytes, while sh_entsize is 16 bytes.
In the kernel, we don't have this issue with full LTO, but the reproducer above
fails to compile also with -flto. Here's the ClangBuiltLinux bug:
<a href="https://github.com/ClangBuiltLinux/linux/issues/510">https://github.com/ClangBuiltLinux/linux/issues/510</a>
This issue is reproducible with a ToT LLVM.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>